Linux From Scratch (** LFS **) is a project that provides steps to build a Linux system from scratch. After many years of release, this year the LFS version has reached 10.0. In this article, I would like to write down the procedure for building LFS 10.0.
The Japanese translation of LFS is available in the LFS Book Japanese Version project. Basically, if you follow here in order, the construction of LFS will be completed in the end.
The official document is from Official Site LFS→ReadOnline→StableLFS You can browse by following the link.
The specific construction procedure consists of the following three stages.
Build and mount the file system on the storage for LFS. Place the files and directories needed for the build there.
Build a minimal build environment independent of the host system, called a tool chain.
Build each package using the toolchain. Also install the boot loader in the storage for LFS.
It is highly recommended that you follow the instructions in the documentation for your first build. Otherwise, when the build fails, you will not know what caused the failure.
In the procedure, you have to set it according to your environment, Moreover, there are multiple places where the settings are important.
Here, I will introduce the place where I think and set it like this.
Unless you are particular about it, use storage for LFS. I think it is good to divide it into the following four partitions.
Partition number | Mount point | Partition size |
---|---|---|
1 | /boot | 200MB |
2 | / | 20GB ~ Optional |
3 | /home | Any |
4 | swap | Twice the memory capacity |
Please note the following two points for the/boot partition.
The reasonable size of each partition is described in the documentation. First, subtract the capacity of the/boot, swap partition, which can be calculated mechanically from the total capacity of the storage, You may be confused if you calculate to divide the remaining capacity by / and / home as you like.
If you're not sure about your file system choice, EXT4 is safe.
It will be a Linux kernel build.
There are many settings, but it's best not to try to customize them from the beginning. If you mess with a lot of bad things, you won't be able to determine what the cause is if the kernel doesn't boot.
I think it's a good idea to focus here on ensuring that you enable features and drivers that you know you need. Customization can be done little by little after the LFS has been built and the kernel is ready to boot.
You can read the description of an item by pressing the \ <Help > or? Key while the cursor is over the item.
If you're not sure what the feature is after reading the item description, look at the end of the description.
In most cases, there is a description like If unsure say Y.
(select "Yes" if you are not sure).
** Be sure to set the items described in the procedure notes as such. ** **
Device Drivers --->
Generic Driver Options --->
[ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
[*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
When the partition is divided as described above, the description of the grub configuration file is as follows. (When partition number 1 is the / boot partition and partition number 2 is the / partition)
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
insmod ext2
set root=(hd0,1)
menuentry "GNU/Linux, Linux 5.8.3-lfs-10.0" {
linux /vmlinuz-5.8.3-lfs-10.0 root=/dev/sda2 ro
}
Beyond Linux From Scratch (** BLFS **) is a project that provides a method for building additional packages for users who have completed LFS construction. There is [BLFS Book Japanese Version](http://lfsbookja.osdn.jp/BLFS/svn-ja /) as well as LFS Book Japanese Version, but the coverage is wide and not all have been translated.
BLFS requires you to choose the packages you need. There are many options, but for convenience, I think it's a good idea to start with the following packages.
Recommended Posts