From 8e8f87ef14616123ea8ad17ed8bf8cafab2a5692 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 12 Nov 2022 13:12:18 +0800 Subject: [PATCH 01/20] packages: also use &pypi-src; for Jinja2 and MarkupSafe The md5sums are not changed. --- packages.ent | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages.ent b/packages.ent index eee113344..b01d751f5 100644 --- a/packages.ent +++ b/packages.ent @@ -352,7 +352,7 @@ - + @@ -481,7 +481,7 @@ - + From 8ffb2771fe68a32357879afdafa3b9d0d63b97ce Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Mon, 14 Nov 2022 10:31:59 -0600 Subject: [PATCH 02/20] Update currency for sysvinitwq --- lfs-latest-git.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lfs-latest-git.php b/lfs-latest-git.php index d4f331697..2b3c9ab47 100644 --- a/lfs-latest-git.php +++ b/lfs-latest-git.php @@ -139,6 +139,7 @@ if ( $package == "procps-ng" ) $dirpath = "https://gitlab.com/procps-ng/procps/ if ( $package == "psmisc" ) $dirpath = "https://gitlab.com/psmisc/psmisc/-/tags"; if ( $package == "Python" ) $dirpath = "https://www.python.org/downloads/source/"; if ( $package == "shadow" ) $dirpath = "https://github.com/shadow-maint/shadow/releases"; +if ( $package == "sysvinit" ) $dirpath = "https://github.com/slicer69/sysvinit/releases"; if ( $package == "MarkupSafe" ) $dirpath = "https://pypi.python.org/pypi/MarkupSafe/"; if ( $package == "Jinja" ) $dirpath = "https://pypi.python.org/pypi/Jinja2/"; if ( $package == "systemd" ) $dirpath = "https://github.com/systemd/systemd/releases"; @@ -275,6 +276,9 @@ if ( $package == "zstd" ) $dirpath = "https://github.com/facebook/zstd/rel if ( $package == "shadow" ) return find_max( $lines, "/^\s+\d\./", "/^\s+([\d\.]+)$/" ); + if ( $package == "sysvinit" ) + return find_max( $lines, "/^\s+\d\./", "/^\s+([\d\.]+)$/" ); + if ( $package == "XML-Parser" ) { $max = find_max( $lines, "/$package/", "/^.*$package-([\d\._]*\d).tar.*$/" ); From 89c3f71df23eb45ecb20037102a730f0e32ce79f Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 15 Nov 2022 00:31:18 -0600 Subject: [PATCH 03/20] Tidy up some spacing issues --- chapter08/dbus.xml | 2 +- chapter08/procps.xml | 10 +++++----- chapter08/util-linux.xml | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/chapter08/dbus.xml b/chapter08/dbus.xml index 9845c7431..71a93e5cb 100644 --- a/chapter08/dbus.xml +++ b/chapter08/dbus.xml @@ -55,7 +55,7 @@ --disable-static \ --disable-doxygen-docs \ --disable-xml-docs \ - --docdir=/usr/share/doc/dbus-&dbus-version; \ + --docdir=/usr/share/doc/dbus-&dbus-version; \ --with-system-socket=/run/dbus/system_bus_socket diff --git a/chapter08/procps.xml b/chapter08/procps.xml index a78f7fa90..dbc78213c 100644 --- a/chapter08/procps.xml +++ b/chapter08/procps.xml @@ -42,15 +42,15 @@ Prepare procps-ng for compilation: -./configure --prefix=/usr \ +./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ - --disable-static \ + --disable-static \ --disable-kill -./configure --prefix=/usr \ +./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ - --disable-static \ - --disable-kill \ + --disable-static \ + --disable-kill \ --with-systemd diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml index 269f564e2..3e54a2c84 100644 --- a/chapter08/util-linux.xml +++ b/chapter08/util-linux.xml @@ -44,11 +44,10 @@ Prepare Util-linux for compilation: -./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --bindir=/usr/bin \ --libdir=/usr/lib \ --sbindir=/usr/sbin \ - --docdir=/usr/share/doc/util-linux-&util-linux-version; \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ @@ -59,13 +58,13 @@ --disable-static \ --without-python \ --without-systemd \ - --without-systemdsystemunitdir + --without-systemdsystemunitdir / + --docdir=/usr/share/doc/util-linux-&util-linux-version; -./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --bindir=/usr/bin \ --libdir=/usr/lib \ --sbindir=/usr/sbin \ - --docdir=/usr/share/doc/util-linux-&util-linux-version; \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ @@ -74,7 +73,8 @@ --disable-runuser \ --disable-pylibmount \ --disable-static \ - --without-python + --without-python \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; The --disable and --without options prevent warnings about building components that require packages not in LFS or are From b9721fd7f0d36e8067a40176a512c675469e8a2b Mon Sep 17 00:00:00 2001 From: "Thomas Trepl (Moody)" Date: Wed, 16 Nov 2022 08:46:22 +0100 Subject: [PATCH 04/20] Fix type (replace a / by a \ as line continue maker) --- chapter08/util-linux.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml index 3e54a2c84..7648d2a7f 100644 --- a/chapter08/util-linux.xml +++ b/chapter08/util-linux.xml @@ -58,7 +58,7 @@ --disable-static \ --without-python \ --without-systemd \ - --without-systemdsystemunitdir / + --without-systemdsystemunitdir \ --docdir=/usr/share/doc/util-linux-&util-linux-version; ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ From f2dff2db69d54dd23f2532a24e8d5dc54076a3a6 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 16 Nov 2022 17:46:26 +0100 Subject: [PATCH 05/20] Shadow: /usr/include/shadow is an installed dir --- chapter08/shadow.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter08/shadow.xml b/chapter08/shadow.xml index d8c79a9c1..cbd6ac913 100644 --- a/chapter08/shadow.xml +++ b/chapter08/shadow.xml @@ -244,7 +244,7 @@ useradd -D --gid 999 Installed programs - Installed directory + Installed directories Installed libraries @@ -254,7 +254,7 @@ useradd -D --gid 999 newuidmap, newusers, nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su, useradd, userdel, usermod, vigr (link to vipw), and vipw - /etc/default + /etc/default and /usr/include/shadow libsubid.so From ebecd08c0582ef9c01f784452f87f3a39cf40cdd Mon Sep 17 00:00:00 2001 From: David Bryant Date: Wed, 16 Nov 2022 13:15:01 -0600 Subject: [PATCH 06/20] Corrected grammar, spelling, and idiom in chapter 7. --- chapter07/chroot.xml | 24 +++++++++++------------ chapter07/cleanup.xml | 36 ++++++++++++++++------------------- chapter07/createfiles.xml | 10 +++++----- chapter07/kernfs.xml | 40 +++++++++++++++++++-------------------- 4 files changed, 53 insertions(+), 57 deletions(-) diff --git a/chapter07/chroot.xml b/chapter07/chroot.xml index 6404c0625..69bc6ce69 100644 --- a/chapter07/chroot.xml +++ b/chapter07/chroot.xml @@ -11,11 +11,11 @@ Entering the Chroot Environment Now that all the packages which are required to build the rest of the - needed tools are on the system, it is time to enter the chroot environment to - finish installing the remaining temporary tools. This environment will be in - use also for installing the final system. As user root, run the following command to enter the - environment that is, at the moment, populated with only the temporary + environment that is, at the moment, populated with nothing but temporary tools: chroot "$LFS" /usr/bin/env -i \ @@ -26,25 +26,25 @@ /bin/bash --login The -i option given to the env - command will clear all variables of the chroot environment. After that, only + command will clear all the variables in the chroot environment. After that, only the HOME, TERM, PS1, and PATH variables are set again. The - TERM=$TERM construct will set the TERM + TERM=$TERM construct sets the TERM variable inside chroot to the same value as outside chroot. This variable is - needed for programs like vim and less - to operate properly. If other variables are desired, such as + needed so programs like vim and less + can operate properly. If other variables are desired, such as CFLAGS or CXXFLAGS, this is a good place to set - them again. + them. From this point on, there is no need to use the - LFS variable anymore because all work will be restricted - to the LFS file system. This is because the Bash shell is told that + LFS variable any more because all work will be restricted + to the LFS file system; the chroot command tells the Bash shell that $LFS is now the root (/) directory. Notice that /tools/bin is not in the PATH. This means that the cross toolchain will no longer be - used in the chroot environment. + used. Note that the bash prompt will say I have no name! This is normal because the diff --git a/chapter07/cleanup.xml b/chapter07/cleanup.xml index 2a83e2d62..356f3c34e 100644 --- a/chapter07/cleanup.xml +++ b/chapter07/cleanup.xml @@ -13,15 +13,15 @@ Cleaning - First, remove the currently installed documentation to prevent them + First, remove the currently installed documentation files to prevent them from ending up in the final system, and to save about 35 MB: rm -rf /usr/share/{info,man,doc}/* Second, on a modern Linux system, the libtool .la files are only - useful for libltdl. No libraries in LFS are expected to be loaded by - libltdl, and it's known that some .la files can cause BLFS packages - fail to build. Remove those files now: + useful for libltdl. No libraries in LFS are loaded by + libltdl, and it's known that some .la files can cause BLFS package + failures. Remove those files now: find /usr/{lib,libexec} -name \*.la -delete @@ -42,9 +42,9 @@ and your current LFS system is in a good state. Your system can now be backed up for later reuse. In case of fatal failures in the subsequent chapters, it often turns out that removing everything and starting over - (more carefully) is the best option to recover. Unfortunately, all the + (more carefully) is the best way to recover. Unfortunately, all the temporary files will be removed, too. To avoid spending extra time to - redo something which has been built successfully, creating a backup of + redo something which has been done successfully, creating a backup of the current LFS system may prove useful. @@ -58,13 +58,12 @@ The following steps are performed from outside the chroot - environment. That means, you have to leave the chroot environment + environment. That means you have to leave the chroot environment first before continuing. The reason for that is to get access to file system locations outside of the chroot - environment to store/read the backup archive which should + environment to store/read the backup archive, which ought not be placed within the - $LFS hierarchy for - safety reasons. + $LFS hierarchy. @@ -78,7 +77,7 @@ All of the following instructions are executed by root on your host system. Take extra care about the commands you're going to run as mistakes - here can modify your host system. Be aware that the + made here can modify your host system. Be aware that the environment variable LFS is set for user lfs by default but may not be set for @@ -101,17 +100,14 @@ umount $LFS/{sys,proc,run,dev} Make sure you have at least 1 GB free disk space (the source tarballs - will be included in the backup archive) on the filesystem containing - directory where you create the backup archive. + will be included in the backup archive) on the file system containing + the directory where you create the backup archive. Note that the instructions below specify the home directory of the host system's root user, which is - typically found on the root filesystem. - - - + typically found on the root file system. Replace $HOME by a directory of your choice if you do not want to have the backup stored in root's home directory. @@ -149,7 +145,7 @@ tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz . Since the sources are located under $LFS, they are included in the backup archive as well, so they do not need to be downloaded again. After - checking that $LFS is set properly, + checking that $LFS is set properly, you can restore the backup by executing the following commands: @@ -167,7 +163,7 @@ rm -rf ./* tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz - Again, double check that the environment has been setup properly + Again, double check that the environment has been set up properly and continue building the rest of the system. @@ -175,7 +171,7 @@ tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz If you left the chroot environment to create a backup or restart building using a restore, remember to check that the virtual - filesystems are still mounted (findmnt | grep + file systems are still mounted (findmnt | grep $LFS). If they are not mounted, remount them now as described in and re-enter the chroot environment (see ) before continuing. diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml index ca7de3802..2434a6b17 100644 --- a/chapter07/createfiles.xml +++ b/chapter07/createfiles.xml @@ -34,11 +34,11 @@ /var/log/wtmp - Historically, Linux maintains a list of the mounted file systems in the + Historically, Linux maintained a list of the mounted file systems in the file /etc/mtab. Modern kernels maintain this list internally and expose it to the user via the /proc filesystem. To satisfy utilities that - expect the presence of /etc/mtab, create the following + expect to find /etc/mtab, create the following symbolic link: ln -sv /proc/self/mounts /etc/mtab @@ -159,13 +159,13 @@ EOF The created groups are not part of any standard—they are groups decided on in part by the requirements of the Udev configuration in Chapter - 9, and in part by common convention employed by a number of existing Linux + 9, and in part by common conventions employed by a number of existing Linux distributions. In addition, some test suites rely on specific users or groups. The Linux Standard Base (LSB, available at ) only recommends that, besides the group root with a Group ID (GID) of 0, a group bin - with a GID of 1 be present. The GID of 5 is widely used for + with a GID of 1 be present. The GID of 5 is widely used for the tty group, and the number 5 is also used in systemd /etc/fstab for the @@ -179,7 +179,7 @@ EOF or the parent user namespace, but do not exist on the local machine or in the separate namespace). We assign nobody and - nogroup for it to avoid an + nogroup to avoid an unnamed ID. But other distros may treat this ID differently, so any portable program should not depend on this assignment. diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index 3e96bee5e..48826d06c 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -15,13 +15,13 @@ Applications running in user space utilize various file - systems exported by the kernel to communicate + systems created by the kernel to communicate with the kernel itself. These file systems are virtual: no disk - space is used for them. The content of the file systems resides in + space is used for them. The content of these file systems resides in memory. These file systems must be mounted in the $LFS directory tree so the applications can find them in the chroot environment. - Begin by creating directories on which the file systems will be + Begin by creating the directories on which these virtual file systems will be mounted: mkdir -pv $LFS/{dev,proc,sys,run} @@ -29,31 +29,31 @@ Mounting and Populating /dev - During a normal boot of the LFS system, the kernel automatically + During a normal boot of an LFS system, the kernel automatically mounts the devtmpfs - filesystem on the + file system on the /dev directory; the kernel - creates device nodes on that virtual filesystem during the boot process + creates device nodes on that virtual file system during the boot process, or when a device is first detected or accessed. The udev daemon may - change the owner or permission of the device nodes created by the - kernel, or create new device nodes or symlinks to ease the work of - distro maintainers or system administrators. (See + change the ownership or permissions of the device nodes created by the + kernel, and create new device nodes or symlinks, to ease the work of + distro maintainers and system administrators. (See for details.) If the host kernel supports &devtmpfs;, we can simply mount a &devtmpfs; at $LFS/dev and rely - on the kernel to populate it (the LFS building process does not need - the additional work onto &devtmpfs; by udev daemon). + on the kernel to populate it (i.e., the udev daemon will do the + necessary work automatically). - But, some host kernels may lack &devtmpfs; support and these - host distros maintain the content of - /dev with different methods. - So the only host-agnostic way for populating - $LFS/dev is - bind mounting the host system's + But some host kernels lack &devtmpfs; support; these + host distros use different methods to create the content of + /dev. + So the only host-agnostic way to populate the + $LFS/dev directory is + by bind mounting the host system's /dev directory. A bind mount is - a special type of mount that allows you to create a mirror of a + a special type of mount that generates a duplicate copy of a directory or mount point at some other location. Use the following - command to do this: + command to do this. mount -v --bind /dev $LFS/dev @@ -62,7 +62,7 @@ Mounting Virtual Kernel File Systems - Now mount the remaining virtual kernel filesystems: + Now mount the remaining virtual kernel file systems: mount -v --bind /dev/pts $LFS/dev/pts mount -vt proc proc $LFS/proc From 091d624df5c599faef288f4d2c447f167003392a Mon Sep 17 00:00:00 2001 From: David Bryant Date: Thu, 17 Nov 2022 12:08:13 -0600 Subject: [PATCH 07/20] Correct capitalization, spelling, grammar, and idiom. Tighten the prose by removing some circumlocutions. --- chapter08/glibc.xml | 20 ++++++++++---------- chapter08/introduction.xml | 24 ++++++++++++------------ chapter08/pkgmgt.xml | 15 ++++++++------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 0bc9a5dcf..a85559d24 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -43,7 +43,7 @@ Installation of Glibc - First, fix an issue building Glibc with parallel jobs and make-4.4 + First, fix an issue building Glibc with parallel jobs and Make-4.4 or later: sed '/MAKEFLAGS :=/s/)r/) -r/' -i Makerules @@ -82,7 +82,7 @@ cd build --disable-werror - This option disables the -Werror option passed to + This option disables the -werror option passed to GCC. This is necessary for running the test suite. @@ -90,7 +90,7 @@ cd build --enable-kernel=&min-kernel; - This option tells the build system that this glibc may + This option tells the build system that this Glibc may be used with kernels as old as &min-kernel;. This means generating workarounds in case a system call introduced in a later version cannot be used. @@ -217,7 +217,7 @@ esac make install - Fix hardcoded path to the executable loader in + Fix a hardcoded path to the executable loader in the ldd script: sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd @@ -235,9 +235,9 @@ mkdir -pv /var/cache/nscd install -v -Dm644 ../nscd/nscd.service /usr/lib/systemd/system/nscd.service Next, install the locales that can make the system respond in a - different language. None of the locales are required, but if some of them - are missing, the test suites of future packages would skip important - testcases. + different language. None of these locales are required, but if some of them + are missing, the test suites of some packages will skip important + test cases. Individual locales can be installed using the localedef program. E.g., the second @@ -290,7 +290,7 @@ localedef -i zh_TW -f UTF-8 zh_TW.UTF-8 In addition, install the locale for your own country, language and character set. - Alternatively, install all locales listed in the + Alternatively, install all the locales listed in the glibc-&glibc-version;/localedata/SUPPORTED file (it includes every locale listed above and many more) at once with the following time-consuming command: @@ -326,7 +326,7 @@ localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true - Adding nsswitch.conf + Adding Nsswitch.conf The /etc/nsswitch.conf file needs to be created because the Glibc defaults do not work well in a networked environment. @@ -356,7 +356,7 @@ EOF - Adding time zone data + Adding Time Zone Data Install and set up the time zone data with the following: tar -xf ../../tzdata&tzdata-version;.tar.gz diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index b23175b3f..b05a9761a 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -22,17 +22,17 @@ We do not recommend using optimizations. They can make a program run slightly faster, but they may also cause compilation - difficulties and problems when running the program. If a package refuses to + difficulties, and problems when running the program. If a package refuses to compile when using optimization, try to compile it without optimization and see if that fixes the problem. Even if the package does compile when using optimization, there is the risk it may have been compiled incorrectly because - of the complex interactions between the code and build tools. Also note that + of the complex interactions between the code and the build tools. Also note that the and options using values not specified in the book have not been tested. This may cause problems with the toolchain packages (Binutils, GCC and Glibc). The small potential gains - achieved in using compiler optimizations are often outweighed by the risks. + achieved by using compiler optimizations are often outweighed by the risks. First-time builders of LFS are encouraged to build without custom - optimizations. The subsequent system will still run very fast and be stable + optimizations. The resulting system will still run very fast, and be stable at the same time. Before the installation instructions, each installation page provides @@ -42,31 +42,31 @@ instructions, there is a list of programs and libraries (along with brief descriptions) that the package installs. - The SBU values and required disk space includes test suite data + The SBU values and required disk space include test suite data for all applicable packages in . SBU values have been calculated using a single CPU core (-j1) for all operations. - About libraries + About Libraries In general, the LFS editors discourage building and installing static - libraries. The original purpose for most static libraries has been made + libraries. Most static libraries have been made obsolete in a modern Linux system. In addition, linking a static library into a program can be detrimental. If an update to the library is needed - to remove a security problem, all programs that use the static library will - need to be relinked to the new library. Since the use of static libraries + to remove a security problem, every program that uses the static library will + need to be relinked with the new library. Since the use of static libraries is not always obvious, the relevant programs (and the procedures needed to do the linking) may not even be known. - In the procedures in this chapter, we remove or disable installation of + The procedures in this chapter remove or disable installation of most static libraries. Usually this is done by passing a option to configure. In other cases, alternate means are needed. In a few cases, especially - glibc and gcc, the use of static libraries remains essential to the general + Glibc and GCC, the use of static libraries remains an essential feature of the package building process. - For a more complete discussion of libraries, see the discussion + For a more complete discussion of libraries, see Libraries: Static or shared? in the BLFS book. diff --git a/chapter08/pkgmgt.xml b/chapter08/pkgmgt.xml index 60c472ad4..7496f09a4 100644 --- a/chapter08/pkgmgt.xml +++ b/chapter08/pkgmgt.xml @@ -12,10 +12,10 @@ Package Management is an often requested addition to the LFS Book. A Package Manager tracks the installation of files, making it easier to - remove and upgrade packages. As well as the binary and library files, a - package manager will handle the installation of configuration files. Before + remove and upgrade packages. A good package manager will handle the + installation of configuration files, and also install the executable files. Before you begin to wonder, NO—this section will not talk about nor recommend - any particular package manager. What it provides is a roundup of the more + any particular package manager. What it does provide is a roundup of the more popular techniques and how they work. The perfect package manager for you may be among these techniques, or it may be a combination of two or more of these techniques. This section briefly mentions issues that may arise when upgrading @@ -61,8 +61,8 @@ - If Linux API headers or glibc need to be upgraded to a newer - version, (e.g., from glibc-2.31 to glibc-2.32), it is safer to + If the Linux API headers or Glibc need to be upgraded to a newer + version, (e.g., from Glibc-2.31 to Glibc-2.32), it is safer to rebuild LFS. Though you may be able to rebuild all the packages in their dependency order, we do not recommend it. @@ -202,7 +202,7 @@ it is installed in /usr though in reality it is installed in the /usr/pkg hierarchy. Installing in - this manner is not usually a trivial task. For example, consider that you + this manner is not usually a trivial task. For example, suppose you are installing a package libfoo-1.1. The following instructions may not install the package properly: @@ -321,7 +321,8 @@ make DESTDIR=/usr/pkg/libfoo/1.1 install depend on the position of files on a disk system. Cloning an LFS build to another computer with the same architecture as the base system is as simple as using tar on the LFS partition that contains - the root directory (about 250MB uncompressed for a base LFS build), copying + the root directory (about 900MB uncompressed for a basic LFS build), copying + that file via network transfer or CD-ROM / USB stick to the new system, and expanding it. After that, a few configuration files will have to be changed. Configuration files that may need to be updated include: From 27601131e4ee4d960546e966e7f4326102b23d47 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Thu, 17 Nov 2022 16:14:42 -0600 Subject: [PATCH 08/20] Correctd the spelling of "Werror" -- it's "-Werror" in GCC, but it's "--disable-error" in Glibc. Thanks to Thomas Trepl for spotting my mistake. --- chapter08/glibc.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index a85559d24..d121084df 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -70,7 +70,7 @@ cd build Prepare Glibc for compilation: ../configure --prefix=/usr \ - --disable-werror \ + --disable-Werror \ --enable-kernel=&min-kernel; \ --enable-stack-protector=strong \ --with-headers=/usr/include \ @@ -82,7 +82,7 @@ cd build --disable-werror - This option disables the -werror option passed to + This option disables the -Werror option passed to GCC. This is necessary for running the test suite. From 7054cc64eaf9737732a1d63eb5edc9a04af94459 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 12:07:51 +0800 Subject: [PATCH 09/20] glibc: it should be --disable-werror, not --disable-Werror Please try not to use the "replace" feature of the text editor blindly. Appendix C of the GNU C Library Reference Manual clearly says: '--disable-werror' By default, the GNU C Library is built with '-Werror'. If you wish to build without this option (for example, if building with a newer version of GCC than this version of the GNU C Library was tested with, so new warnings cause the build with '-Werror' to fail), you can configure with '--disable-werror'. --- chapter08/glibc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index d121084df..7cf111ef8 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -70,7 +70,7 @@ cd build Prepare Glibc for compilation: ../configure --prefix=/usr \ - --disable-Werror \ + --disable-werror \ --enable-kernel=&min-kernel; \ --enable-stack-protector=strong \ --with-headers=/usr/include \ From f714a8fa3bdd85d28bd9eb49ab0f1f59e39a5054 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 12:35:53 +0800 Subject: [PATCH 10/20] chroot: reword how chroot works Technically chroot command "tells" bash nothing. It basically calls chroot("$LFS"), then chdir("/"), then execve(["/usr/bin/env", "-i", ...]). The kernel also does not tell bash something like "hey, the root is now $LFS" but just executes (almost) all system calls from bash as-if $LFS is /. The man page of chroot says: DESCRIPTION Run COMMAND with root directory set to NEWROOT. Just use the same grammar construction here. --- chapter07/chroot.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chapter07/chroot.xml b/chapter07/chroot.xml index 69bc6ce69..b8de03dc2 100644 --- a/chapter07/chroot.xml +++ b/chapter07/chroot.xml @@ -38,9 +38,10 @@ From this point on, there is no need to use the LFS variable any more because all work will be restricted - to the LFS file system; the chroot command tells the Bash shell that - $LFS is now the root - (/) directory. + to the LFS file system; the chroot command runs the + Bash shell with the root + (/) directory set to + $LFS. Notice that /tools/bin is not in the PATH. This means that the cross toolchain will no longer be From 2f9498afa401af249bb5c2090b3cc393e659ceb0 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 12:52:09 +0800 Subject: [PATCH 11/20] kernfs: remove a false note Things are a little tricky: 1. If the host is "modern" (any desktop distro after 2013), the kernel supports devtmpfs and the host udev will do adjustments to the devtmpfs. All instances of devtmpfs shares the same content so we'll see the work of both the kernel and the host udev in chroot. 2. If the host is old but the kernel supports devtmpfs (i. e. the host is not using devtmpfs for its /dev), when we mount devtmpfs on $LFS/dev we'll see the work of the kernel in chroot, but not the work of udev. **Building LFS does not need any work of udev.** 3. If the host is very old and the kernel does not support devtmpfs at all, we can't mount devtmpfs. Mounting a devtmpfs will work for 1 and 2, while bind mounting will work for 1, 2, and 3. So we use bind mounting here. I don't want to squash all these details into the book, so just remove the false statement here. --- chapter07/kernfs.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index 48826d06c..4ec299708 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -41,8 +41,7 @@ for details.) If the host kernel supports &devtmpfs;, we can simply mount a &devtmpfs; at $LFS/dev and rely - on the kernel to populate it (i.e., the udev daemon will do the - necessary work automatically). + on the kernel to populate it. But some host kernels lack &devtmpfs; support; these host distros use different methods to create the content of From 940769457b0ae75a6a07db10534eafa3175b9018 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 13:13:37 +0800 Subject: [PATCH 12/20] kernfs: reword the description of bind mount "Duplicated copy" is wrong IMO. If you copy A to B, B won't be changed when you modify A. But if you bind mount A to B, B will reflect any change made to A. Again copy something from mount(2): A bind mount makes a file or a directory subtree visible at another point within the single directory hierarchy. --- chapter07/kernfs.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index 4ec299708..1f72fecf2 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -50,8 +50,8 @@ $LFS/dev directory is by bind mounting the host system's /dev directory. A bind mount is - a special type of mount that generates a duplicate copy of a - directory or mount point at some other location. Use the following + a special type of mount that makes a directory subtree or a file + visible at some other location. Use the following command to do this. mount -v --bind /dev $LFS/dev From 1cc301fbb3db368fe1bad436a1a662c303fcc29b Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 13:25:38 +0800 Subject: [PATCH 13/20] glibc: Decapitalize nsswitch.conf In UNIX file names are case-sensitive. You cannot capitialize it even if it appears in a title. --- chapter08/glibc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 7cf111ef8..0295e0aab 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -326,7 +326,7 @@ localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true - Adding Nsswitch.conf + Adding nsswitch.conf The /etc/nsswitch.conf file needs to be created because the Glibc defaults do not work well in a networked environment. From b1c8283fe71b3fe2d4419c3e74012e4b23052700 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 13:57:47 +0800 Subject: [PATCH 14/20] chapter08: reword description of compiler optimizations We don't recommend customizing optimizations, but we use optimizations provided by package default or release build mode. Reword the paragraph so the people won't be puzzled once they see "--enable-optimizations" in Python, or "--buildtype=release" (to prevent unoptimized build) in BLFS meson commands. --- chapter08/introduction.xml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index b05a9761a..2be7fe053 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -20,20 +20,28 @@ work is to know what each package is used for and why you (or the system) may need it. - We do not recommend using optimizations. They can make + We do not recommend using customized optimizations. They can make a program run slightly faster, but they may also cause compilation difficulties, and problems when running the program. If a package refuses to - compile when using optimization, try to compile it without optimization and - see if that fixes the problem. Even if the package does compile when using + compile with a customized optimization, try to compile it without + optimization and see if that fixes the problem. Even if the package does compile when using a customized optimization, there is the risk it may have been compiled incorrectly because of the complex interactions between the code and the build tools. Also note that the and options using values not specified in the book have not been tested. This may cause problems with the toolchain packages (Binutils, GCC and Glibc). The small potential gains - achieved by using compiler optimizations are often outweighed by the risks. + achieved by customizing compiler optimizations are often outweighed by the risks. First-time builders of LFS are encouraged to build without custom - optimizations. The resulting system will still run very fast, and be stable - at the same time. + optimizations. + + On the other hand, we keeps the optimizations enabled by the default + configuration of packages. In addition, we sometimes explicitly enable an + optimized configuration provided by the package but not enabled by + default. The package maintainers have already tested these configurations + and consider them safe, so it's not likely they would break the build. + Generally the default configuration already enables + or , so the resulting system will still run very fast + without any customized optimization, and be stable at the same time. Before the installation instructions, each installation page provides information about the package, including a concise description of what it From f8b186063150f471f9e72f2e317fe21d2d0f1e81 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 14:13:12 +0800 Subject: [PATCH 15/20] pkgmgt: reword the description of cfg files handling Let's not miss the point... --- chapter08/pkgmgt.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chapter08/pkgmgt.xml b/chapter08/pkgmgt.xml index 7496f09a4..d4b616bc7 100644 --- a/chapter08/pkgmgt.xml +++ b/chapter08/pkgmgt.xml @@ -12,8 +12,9 @@ Package Management is an often requested addition to the LFS Book. A Package Manager tracks the installation of files, making it easier to - remove and upgrade packages. A good package manager will handle the - installation of configuration files, and also install the executable files. Before + remove and upgrade packages. A good package manager will also handle the + configuration files specially to keep the user configuration when the + package is reinstalled or upgraded. Before you begin to wonder, NO—this section will not talk about nor recommend any particular package manager. What it does provide is a roundup of the more popular techniques and how they work. The perfect package manager for you may From 7115c88406ec78ea55d5dd576b4c2b4c31556641 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 18 Nov 2022 14:28:29 +0800 Subject: [PATCH 16/20] chapter08: fix minor grammar issues --- chapter08/introduction.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index 2be7fe053..f80ccc0c1 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -34,9 +34,9 @@ First-time builders of LFS are encouraged to build without custom optimizations. - On the other hand, we keeps the optimizations enabled by the default - configuration of packages. In addition, we sometimes explicitly enable an - optimized configuration provided by the package but not enabled by + On the other hand, we keep the optimizations enabled by the default + configuration of the packages. In addition, we sometimes explicitly enable an + optimized configuration provided by a package but not enabled by default. The package maintainers have already tested these configurations and consider them safe, so it's not likely they would break the build. Generally the default configuration already enables From cc197d00cec9859ee8f5ecf4be67ffab35e5f018 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 18 Nov 2022 12:35:53 -0600 Subject: [PATCH 17/20] Corrected a grammatical error: the subordinate clause "that offers ..." modifies the plural noun "libraries"; it must use a plural verb. Clarified how many "configure" options Readline uses. Tightened the prose, and used the definite article in lieu of the indefinite article, because only one readline.pc file can possibly be the "correct" one. --- chapter08/readline.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter08/readline.xml b/chapter08/readline.xml index 51784d2f7..ea073308d 100644 --- a/chapter08/readline.xml +++ b/chapter08/readline.xml @@ -23,7 +23,7 @@ - <para>The Readline package is a set of libraries that offers command-line + <para>The Readline package is a set of libraries that offer command-line editing and history capabilities.</para> <segmentedlist> @@ -61,14 +61,14 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install</userinput></screen> --docdir=/usr/share/doc/readline-&readline-version;</userinput></screen> <variablelist> - <title>The meaning of the configure option: + The meaning of the new configure option: --with-curses This option tells Readline that it can find the termcap - library functions in the curses library, rather than a separate - termcap library. It allows generating a correct + library functions in the curses library, not a separate + termcap library. This will generate the correct readline.pc file. From ea90fca7bf41224e994c8c615b96a76febaeca3a Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 18 Nov 2022 13:14:57 -0600 Subject: [PATCH 18/20] Clarify the description of the -G option. --- chapter08/bc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter08/bc.xml b/chapter08/bc.xml index 4493f8219..4677f06fd 100644 --- a/chapter08/bc.xml +++ b/chapter08/bc.xml @@ -59,7 +59,7 @@ -G Omit parts of the test suite that won't work - without a GNU bc present. + until the bc program has been installed. From d6346a7e9b8354dcf9d8a8ccbc9227574ab34429 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 18 Nov 2022 14:44:18 -0600 Subject: [PATCH 19/20] Rectify a redundancy/explain how to say tcl. Use correct spelling for the Binutils package. Patch up an ungrammatical sentence (the plural subject "instructions" requires pural verbs). --- chapter08/tcl.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chapter08/tcl.xml b/chapter08/tcl.xml index cb13e3224..d1315603f 100644 --- a/chapter08/tcl.xml +++ b/chapter08/tcl.xml @@ -27,7 +27,7 @@ The Tcl package contains the Tool Command Language, a robust general-purpose scripting language. The Expect package - is written in the Tcl language. + is written in Tcl (pronounced "tickle"). &buildtime; @@ -45,7 +45,7 @@ Installation of Tcl This package and the next two (Expect and DejaGNU) are - installed to support running the test suites for binutils and GCC and other + installed to support running the test suites for Binutils, GCC and other packages. Installing three packages for testing purposes may seem excessive, but it is very reassuring, if not essential, to know that the most important tools are working properly. @@ -87,9 +87,9 @@ sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \ unset SRCDIR The various sed instructions after the - make command removes references to the build directory from - the configuration files and replaces them with the install directory. - This is not mandatory for the remainder of LFS, but may be needed in case a + make command remove references to the build directory from + the configuration files and replace them with the install directory. + This is not mandatory for the remainder of LFS, but may be needed if a package built later uses Tcl. To test the results, issue: From 651f491b51ea10fbecca8ef646ee17d353cba7e1 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Fri, 18 Nov 2022 15:43:45 -0600 Subject: [PATCH 20/20] Merrriam-Webster says "alongside" is one word. Clarified some muddled verbiage. Used the subjunctive mood once. "Test suite" is two words, not one. Patched some unidiomatic English. Used the plural "headers" when discussing ELF objects. Used singular verbs to describe "gprofng", for consistency with other items. --- chapter08/binutils.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index c969eab00..28d44a9a0 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -87,7 +87,7 @@ cd build --enable-gold - Build the gold linker and install it as ld.gold (along side the + Build the gold linker and install it as ld.gold (alongside the default linker). @@ -118,7 +118,7 @@ cd build --with-system-zlib - Use the installed zlib library rather than building the + Use the installed zlib library instead of building the included version. @@ -143,7 +143,7 @@ cd build a custom system, this target-specific directory in /usr is not required. $(exec_prefix)/$(target_alias) would be - used if the system was used to cross-compile (for example, compiling a + used if the system were used to cross-compile (for example, compiling a package on an Intel machine that generates code that can be executed on PowerPC machines). @@ -164,7 +164,7 @@ cd build grep '^FAIL:' $(find -name '*.log') - Twelve tests fail in the gold testsuite when the + Twelve tests fail in the gold test suite when the and options are passed to GCC.