From 9d42a7b564fc09cc58db726d16a8049011d35090 Mon Sep 17 00:00:00 2001 From: cyril constantin Date: Wed, 27 May 2026 12:47:12 +0200 Subject: [PATCH] Update README --- README.md | 95 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 37bd72c..57b0d78 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It was developped on debian (bookworm i686, trixie x86_64). The requirements are those of the book : -The */mnt/lfs* partition is not created by the script. +The **/mnt/lfs** partition is not created by the script. You have to create it by yourself. Some commands are provided by the script. @@ -25,14 +25,14 @@ passwd lfs Some additionnal requirements : -* the *lfs* user is mandatory - * The script should by executed by *lfs* user +* the **lfs** user is mandatory + * The script should by executed by **lfs** user * sudo command is necessary - * a sudoers file is provided for *lfs* user to restrict rights to stricts requirements. - * this sudoers file allow to protect the host and restrict command only to */mnt/lfs* directory - * it allow the following commands on */mnt/lfs* : chown mount install chroot + * a sudoers file is provided for **lfs** user to restrict rights to stricts requirements. + * this sudoers file allow to protect the host and restrict command only to **/mnt/lfs** directory + * it allow the following commands on **/mnt/lfs** : chown mount install chroot * build directory is hardcoded : /mnt/lfs -* mount |grep -q "/mnt/lfs type ext4 should return ok +* mount |grep -q "/mnt/lfs type ext4" should return ok * /etc/bash.bashrc should not be used on host * sudo mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE * cross compilation for glibc seems to need some specific packages @@ -54,7 +54,7 @@ The script do some writings only under : The script builds LFS by completing the following steps: -1. Download package source code and save to the `packages` directory. +1. Download package source code and save to the _packages_ directory. 2. Build initial cross compilation tools. This corresponds to chapter 5 in the LFS book, and "phase 1" of the script. 3. Begin to build tools required for minimal chroot environment. (chapter 6/phase 2) 4. Enter chroot environment, and build remaining tools needed to build the entire LFS system. (chapter 7/phase 3) @@ -62,14 +62,14 @@ The script builds LFS by completing the following steps: The script ask for validation for each step. You can disable validation until desired step with a number as argument. -The *number* is the chapter (of the books) on 5 digits until you validate. -If you want to start validation at *5. Compiling a Cross-Toolchain*, it's *50000*. +The _number_ is the chapter (of the books) on 5 digits until you validate. +If you want to start validation at _5. Compiling a Cross-Toolchain_, it's _50000_. -To configure it, execute a first time the *make* command. -A file *~lfs/.lfsbuild_config* will be created. +To configure it, execute a first time the _make_ command. +A file **~lfs/.lfsbuild_config** will be created. You can customize it by setting the BREAKPOINT var. -Or create the file before : +Or create and customize the file before : ```bash cat /home/lfs/.lfsbuild_config << EOSF @@ -80,22 +80,19 @@ LFS_NPROC=$(nproc) # Bypass step by step validation until a breakpoint LFS_BREAKPOINT=1 # strip binaries or not -LFS_STRIP_BINARIES=false +LFS_STRIP_BINARIES=true # bypass network config validation by taking network config from host LFS_NETWORKSAMEASHOST=false # bypass network configuration for full offline build LFS_NETWORKOFFLINE=false # bypass linux config validation by taking linux config from host -# !!! LFS doesn't built a initramfs. If your host load required drivers as modules in it, you won't be able to boot. -# It may be convenient if you build from an LFS host. -# You can also put a config file in your home ( $HOME/linux-config-*version* e.g. linux-config-6.8.10 ) and it will be taken as config file. -LFS_LINUXCONFIGSAMEASHOST=false +LFS_LINUXCONFIGPROVIDED=false EOSF ``` ## Examples -Execute as *lfs* user. +Execute as **lfs** user. ```bash make @@ -122,7 +119,7 @@ menuentry "GNU/Linux, Linux 6.18.10-lfs-13.0-systemd with partuuid" { } ``` -The *partuuid* section is not required, but can be helpful if you add another disk or change boot order in bios. partuuid is *more* immutable then *vdx*. +The _partuuid_ section is not required, but can be helpful if you add another disk or change boot order in bios. partuuid is _more_ immutable than _vdx_. Devices are extracted from the following command : @@ -138,32 +135,70 @@ cae0487a-2eca-44c7-aa5f-060ea258f30c 9ffe027f-05 /dev/v 8c137b8d-3612-4715-94c2-8203e273318f 001cdfe1-01 /dev/vdb1 /mnt/lfs ``` -In this configuration extracted from a libvirt host (*/dev/vdxn*) with a second disk dedicated to LFS, /mnt/lfs device entry is filtered. +In this configuration extracted from a libvirt host ( _/dev/vdxn_ ) with a second disk dedicated to LFS, /mnt/lfs device entry is filtered. The grub config is made with it. -*cclfs* doesn't install the bootloader. It use the bootloader of the host. +**cclfs** doesn't install the bootloader. It use the bootloader of the host. You can install it if you want before or after the first boot. -See instruction in *LFS* book and *BLFS* book. There is only one bootloader *by default* at boot nonetheless. +See instruction in _LFS_ book and _BLFS_ book. There is only one bootloader _by default_ at boot nonetheless. + +### Debian configuration + On Debian Trixie (13) (at least), OS_PROBER is disabled. Just uncomment the line in /etc/default/grub or customize a config file in /etc/grub.d/ . And reinstall the bootloader. ```bash -$ su - +$ sudo vim /etc/default/grub $ grep PROBER /etc/default/grub GRUB_DISABLE_OS_PROBER=false -# vim /etc/default/grub -# update-grub +$ sudo update-grub ``` -In default configuration, libvirt doesn't activate a second disk, so it won't boot. -Activate the second disk in the boot options. +In default configuration, libvirt/kvm doesn't activate a second disk, so it won't boot. +You have to activate the second disk in the boot options. -You can find devices seen by *bios* with the grub console : type *c* at grub general menu +You can find devices seen by _bios_ with the grub console : type **c** at grub general menu ```bash ls (hd0,msdos1) (hd0,msdos5) (hd1,msdos1) ``` -If you don't see your *LFS* partition, it won't boot. +If you don't see your LFS partition, it won't boot. + +## Automated LFS is not LFS + +The goal of LFS is to learn how to build a GNU/Linux OS. + +Read the book is a very convenient way to learn. That's why the script follow _at most_ the book. + +Copy and paste command is not learning, it learn to copy/paste, maybe. Manual commands with modification may generate errors you don't see. +You don't know where you made the mistake, you restart, you fail, you don't understand, and you give up. + +Or you write a small bash script to avoid copy/paste errors. And you write this. + +Writing a script like this _is_ a lot of learning. And automation may help to encourage in LFS development. + +Forking the repo and personnal appropriation seems _IMHO_ a good choice. + +## Why not use _alfs_ , _jhlfs_ and reinvent the wheel ? + +The following section of the README is not convenient for my personnal usage. + +```md +5. RUNNING:: + + IMPORTANT:: + You must be logged as a normal user with sudo privileges to run + the Makefile. Furthermore, you are supposed to have enough privilege + to become any user. If you are not bothered about security issues, + the entry for the user running the tool in /etc/sudoers could be + ALL=(ALL) NOPASSWD:ALL +``` + +On a dedicated VM for tests, ok. +On a real computer with other roles, give all **root** rights is **NOT** acceptable. + +_cclfs_ works with a dedicated lfs user with only **required** rights **only** on /mnt/lfs. +There is absolutely no possibility to break anything else on the host than **/mnt/lfs**.