Building Linux From Scratch 10.0

Building Linux From Scratch 10.0

Introduction

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.

document

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 LFSReadOnlineStableLFS You can browse by following the link.

Things necessary

Construction procedure

The specific construction procedure consists of the following three stages.

Build preparation

Build and mount the file system on the storage for LFS. Place the files and directories needed for the build there.

Toolchain construction

Build a minimal build environment independent of the host system, called a tool chain.

LFS construction

Build each package using the toolchain. Also install the boot loader in the storage for LFS.

The place to stumble

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.

Create new partition (http://lfsbookja.osdn.jp/10.0-ja/chapter02/creatingpartition.html)

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.

  1. Make it the beginning of the partition
  2. Flag bootable

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.

Generate File System (http://lfsbookja.osdn.jp/10.0-ja/chapter02/creatingfilesystem.html)

If you're not sure about your file system choice, EXT4 is safe.

Linux-5.8.3

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]

Setting up the boot process with GRUB (http://lfsbookja.osdn.jp/10.0-ja/chapter10/grub.html)

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

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

Building Linux From Scratch 10.0
Introducing Docker Engine to Linux From Scratch
Deep Learning from scratch
Django memo # 1 from scratch
Deep Learning from scratch 1-3 chapters
Django starting from scratch (part: 2)
Django starting from scratch (part: 1)
Impressions from reading Linux comics # 1
A story about creating a UNIX / Linux compatible OS from scratch
Deep learning from scratch (cost calculation)
Create Scratch Offline Editor for Linux
Try sklearn's regression model from scratch
Persistent data structure created from scratch
App installed from Windows10 32-bit scratch
Linux
Try Django's official tutorial from scratch
Deep Learning memos made from scratch
Let Code Day75 starting from scratch "15.3 Sum"
[Linux] Flow from power-on to PC startup
[Learning memo] Deep Learning made from scratch [Chapter 7]
Deep learning from scratch (forward propagation edition)
Deep learning / Deep learning from scratch 2-Try moving GRU
Deep learning / Deep learning made from scratch Chapter 6 Memo
[Learning memo] Deep Learning made from scratch [Chapter 5]
Business efficiency starting from scratch with Python
Let Code Day 29 "46. Permutations" starting from scratch
[Learning memo] Deep Learning made from scratch [Chapter 6]
How to operate Linux from the console
"Deep Learning from scratch" in Haskell (unfinished)
Deep learning / Deep learning made from scratch Chapter 7 Memo
[Windows 10] "Deep Learning from scratch" environment construction
[Amazon Linux] Switching from Python 2 series to Python 3 series
[Deep Learning from scratch] About hyperparameter optimization
"Deep Learning from scratch" Self-study memo (Part 12) Deep learning
[Learning memo] Deep Learning made from scratch [~ Chapter 4]