diff --git a/appendices/dependencies.xml b/appendices/dependencies.xml index fdd1f0f05..fa20d3688 100644 --- a/appendices/dependencies.xml +++ b/appendices/dependencies.xml @@ -4,8 +4,7 @@ %general-entities; - Systemd - Udev"> + SystemdUdev"> Berkeley DB"> ]> @@ -45,7 +44,7 @@ &dependencies; - Attr, Bash, Binutils, Coreutils, GCC, Gettext, Grep, M4, Make, + Attr, Bash, Binutils, Coreutils, GCC, Gettext, Grep, M4, Make, Perl, Sed, and Texinfo @@ -400,49 +399,6 @@ - - Check - - - &dependencies; - - Gawk, GCC, Grep, Make, Sed, and Texinfo - - - - - &runtime; - - Bash and Gawk - - - - - &testsuites; - - None - - - - - &before; - - None - - - - - &external; - - - libsubunit - and - - patchutils - - - - Coreutils @@ -872,7 +828,7 @@ &before; - Wheel + Packaging and Wheel @@ -1240,7 +1196,7 @@ &testsuites; - No test suite available + None @@ -1276,7 +1232,7 @@ &runtime; - Bash, GCC, Gettext, Glibc, Xz, and Sed. + Bash, GCC, Gettext, Glibc, Xz, and Sed @@ -1545,7 +1501,7 @@ &dependencies; - Bash, Binutils, Bison, Check, Coreutils, Flex, GCC, Gettext, + Bash, Binutils, Bison, Coreutils, Flex, GCC, Gettext, Glibc, Gzip, Make, Patch, and Sed @@ -1642,7 +1598,7 @@ &testsuites; - No test suite available + None @@ -2460,6 +2416,46 @@ + + Packaging + + + &dependencies; + + Flit-core and Python + + + + + &runtime; + + Python + + + + + &testsuites; + + No test suite available + + + + + &before; + + Wheel + + + + + &external; + + + pytest + + + + Patch @@ -2571,9 +2567,10 @@ &before; Binutils, - D-Bus, E2fsprogs, - IProute2, Kmod, Man-DB, Procps-ng, Python, - &systemd-udev;, and Util-linux + D-Bus, + E2fsprogs, IProute2, Kmod, Man-DB, Procps-ng, Python, + &systemd-udev;, + and Util-linux @@ -2650,7 +2647,7 @@ &testsuites; - No test suite available + Expect @@ -3312,7 +3309,7 @@ &dependencies; - Python and Flit-core + Python, Flit-core, and packaging diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 69860723f..1ac0d51b7 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -39,616 +39,201 @@ or as appropriate for the entry or if needed the entire day's listitem. --> - - - 2024-08-23 - - - [xry111] - Update to lfs-bootscripts-20240825. Only trivial - non-functional changes. - - - - - - 2024-08-23 - - - [xry111] - Update to lfs-bootscripts-20240823, to fix an - issue causing VT 2-6 not affected by the FONT= setting in - /etc/sysconfig/console. - - - - - 2024-08-17 + 2025-04-15 - [bdubbs] - Update to setuptools-72.2.0. Fixes - #5542. + [bdubbs] - Update to libcap-2.76. Fixes + #5704. - [bdubbs] - Update to kmod-33. Fixes - #5540. + [bdubbs] - Update to perl-5.40.2 (Security update). Fixes + #5703. - [bdubbs] - Update to binutils-2.43.1. Fixes - #5543. + [bdubbs] - Add packaging-24.2 (Python module). Needed for wheel. + - [bdubbs] - Update to linux-6.10.5. Fixes - #5541. - - - - - - 2024-08-15 - - - [bdubbs] - Update to iana-etc-20240806. Addresses - #5006. + [bdubbs] - Update to xz-5.8.1. Fixes + #5694. - [bdubbs] - Update to pkgconf-2.3.0. Fixes - #5537. + [bdubbs] - Update to wheel-0.46.1 (Python Module). Fixes + #5693. - [bdubbs] - Update to python3-3.12.5. Fixes - #5538. + [bdubbs] - Update to sysklogd-2.7.2. Fixes + #5690. - [bdubbs] - Update to linux-6.10.4. Fixes - #5539. - - - - - - 2024-08-05 - - - [bdubbs] - Update to bash-5.2.32. Fixes - #5532. + [bdubbs] - Update to Python3-3.13.3. Fixes + #5697. - [bdubbs] - Update to iana-etc-20240801. Addresses - #5006. + [bdubbs] - Update to openssl-3.5.0. Fixes + #5701. - [bdubbs] - Update to vim-9.1.0660. Addresses - #4500. + [bdubbs] - Update to meson-1.7.2. Fixes + #5691. - [bdubbs] - Update to binutils-2.43. Fixes - #5535. - - - [bdubbs] - Update to linux-6.10.3. Fixes - #5534. - - - [bdubbs] - Update to readline-8.2.13. Fixes - #5533. - - - [bdubbs] - Update to wheel-0.44.0. Fixes - #5536. - - - - - - 2024-08-01 - - - [bdubbs] - Update to gcc-14.2.0. Fixes - #5530. - - - [bdubbs] - Update to iana-etc-20240723. Addresses - #5006. - - - [bdubbs] - Update to glibc-2.40. Fixes - #5529. - - - [bdubbs] - Update to iproute2-6.10.0. Fixes - #5523. - - - [bdubbs] - Update to linux-6.10.2. Fixes - #5521. - - - [bdubbs] - Update to lz4-1.10.0. Fixes - #5526. - - - [bdubbs] - Update to meson-1.5.1. Fixes - #5527. - - - [bdubbs] - Update to setuptools-72.1.0. Fixes - #5531. + [bdubbs] - Update to linux-6.14.2. Fixes + #5680. - [bdubbs] - Update to sysklogd-2.6.1. Fixes - #5522. + [bdubbs] - Update to libffi-3.4.8. Fixes + #5700. - [bdubbs] - Update to systemd-256.4. Fixes - #5518. + [bdubbs] - Update to iproute2-6.14.0. Fixes + #5682. + + + [bdubbs] - Update to gzip-1.14. Fixes + #5699. + + + [bdubbs] - Update to grep-3.12. Fixes + #5702. + + + [bdubbs] - Update to gperf-3.2.1. Fixes + #5695. + + + [bdubbs] - Update to gawk-5.3.2. Fixes + #5692. + + + [bdubbs] - Update to diffutils-3.12. Fixes + #5696. + + + [bdubbs] - Update to coreutils-9.7. Fixes + #5698. + + + + + + 2025-04-01 + + + [bdubbs] - Update to vim-9.1.1263. Addresses + #4500. + + + [bdubbs] - Update to iana-etc-20250328. Addresses + #5006. + + + [bdubbs] - Update to xz-5.8.0. Fixes + #5684. + + + [bdubbs] - Update to util-linux-2.41. Fixes + #5648. + + + [bdubbs] - Update to tzdata-2025b. Fixes + #5681. - [bdubbs] - Update to sysvinit-3.10. Fixes - #5528. + [bdubbs] - Update to shadow-4.17.4. Fixes + #5678. + + + [bdubbs] - Update to setuptools-78.1.0. Fixes + #5676. + + + [bdubbs] - Update to patch-2.8. Fixes + #5689. + + + [bdubbs] - Update to mpfr-4.2.2. Fixes + #5677. + + + [bdubbs] - Update to kmod-34.2. Fixes + #5688. + + + [bdubbs] - Update to gdbm-1.25. Fixes + #5679. + + + [bdubbs] - Update to flit_core-3.12.0. Fixes + #5683. + + + [bdubbs] - Update to expat-2.7.1. Fixes + #5685. - 2024-07-15 + 2025-03-15 - [bdubbs] - Update to iana-etc-20240701. Addresses - #5006. - - - [bdubbs] - Update to vim-9.1.0580. Addresses + [bdubbs] - Update to vim-9.1.1202. Addresses #4500. - [bdubbs] - Update to automake-1.17. Fixes - #5520. - - - [bdubbs] - Update to gdbm-1.24. Fixes - #5515. - - - [bdubbs] - Update to linux-6.9.9. Fixes - #5517. - - - [bdubbs] - Update to less-661. Fixes - #5513. - - - [bdubbs] - Update to meson-1.5.0. Fixes - #5519. - - - [bdubbs] - Update to setuptools-70.3.0. Fixes - #5514. - - - [bdubbs] - Update to util-linux-2.40.2. Fixes - #5516. - - - - - - 2024-07-01 - - - [bdubbs] - Update lfs-bootscripts to only output - escape sequences to a terminal. - - - - - - 2024-07-01 - - - [bdubbs] - Update to iana-etc-20240612. Addresses + [bdubbs] - Update to iana-etc-20250304. Addresses #5006. - - [bdubbs] - Update to bc-6.7.6. Fixes - #5506. - - - [bdubbs] - Update to man-pages-6.9.1. Fixes - #5507. - - - [bdubbs] - Update to linux-6.9.7. Fixes - #5508. - - [bdubbs] - Update to sysklogd-2.5.2. Fixes - #5509. + [bdubbs] - Update to sysklogd-2.7.1. Fixes + #5668. - [bdubbs] - Update to shadow-4.16.0. Fixes - #5510. + [bdubbs] - Update to setuptools-76.0.0. Fixes + #5665. - [bdubbs] - Update to systemd-256.1. Fixes - #5511. + [bdubbs] - Update to pkgconf-2.4.3. Fixes + #5672. - [bdubbs] - Update to setuptools-70.1.1. Fixes - #5512. + [bdubbs] - Update to man-pages-6.13. Fixes + #5673. + + + [bdubbs] - Update to linux-6.13.7. Fixes + #5664. + + + [bdubbs] - Update to libcap-2.75. Fixes + #5667. + + + [bdubbs] - Update to kmod-34.1. Fixes + #5671. + + + [bdubbs] - Update to jinja2-3.1.6. Fixes + #5670. + + + [bdubbs] - Update to expat-2.7.0. Fixes + #5675. + + + [bdubbs] - Update to dbus-1.16.2. Fixes + #5663. - 2024-06-15 + 2025-03-05 - [bdubbs] - Update to vim-9.1.0478. Addresses - #4500. - - - [bdubbs] - Update to iana-etc-20240607. Addresses - #5006. - - - [bdubbs] - Update to systemd-256. Fixes - #5504. - - - [bdubbs] - Update to python3-3.12.4. Fixes - #5502. - - - [bdubbs] - Update to perl-5.40.0. Fixes - #5503. - - - [bdubbs] - Update to openssl-3.3.1 (Security fix). Fixes - #5500. - - - [bdubbs] - Update to linux-6.9.4. Fixes - #5505. - - - [bdubbs] - Update to findutils-4.10.0. Fixes - #5499. - - - - - - 2024-05-31 - - - [bdubbs] - Update to meson-1.4.1. Fixes - #5498. - - - [bdubbs] - Update to xz-5.6.2. Fixes - #5471. - - - [bdubbs] - Add linux-6.9.x compatibility instructions to - systemd - udev. - Fixes #5496. - - - [bdubbs] - Update to setuptools-70.0.0 (python module). Fixes - #5491. - - - [bdubbs] - Update to ninja-1.12.1. Fixes - #5489. - - - [bdubbs] - Update to man-pages-6.8. Fixes - #5494. - - - [bdubbs] - Update to linux-6.9.3. Fixes - #5491. - - - [bdubbs] - Update to libcap-2.70. Fixes - #5493. - - - [bdubbs] - Update to iproute2-6.9.0. Fixes - #5492. - - - [bdubbs] - Update to e2fsprogs-1.47.1. Fixes - #5495. - - - - - - 2024-05-13 - - - [xry111] - Synchronize coreutils i18n patch from Fedora - to fix a build failure on 32-bit x86 and an alarming compiler - warning on both 32-bit x86 and x86_64 with GCC 14.1 or - later. - - - - - - 2024-05-11 - - - [bdubbs] - Update to vim-9.1.0405. Addresses - #4500. - - - [bdubbs] - Update to util-linux-2.40.1. Fixes - #5482. - - - [bdubbs] - Update to linux-6.8.9. Fixes - #5484. - - - [bdubbs] - Update to jinja2-3.1.4 (Python module). Fixes - #5485. - - - [bdubbs] - Update to iana-etc-20240502. Addresses - #5006. - - - [bdubbs] - Update to gcc-14.1.0. Fixes - #5486. - - - - - - 2024-05-01 - - - [bdubbs] - Add security fix to glibc. Fixes - #5481. - - - [bdubbs] - Update to linux-6.8.8. Fixes - #5480. - - - [bdubbs] - Update to ncurses-6.5. Fixes - #5483. - - - - - - 2024-04-16 - - - [bdubbs] - Make minor change to ifup script output text. - - - - - - 2024-04-15 - - - [bdubbs] - Update to setuptools-69.5.1. Fixes - #5478. - - - [bdubbs] - Update to python3-3.12.3. Fixes - #5476. - - - [bdubbs] - Update to openssl-3.3.0. Fixes - #5475. - - - [bdubbs] - Update to ninja-1.12.0. Fixes - #5477. - - - [bdubbs] - Update to man-db-2.12.1. Fixes - #5474. - - - [bdubbs] - Update to linux-6.8.6. Fixes - #5472. - - - [bdubbs] - Update to iana-etc-20240412. Addresses - #5006. - - - [bdubbs] - Update to vim-9.1.0330. Addresses - #4500. - - - - - - 2024-03-31 - - - [bdubbs] - Update to iana-etc-20240318. Addresses - #5006. - - - [bdubbs] - Update to zstd-1.5.6. Fixes - #5468. - - - [bdubbs] - Update to util-linux-2.40. Fixes - #5430. - - - [bdubbs] - Update to shadow-4.15.1. Fixes - #5465. - - - [bdubbs] - Update to pkgconf-2.2.0. Fixes - #5469. - - - [bdubbs] - Update to linux-6.8.2. Fixes - #5467. - - - [bdubbs] - Update to coreutils-9.5. Fixes - #5470. - - - - - - 2024-03-29 - - - [bdubbs] - Revert to xz-5.4.6 due to upstream - compromise. - - - - - - 2024-03-25 - - - [timtas] - Update to sysvinit-3.09. Fixes - #5466. - - - - - - 2024-03-19 - - - [renodr] - Update to iproute2-6.8.0. Fixes - #5458. - - - [renodr] - Update to man-pages-6.7. Fixes - #5464. - - - [renodr] - Update to Linux-6.8.1. Fixes - #5453. - - - [renodr] - Added LZ4 to the book. Fixes - #5463. - - - - - - 2024-03-15 - - - [bdubbs] - Update to wheel-0.43.0. Fixes - #5459. - - - [bdubbs] - Update to setuptools-69.2.0 (Python module). Fixes - #5462. - - - [bdubbs] - Update to meson-1.4.0. Fixes - #5460. - - - [bdubbs] - Update to expat-2.6.2 (Security fix). Fixes - #5461. - - - [bdubbs] - Update to iana-etc-20240305. Addresses - #5006. - - - [bdubbs] - Update to vim-9.1.0161. Addresses - #4500. - - - [bdubbs] - Update to xz-5.6.1. Fixes - #5457. - - - [bdubbs] - Update to shadow-4.15.0. Fixes - #5456. - - - [bdubbs] - Update to psmisc-23.7. Fixes - #5454. - - - [bdubbs] - Update to kmod-32. Fixes - #5455. - - - [bdubbs] - Update to elfutils-0.191. Fixes - #5451. - - - - - - 2024-03-02 - - - [bdubbs] - Update to iana-etc-20240222. Addresses - #5006. - - - [bdubbs] - Update to vim-9.1.0145. Addresses - #4500. - - - [bdubbs] - Update to xz-5.6.0. Fixes - #5447. - - - [bdubbs] - Update to tcl-8.6.14. Fixes - #5448. - - - [bdubbs] - Update to shadow-4.14.6. Fixes - #5450. - - - [bdubbs] - Update to setuptools-69.1.1. Fixes - #5446. - - - [bdubbs] - Update to linux-6.7.7. Fixes - #5444. - - - [bdubbs] - Update to libffi-3.4.6. Fixes - #5443. - - - [bdubbs] - Update to gettext-0.22.5. Fixes - #5445. - - - [bdubbs] - Update to expat-2.6.1. Fixes - #5449. - - - - - - 2024-03-01 - - - [bdubbs] - LFS-12.1 released. + [bdubbs] - LFS-12.3 released. diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index c807fa15d..d6d646f7b 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -35,42 +35,39 @@ - + + + + - Coreutils-&coreutils-version; - - - - E2fsprogs-&e2fsprogs-version; + + Diffutils-&diffutils-version; + + Expat-&expat-version; @@ -80,48 +77,48 @@ - + - - - GCC-&gcc-version; + Flit-Core-&flit-core-version; + + Gawk-&gawk-version; + + GDBM-&gdbm-version; - + + - - + - + Iana-Etc-&iana-etc-version; @@ -143,18 +140,18 @@ Kmod-&kmod-version; - + Libcap-&libcap-version; - + Libffi-&libffi-version; @@ -164,21 +161,24 @@ + Linux-&linux-version; - + - + Man-pages-&man-pages-version; @@ -191,21 +191,21 @@ - - + + + OpenSSL-&openssl-version; - + Perl-&perl-version; @@ -215,15 +215,15 @@ - + Python-&python-version; - + @@ -236,27 +236,27 @@ Sysklogd-&sysklogd-version; - + + - + - - - Udev from Systemd-&systemd-version; + Util-linux-&util-linux-version; @@ -275,9 +275,9 @@ - + + - Lz4-&lz4-version; + Packaging-&packaging-version; + Removed: + - bash-5.2.21-upstream_fixes-1.patch - - - readline-8.2-upstream_fixes-3.patch - + Check-0.15.2 + diff --git a/chapter02/aboutlfs.xml b/chapter02/aboutlfs.xml index 82c59188a..b065fcfb1 100644 --- a/chapter02/aboutlfs.xml +++ b/chapter02/aboutlfs.xml @@ -8,7 +8,7 @@ - Setting The $LFS Variable + Setting the $LFS Variable and the Umask Throughout this book, the environment variable LFS will be used several times. You should ensure that this variable is always defined @@ -33,8 +33,24 @@ If you don't have much space in the partition holding the directory, you can mount another partition on it. + Now set the file mode creation mask (umask) to + 022 in case the host distro uses a different + default: + +umask 022 + + Setting the umask to 022 ensures that newly created files and + directories are only writable by their owner, but are readable and + searchable (only for directories) by anyone (assuming default modes are + used by the open(2) system + call, new files will end up with permission mode 644 and directories with + mode 755). An overly-permissive default can leave security holes in the + LFS system, and an overly-restrictive default can cause strange issues + building or using the LFS system. + - Do not forget to check that LFS is set whenever + Do not forget to check that LFS is set and the + umask is set to 022 whenever you leave and reenter the current working environment (such as when doing a su to root or another user). Check that the LFS variable is set up @@ -44,29 +60,40 @@ Make sure the output shows the path to your LFS system's build location, which is /mnt/lfs if the - provided example was followed. If the output is incorrect, use the command - given earlier on this page to set $LFS to the correct - directory name. - + provided example was followed. - One way to ensure that the LFS variable is always - set is to edit the .bash_profile file in both your - personal home directory and in /root/.bash_profile and - enter the export command above. In addition, the shell specified in the + Check that the umask is set up properly with: + + umask + + The output may be 0022 or + 022 (the number of leading zeros depends + on the host distro). + + If any output of these two commands is incorrect, use the command + given earlier on this page to set $LFS to the correct + directory name and set umask to 022. + + One way to ensure that the LFS variable and the + umask are always set properly is to edit the + .bash_profile file in both your personal home + directory and in /root/.bash_profile and + enter the export and umask commands + above. In addition, the shell specified in the /etc/passwd file for all users that need the LFS variable must be bash to ensure that the - /root/.bash_profile file is incorporated as a part of + .bash_profile file is incorporated as a part of the login process. Another consideration is the method that is used to log into the host system. If logging in through a graphical display manager, the user's .bash_profile is not normally used when - a virtual terminal is started. In this case, add the export command to + a virtual terminal is started. In this case, add the commands to the .bashrc file for the user and root. In addition, some distributions use an "if" test, and do not run the remaining .bashrc instructions for a non-interactive bash invocation. Be sure to place the - export command ahead of the test for non-interactive use. + commands ahead of the test for non-interactive use. diff --git a/chapter02/mounting.xml b/chapter02/mounting.xml index 4db0f5bfc..244a3196b 100644 --- a/chapter02/mounting.xml +++ b/chapter02/mounting.xml @@ -42,6 +42,15 @@ mount -v -t ext4 /dev/<yyy> $LFS/home<yyy> with the appropriate partition names. + Set the owner and permission mode of the + $LFS directory (i.e. the root + directory in the newly created file system for the LFS system) to + &root; and 755 in case the host distro has been + configured to use a different default for mkfs: + +chown root:root $LFS +chmod 755 $LFS + Ensure that this new partition is not mounted with permissions that are too restrictive (such as the or options). Run the mount command diff --git a/chapter03/introduction.xml b/chapter03/introduction.xml index 05488ecbc..645686311 100644 --- a/chapter03/introduction.xml +++ b/chapter03/introduction.xml @@ -22,8 +22,9 @@ For some packages, the release tarball and the (Git or SVN) repository snapshot tarball for that release may be published with - similar file names. A release tarball contains generated files (for - example, a configure script generated by + similar or even identical file names. But the release tarball may contain + some files which are essential despite not stored in the repository + (for example, a configure script generated by autoconf), in addition to the contents of the corresponding repository snapshot. The book uses release tarballs whenever possible. Using a repository snapshot instead of a release diff --git a/chapter03/packages.xml b/chapter03/packages.xml index d58002ad2..6cdb5e224 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -110,15 +110,6 @@ - - Check (&check-version;) - &check-size;: - - Home page: - Download: - MD5 sum: &check-md5; - - - Coreutils (&coreutils-version;) - &coreutils-size;: @@ -597,6 +588,15 @@ + + Packaging (&packaging-version;) - &packaging-size;: + + Home page: + Download: + MD5 sum: &packaging-md5; + + + Patch (&patch-version;) - &patch-size;: diff --git a/chapter03/patches.xml b/chapter03/patches.xml index ef00fbe5a..dd592f663 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -37,10 +37,10 @@ --> diff --git a/chapter04/aboutsbus.xml b/chapter04/aboutsbus.xml index 2c6f80cbd..7c5739a90 100644 --- a/chapter04/aboutsbus.xml +++ b/chapter04/aboutsbus.xml @@ -36,7 +36,7 @@ to give an estimate of how long it might take to install a package, but the numbers can vary by as much as dozens of minutes in some cases. - On some newer systems, the motherboard is capable of contolling + On some newer systems, the motherboard is capable of controlling the system clock speed. This can be controlled with a command such as powerprofilesctl. This is not available in LFS, but may be available on the host distro. After LFS is complete, it can be diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index 0200338bf..bd4a71b1b 100644 --- a/chapter04/addinguser.xml +++ b/chapter04/addinguser.xml @@ -20,8 +20,8 @@ the installation process. As root, issue the following commands to add the new user: -groupadd lfs -useradd -s /bin/bash -g lfs -m -k /dev/null lfs +groupadd &lfs-groupname; +useradd -s /bin/bash -g &lfs-groupname; -m -k /dev/null &lfs-username; This is what the command line options mean: @@ -74,13 +74,13 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs have a password), you need to set a password for &lfs-user;. Issue the following command as the &root; user to set the password: -passwd lfs +passwd &lfs-username; Grant lfs full access to all the directories under $LFS by making lfs the owner: -chown -v lfs $LFS/{usr{,/*},lib*,boot,var,etc,bin,sbin,tools} +chown -v lfs $LFS/{usr{,/*},lib64,boot,var,etc,tools} In some host systems, the following su command does not complete properly and suspends the login for the &lfs-user; user to the background. @@ -91,7 +91,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs logging in as &lfs-user; on a virtual console, or with the following substitute/switch user command: -su - lfs +su - &lfs-username; The - instructs su to start a login shell as opposed to a non-login shell. diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index 736fa854f..13cae9f0d 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -76,11 +76,8 @@ EOF umask 022 - Setting the user file-creation mask (umask) to 022 ensures that newly - created files and directories are only writable by their owner, but are - readable and executable by anyone (assuming default modes are used by the - open(2) system call, new files - will end up with permission mode 644 and directories with mode 755). + Setting the umask as we've already explained in + diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 6e1db70e8..49291daa3 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -93,7 +93,6 @@ cd build --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=&linux-major-version;.&linux-minor-version; \ - --with-headers=$LFS/usr/include \ --disable-nscd \ libc_cv_slibdir=/usr/lib @@ -120,16 +119,6 @@ cd build - - --with-headers=$LFS/usr/include - - This tells Glibc to compile itself against the headers - recently installed to the $LFS/usr/include directory, so that - it knows exactly what features the kernel has and can optimize - itself accordingly. - - - libc_cv_slibdir=/usr/lib @@ -191,9 +180,9 @@ cd build packages to define the location where the package should be installed. If it is not set, it defaults to the root (/) directory. Here we specify that - the package is installed in $LFS - , which will become the root directory in . + the package is installed in + $LFS, which will become the root directory in @@ -204,32 +193,98 @@ cd build sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd - - At this point, it is imperative to stop and ensure that the basic - functions (compiling and linking) of the new toolchain are working as - expected. To perform a sanity check, run the following commands: + Now that our cross toolchain is in place, it is important to ensure + that compiling and linking will work as expected. We do this by performing + some sanity checks: -echo 'int main(){}' | $LFS_TGT-gcc -xc - -readelf -l a.out | grep ld-linux +echo 'int main(){}' | $LFS_TGT-gcc -x c - -v -Wl,--verbose &> dummy.log +readelf -l a.out | grep ': /lib' - If everything is working correctly, there should be no errors, - and the output of the last command will be of the form: + There should be no errors, + and the output of the last command will be (allowing for + platform-specific differences in the dynamic linker name): [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - Note that for 32-bit machines, the interpreter name will be - /lib/ld-linux.so.2. + Note that this path should not contain + /mnt/lfs (or the value of + the LFS variable if you used a different one). The path is + resolved when the compiled program is executed, and that should only happen + after we enter the chroot environment where the kernel would consider + $LFS as the root directory + (/). - If the output is not as shown above, or there is no output at all, - then something is wrong. Investigate and retrace the steps to find out - where the problem is and correct it. This issue must be resolved before - continuing. + Now make sure that we're set up to use the correct start files: - Once all is well, clean up the test file: +grep -E -o "$LFS/lib.*/S?crt[1in].*succeeded" dummy.log -rm -v a.out + The output of the last command should be: - +/mnt/lfs/lib/../lib/Scrt1.o succeeded +/mnt/lfs/lib/../lib/crti.o succeeded +/mnt/lfs/lib/../lib/crtn.o succeeded + + Verify that the compiler is searching for the correct header + files: + +grep -B3 "^ $LFS/usr/include" dummy.log + + This command should return the following output: + +#include <...> search starts here: + /mnt/lfs/tools/lib/gcc/x86_64-lfs-linux-gnu/&gcc-version;/include + /mnt/lfs/tools/lib/gcc/x86_64-lfs-linux-gnu/&gcc-version;/include-fixed + /mnt/lfs/usr/include + + Again, the directory named after your target triplet may be + different than the above, depending on your system architecture. + + Next, verify that the new linker is being used with the correct search paths: + +grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' + + References to paths that have components with '-linux-gnu' should + be ignored, but otherwise the output of the last command should be: + +SEARCH_DIR("=/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib64") +SEARCH_DIR("=/usr/local/lib64") +SEARCH_DIR("=/lib64") +SEARCH_DIR("=/usr/lib64") +SEARCH_DIR("=/mnt/lfs/tools/x86_64-lfs-linux-gnu/lib") +SEARCH_DIR("=/usr/local/lib") +SEARCH_DIR("=/lib") +SEARCH_DIR("=/usr/lib"); + + A 32-bit system may use a few other directories, but anyway + the important facet here is all the paths should begin with an equal sign + (=), which would be replaced with the sysroot + directory that we've configured for the linker. + + Next make sure that we're using the correct libc: + +grep "/lib.*/libc.so.6 " dummy.log + + The output of the last command should be: + +attempt to open /mnt/lfs/usr/lib/libc.so.6 succeeded + + Make sure GCC is using the correct dynamic linker: + +grep found dummy.log + + The output of the last command should be (allowing for + platform-specific differences in dynamic linker name): + +found ld-linux-x86-64.so.2 at /mnt/lfs/usr/lib/ld-linux-x86-64.so.2 + + If the output does not appear as shown above or is not received + at all, then something is seriously wrong. Investigate and retrace the + steps to find out where the problem is and correct it. Any + issues should be resolved before continuing with the process. + + Once everything is working correctly, clean up the test files: + +rm -v a.out dummy.log Building the packages in the next chapter will serve as an additional check that the toolchain has been built properly. If some diff --git a/chapter06/bash.xml b/chapter06/bash.xml index 66c6ef3fc..54fa6f444 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -48,8 +48,7 @@ ./configure --prefix=/usr \ --build=$(sh support/config.guess) \ --host=$LFS_TGT \ - --without-bash-malloc \ - bash_cv_strtold_broken=no + --without-bash-malloc The meaning of the configure options: diff --git a/chapter06/binutils-pass2.xml b/chapter06/binutils-pass2.xml index fb54becb0..a1892a1aa 100644 --- a/chapter06/binutils-pass2.xml +++ b/chapter06/binutils-pass2.xml @@ -55,7 +55,7 @@ produced binaries mistakenly linked against libraries from the host distro. Work around this issue: -sed '6009s/$add_dir//' -i ltmain.sh +sed '6031s/$add_dir//' -i ltmain.sh Create a separate build directory again: diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml index 92951604d..404fe9b66 100644 --- a/chapter06/diffutils.xml +++ b/chapter06/diffutils.xml @@ -47,8 +47,36 @@ ./configure --prefix=/usr \ --host=$LFS_TGT \ + gl_cv_func_strcasecmp_works=y \ --build=$(./build-aux/config.guess) + + The meaning of the configure options: + + + + gl_cv_func_strcasecmp_works=y + + This option specify the result of a check for the + strcasecmp. The check requires running a + compiled C program, and this is impossible during + cross-compilation because in general a cross-compiled program + cannot run on the host distro. Normally for such a check the + configure script would use a fall-back value + for cross-compilation, but the fall-back value for this check is + absent and the configure script would have no + value to use and error out. The upstream has already fixed the + issue, but to apply the fix we'd need to run + autoconf that the host distro may lack. So + we just specify the check result (y as we know + the strcasecmp function in + Glibc-&glibc-version; works fine) instead, then + configure will just use the specified value and + skip the check. + + + + Compile the package: make diff --git a/chapter06/make.xml b/chapter06/make.xml index eaf0db48f..3d3ca9b38 100644 --- a/chapter06/make.xml +++ b/chapter06/make.xml @@ -45,23 +45,9 @@ Prepare Make for compilation: ./configure --prefix=/usr \ - --without-guile \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) - - The meaning of the new configure option: - - - --without-guile - - Although we are cross-compiling, configure tries to use - guile from the build host if it finds it. This makes compilation - fail, so this switch prevents using it. - - - - Compile the package: make diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 29d406b57..2d2baf7dc 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -43,16 +43,12 @@ Installation of Ncurses - First, ensure that gawk is found first during configuration: - -sed -i s/mawk// configure - - Then, run the following commands to build the tic + First, run the following commands to build the tic program on the build host: mkdir build pushd build - ../configure + ../configure AWK=gawk make -C include make -C progs tic popd @@ -69,7 +65,8 @@ popd --with-cxx-shared \ --without-debug \ --without-ada \ - --disable-stripping + --disable-stripping \ + AWK=gawk The meaning of the new configure options: @@ -131,21 +128,17 @@ popd Using host tools on cross-compiled programs can cause failure. - versions of mawk can + cause this package to fail to build. ---> Compile the package: diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml index 16c052b39..178c7836e 100644 --- a/chapter07/changingowner.xml +++ b/chapter07/changingowner.xml @@ -33,9 +33,9 @@ user root by running the following command: -chown --from lfs -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} +chown --from &lfs-username; -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} case $(uname -m) in - x86_64) chown --from lfs -R root:root $LFS/lib64 ;; + x86_64) chown --from &lfs-username; -R root:root $LFS/lib64 ;; esac diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml index 856ef0dbe..8f97c2d3e 100644 --- a/chapter07/createfiles.xml +++ b/chapter07/createfiles.xml @@ -180,11 +180,11 @@ EOF nogroup to avoid an unnamed ID. But other distros may treat this ID differently, so any portable program should not depend on this assignment. - + Some tests in need a regular user. We add this user here and delete this account at the end of that chapter. diff --git a/chapter08/acl.xml b/chapter08/acl.xml index adef493f1..63892d68e 100644 --- a/chapter08/acl.xml +++ b/chapter08/acl.xml @@ -53,10 +53,13 @@ make The Acl tests must be run on a filesystem that supports access - controls, but not until the Coreutils package has been built, - using the Acl libraries. If desired, return to this package - and run make check after the Coreutils - package has been built. + controls. To test the results, issue: + +make check + + One test named test/cp.test is known to + fail because Coreutils is not built with + the Acl support yet. Install the package: diff --git a/chapter08/bash.xml b/chapter08/bash.xml index 09c65662d..bb27e9e45 100644 --- a/chapter08/bash.xml +++ b/chapter08/bash.xml @@ -45,7 +45,6 @@ ./configure --prefix=/usr \ --without-bash-malloc \ --with-installed-readline \ - bash_cv_strtold_broken=no \ --docdir=/usr/share/doc/bash-&bash-version; diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index 629c698c3..5ea6c1b41 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -51,7 +51,6 @@ cd build ../configure --prefix=/usr \ --sysconfdir=/etc \ - --enable-gold \ --enable-ld=default \ --enable-plugins \ --enable-shared \ @@ -64,14 +63,6 @@ cd build The meaning of the new configure parameters: - - --enable-gold - - Build the gold linker and install it as ld.gold (alongside the - default linker). - - - --enable-ld=default @@ -136,19 +127,14 @@ cd build grep '^FAIL:' $(find -name '*.log') - Twelve tests fail in the gold test suite when the - and - options are passed to GCC. - - - Install the package: make tooldir=/usr install - Remove useless static libraries: + Remove useless static libraries and other files: -rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,gprofng,opcodes,sframe}.a +rm -rfv /usr/lib/lib{bfd,ctf,ctf-nobfd,gprofng,opcodes,sframe}.a \ + /usr/share/doc/gprofng/ @@ -161,7 +147,7 @@ cd build Installed directory - addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, ld.gold, nm, + addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, nm, objcopy, objdump, ranlib, readelf, size, strings, and strip libbfd.so, libctf.so, libctf-nobfd.so, libgprofng.so, libopcodes.so, and libsframe.so @@ -271,17 +257,6 @@ cd build - - ld.gold - - A cut down version of ld that only supports the - elf object file format - - ld.gold - - - - ld.bfd diff --git a/chapter08/bison.xml b/chapter08/bison.xml index f466c76eb..a680a7b7e 100644 --- a/chapter08/bison.xml +++ b/chapter08/bison.xml @@ -48,7 +48,7 @@ make - To test the results (about 5.5 SBU), issue: + To test the results, issue: make check diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index 43bb6404a..bd8571903 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -60,17 +60,17 @@ - + + - diff --git a/chapter08/check.xml b/chapter08/check.xml deleted file mode 100644 index 1000aaa68..000000000 --- a/chapter08/check.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - %general-entities; -]> - - - - - - check - &check-version; -
&check-url;
-
- - Check-&check-version; - - - Check - - - - - - <para>Check is a unit testing framework for C.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&check-fin-sbu;</seg> - <seg>&check-fin-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Check - - Prepare Check for compilation: - -./configure --prefix=/usr --disable-static - - Build the package: - -make - - Compilation is now complete. To run the Check test suite, issue the - following command: - -make check - - - Install the package: - - make docdir=/usr/share/doc/check-&check-version; install - - - - - Contents of Check - - - Installed program - Installed library - - - checkmk - libcheck.so - - - - - Short Descriptions - - - - - checkmk - - Awk script for generating C unit tests for use with the Check - unit testing framework - - checkmk - - - - - - libcheck.so - - Contains functions that allow Check to be called from a test - program - - libcheck - - - - - - - - -
diff --git a/chapter08/coreutils.xml b/chapter08/coreutils.xml index f2030685d..7d0541b26 100644 --- a/chapter08/coreutils.xml +++ b/chapter08/coreutils.xml @@ -55,20 +55,35 @@ Now prepare Coreutils for compilation: -autoreconf -fiv +autoreconf -fv +automake -af FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime - The meaning of the configure options: + The meaning of the commands and configure options: - autoreconf + autoreconf -fv The patch for internationalization has modified the build system, so the configuration files must - be regenerated. + be regenerated. Normally we would use the + -i option to update the standard + auxiliary files, but for this package it does not work because + configure.ac specified an old gettext + version. + + + + + automake -af + + The automake auxiliary files were not updated by + autoreconf due to the missing + -i option. This command updates them + to prevent a build failure. @@ -139,12 +154,6 @@ FORCE_UNSAFE_CONFIGURE=1 ./configure \ groupdel dummy - - Two tests, tests/cp/preserve-mode.sh and - tests/mv/acl.sh, are known to - fail in the chroot environment, but pass in a complete system. - - Install the package: make install diff --git a/chapter08/dbus.xml b/chapter08/dbus.xml index 36d5c55ca..086b30b93 100644 --- a/chapter08/dbus.xml +++ b/chapter08/dbus.xml @@ -48,41 +48,21 @@ Prepare D-Bus for compilation: -./configure --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --runstatedir=/run \ - --enable-user-session \ - --disable-static \ - --disable-doxygen-docs \ - --disable-xml-docs \ - --docdir=/usr/share/doc/dbus-&dbus-version; \ - --with-system-socket=/run/dbus/system_bus_socket +mkdir build +cd build + +meson setup --prefix=/usr --buildtype=release --wrap-mode=nofallback .. - The meaning of the configure options: + The meaning of the meson options: - --runstatedir=/run and - --with-system-socket=/run/dbus/system_bus_socket + --wrap-mode=nofallback - These cause the PID file and the system bus socket - to be in /run, instead of - the deprecated /var/run. - - - - - - --enable-user-session - - - This ensures the D-Bus per-user service and socket unit - files are installed for Systemd. They are not useful (but - harmless) in a base LFS installation, however they can be used - once systemd is rebuilt with PAM support in BLFS. + This switch prevents meson from attempting to download a copy + of the Glib package for the tests. @@ -90,11 +70,11 @@ Compile the package: -make +ninja To test the results, issue: -make check +ninja test Many tests are disabled because they require additional packages that are not included in LFS. Instructions for running the @@ -103,7 +83,7 @@ Install the package: -make install +ninja install Create a symlink so that D-Bus and systemd can use the same machine-id file: @@ -149,7 +129,7 @@ dbus-daemon - Is the D-Bus message bus daemon + is the D-Bus message bus daemon dbus-daemon @@ -159,7 +139,7 @@ dbus-launch - Starts dbus-daemon from a shell + starts dbus-daemon from a shell script dbus-launch @@ -170,7 +150,7 @@ dbus-monitor - Monitors messages passing through a D-Bus message bus + monitors messages passing through a D-Bus message bus dbus-monitor @@ -180,7 +160,7 @@ dbus-run-session - Starts a session bus instance of dbus-daemon + starts a session bus instance of dbus-daemon from a shell script and starts a specified program in that session @@ -192,7 +172,7 @@ dbus-send - Sends a message to a D-Bus message bus + sends a message to a D-Bus message bus dbus-send @@ -202,7 +182,7 @@ dbus-test-tool - Is a tool to help packages test + is a tool to help packages test D-Bus dbus-test-tool @@ -214,7 +194,7 @@ dbus-update-activation-environment - Updates environment variables that will be set for + updates environment variables that will be set for D-Bus session services dbus-update-activation-environment diff --git a/chapter08/e2fsprogs.xml b/chapter08/e2fsprogs.xml index c5718c191..6f93dc99e 100644 --- a/chapter08/e2fsprogs.xml +++ b/chapter08/e2fsprogs.xml @@ -93,9 +93,12 @@ cd build make check - + One test named m_assume_storage_prezeroed - is known to fail. + is known to fail. Another test named m_rootdir_acl + is known to fail if the file system used for the LFS system is not + ext4. + The tsan tests are known to fail on some host distros. - For g++, 21 tests (out of approximately 250,000): 14 - AddressSanitizer* - tests and 7 interception-malloc-test-1.C tests, are - known to fail. - - Additionally, several tests in the - vect directory are known to fail - if the hardware does not support AVX. ---> A few unexpected failures cannot always be avoided. In some cases test failures depend on the specific hardware of the system. @@ -233,8 +222,7 @@ su tester -c "PATH=$PATH make -k check" that compiling and linking will work as expected. We do this by performing some sanity checks: -echo 'int main(){}' > dummy.c -cc dummy.c -v -Wl,--verbose &> dummy.log +echo 'int main(){}' | cc -x c - -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' There should be no errors, @@ -329,7 +317,7 @@ SEARCH_DIR("/usr/lib"); Once everything is working correctly, clean up the test files: -rm -v dummy.c a.out dummy.log +rm -v a.out dummy.log Finally, move a misplaced file: diff --git a/chapter08/gettext.xml b/chapter08/gettext.xml index f26d15536..b0b4c89e9 100644 --- a/chapter08/gettext.xml +++ b/chapter08/gettext.xml @@ -42,7 +42,15 @@ Installation of Gettext + Prepare Gettext for compilation: ./configure --prefix=/usr \ @@ -69,8 +77,7 @@
--> - To test the results (this takes a long time, around 3 SBUs), - issue: + To test the results, issue: make check diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 8037f37a7..24133c40a 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -153,7 +153,7 @@ esac You may see some test failures. The Glibc test suite is somewhat dependent on the host system. A few failures out of - over 5000 tests can generally be ignored. This is a list of the + over 6000 tests can generally be ignored. This is a list of the most common issues seen for recent versions of LFS: @@ -313,6 +313,19 @@ install -vm755 dest/usr/lib/*.so.* /usr/lib the locales. Once they are finished, reboot the system immediately. + + + When the system has successfully rebooted, if you are running + a LFS system prior to 12.0 (exclusive) where GCC was not built + with the --disable-fixincludes option, + move two GCC headers into a better location and + remove the stale fixed copies of the Glibc headers: + + + DIR=$(dirname $(gcc -print-libgcc-file-name)) +[ -e $DIR/include/limits.h ] || mv $DIR/include{-fixed,}/limits.h +[ -e $DIR/include/syslimits.h ] || mv $DIR/include{-fixed,}/syslimits.h +rm -rfv $(dirname $(gcc -print-libgcc-file-name))/include-fixed/* Install the package: @@ -376,7 +389,6 @@ localedef -i it_IT -f ISO-8859-1 it_IT localedef -i it_IT -f ISO-8859-15 it_IT@euro localedef -i it_IT -f UTF-8 it_IT.UTF-8 localedef -i ja_JP -f EUC-JP ja_JP -localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true localedef -i ja_JP -f UTF-8 ja_JP.UTF-8 localedef -i nl_NL@euro -f ISO-8859-15 nl_NL@euro localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R @@ -398,15 +410,6 @@ localedef -i zh_TW -f UTF-8 zh_TW.UTF-8 make localedata/install-locales - Then use the localedef command to create and - install locales not listed in the - glibc-&glibc-version;/localedata/SUPPORTED file - when you need them. For instance, the following two locales are - needed for some tests later in this chapter: - -localedef -i C -f UTF-8 C.UTF-8 -localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true - Glibc now uses libidn2 when resolving internationalized domain names. This is a run time dependency. If this capability is needed, the instructions for installing libidn2 are in the @@ -492,7 +495,7 @@ done cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO zic -d $ZONEINFO -p America/New_York -unset ZONEINFO +unset ZONEINFO tz The meaning of the zic commands: diff --git a/chapter08/gperf.xml b/chapter08/gperf.xml index bbfbbe735..25939135a 100644 --- a/chapter08/gperf.xml +++ b/chapter08/gperf.xml @@ -48,11 +48,9 @@ make - The tests are known to fail if running multiple - simultaneous tests (-j option greater than 1). To test - the results, issue: + To test the results, issue: -make -j1 check +make check Install the package: diff --git a/chapter08/grub.xml b/chapter08/grub.xml index a2dbbaf41..b301d4f5a 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -105,7 +105,8 @@ the tests depend on packages that are not available in the limited LFS environment. To run the tests anyway, run make check. - Install the package: + Install the package, and move the Bash completion support file to + the location recommended by the Bash completion maintainers: make install mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions @@ -176,7 +177,7 @@ mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions grub-fstest - Is a tool to debug the filesystem driver + Is a tool to debug the file system driver grub-fstest diff --git a/chapter08/inetutils.xml b/chapter08/inetutils.xml index 693c08405..5b4f32b78 100644 --- a/chapter08/inetutils.xml +++ b/chapter08/inetutils.xml @@ -40,7 +40,7 @@ Installation of Inetutils - First, make the package build with gcc-14.1 or later:: + First, make the package build with gcc-14.1 or later: sed -i 's/def HAVE_TERMCAP_TGETENT/ 1/' telnet/telnet.c diff --git a/chapter08/iproute2.xml b/chapter08/iproute2.xml index 8a6755f3d..bcf08858b 100644 --- a/chapter08/iproute2.xml +++ b/chapter08/iproute2.xml @@ -77,8 +77,7 @@ rm -fv man/man8/arpd.8 If desired, install the documentation: -mkdir -pv /usr/share/doc/iproute2-&iproute2-version; -cp -v COPYING README* /usr/share/doc/iproute2-&iproute2-version; +install -vDm644 COPYING README* -t /usr/share/doc/iproute2-&iproute2-version; @@ -278,7 +277,7 @@ cp -v COPYING README* /usr/share/doc/iproute2-&iproute2-version; tc class allows users to set up classes based - on the queuing discipline scheduling + on the queueing discipline scheduling tc filter allows users to set up the QoS/CoS packet filtering diff --git a/chapter08/jinja2.xml b/chapter08/jinja2.xml index c06da9139..0ddbf5ef5 100644 --- a/chapter08/jinja2.xml +++ b/chapter08/jinja2.xml @@ -42,11 +42,11 @@ Build the package: -pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD +pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD Install the package: -pip3 install --no-index --no-user --find-links dist Jinja2 +pip3 install --no-index --find-links dist Jinja2 diff --git a/chapter08/kmod.xml b/chapter08/kmod.xml index 5b4ab4fb3..0041199f5 100644 --- a/chapter08/kmod.xml +++ b/chapter08/kmod.xml @@ -43,41 +43,19 @@ Prepare Kmod for compilation: -./configure --prefix=/usr \ - --sysconfdir=/etc \ - --with-openssl \ - --with-xz \ - --with-zstd \ - --with-zlib \ - --disable-manpages + mkdir -p build +cd build + +meson setup --prefix=/usr .. \ + --buildtype=release \ + -D manpages=false The meaning of the configure options: - --with-openssl - - - This option enables Kmod to handle PKCS7 signatures for - kernel modules. - - - - - - --with-xz, - --with-zlib, and - --with-zstd - - - These options enable Kmod to handle compressed kernel modules. - - - - - - --disable-manpages + -D manpages=false This option disables generating the man pages which @@ -89,25 +67,15 @@ Compile the package: -make +ninja The test suite of this package requires raw kernel headers (not the sanitized kernel headers installed earlier), which are beyond the scope of LFS. - Install the package and recreate some symlinks for - compatibility with Module-Init-Tools (the package that previously handled - Linux kernel modules). The building system will create all these - symlinks in /usr/bin, but we - only want lsmod there and all other symlinks in - /usr/sbin instead: + Now install the package: -make install - -for target in depmod insmod modinfo modprobe rmmod; do - ln -sfv ../bin/kmod /usr/sbin/$target - rm -fv /usr/bin/$target -done +ninja install diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml index 40af81288..f15d08b07 100644 --- a/chapter08/libffi.xml +++ b/chapter08/libffi.xml @@ -51,11 +51,14 @@ Like GMP, Libffi builds with optimizations specific to the processor in use. If building for another system, change the value of the --with-gcc-arch= parameter in the - following command to an architecture name fully implemented by the + following command to an architecture name fully implemented by + both the host CPU and the CPU on that system. If this is not done, all applications that link to libffi will trigger - Illegal Operation Errors. + Illegal Operation Errors. If you cannot figure out a value + safe for both the CPUs, replace the parameter with + to produce a generic library. Prepare Libffi for compilation: diff --git a/chapter08/libtool.xml b/chapter08/libtool.xml index cb550b5d6..872495afd 100644 --- a/chapter08/libtool.xml +++ b/chapter08/libtool.xml @@ -50,15 +50,9 @@ make -To test the results, issue: +To test the results, issue: -make -k check - - Five tests are known to fail in the LFS build environment due - to a circular dependency, but these tests pass if rechecked after - automake has been installed. Additionally, with grep-3.8 or newer, - two tests will trigger a warning for non-POSIX regular expressions and - fail. +make check Install the package: diff --git a/chapter08/man-pages.xml b/chapter08/man-pages.xml index 54029fd2d..6c196c202 100644 --- a/chapter08/man-pages.xml +++ b/chapter08/man-pages.xml @@ -48,7 +48,32 @@ Install Man-pages by running: -make prefix=/usr install +make -R GIT=false prefix=/usr install + + + The meaning of the options: + + + + -R + + This prevents make from setting any + built-in variables. The building system of man-pages does not + work well with built-in variables, but currently there is no way + to disable them except passing -R + explicitly via the command line. + + + + + GIT=false + + This prevents the building system from emitting many + git: command not found + warnings lines. + + + diff --git a/chapter08/markupsafe.xml b/chapter08/markupsafe.xml index 685b7b520..232cb317b 100644 --- a/chapter08/markupsafe.xml +++ b/chapter08/markupsafe.xml @@ -48,7 +48,7 @@ Install the package: -pip3 install --no-index --no-user --find-links dist Markupsafe +pip3 install --no-index --find-links dist Markupsafe diff --git a/chapter08/ninja.xml b/chapter08/ninja.xml index 5bccea1ea..6850d06a0 100644 --- a/chapter08/ninja.xml +++ b/chapter08/ninja.xml @@ -67,7 +67,7 @@ Build Ninja with: -python3 configure.py --bootstrap +python3 configure.py --bootstrap --verbose The meaning of the build option: @@ -80,10 +80,20 @@
+ + --verbose + + This parameter makes configure.py show + the progress building Ninja. + + + The package tests cannot run in the chroot environment. They require - cmake. + cmake. But the basic + function of this package is already tested by rebuilding itself + (with the --bootstrap option) anyway. This version of Perl builds the Compress::Raw::Zlib and Compress::Raw::BZip2 modules. By default Perl will use an internal copy of the sources for the build. @@ -109,7 +104,7 @@ export BUILD_BZIP2=0 make - To test the results (approximately 11 SBU), issue: + To test the results, issue: TEST_JOBS=$(nproc) make test_harness diff --git a/chapter08/pkgmgt.xml b/chapter08/pkgmgt.xml index 10ec5d199..3640b519d 100644 --- a/chapter08/pkgmgt.xml +++ b/chapter08/pkgmgt.xml @@ -69,10 +69,25 @@
If a package containing a shared library is updated, and - if the name of the library changes, then any packages dynamically + if the name of the libraryThe name of a shared library is + the string coded in the DT_SONAME entry of its + ELF dynamic section. You can get it with the + readelf -d <library file> + | grep SONAME command. In most cases it's suffixed with + .so.<a version + number>, but there are some cases where + it contains multiple numbers for versioning (like + libbz2.so.1.0), contains the version number + before the .so suffix (like + libbfd-&binutils-version;), or does not contain + any version number at all (for example + libmemusage.so). + Generally there is no correlation between the package version and the + version number(s) in the library name. + changes, then any packages dynamically linked to the library must be recompiled, to link against the - newer library. (Note that there is no correlation between the package - version and the name of the library.) For example, consider a package + newer library. + For example, consider a package foo-1.2.3 that installs a shared library with the name libfoo.so.1. Suppose you upgrade the package to a newer version foo-1.2.4 that installs a shared library with the name @@ -370,11 +385,13 @@ make DESTDIR=/usr/pkg/libfoo/1.1 install differences in system hardware and the original kernel configuration. - There have been some reports of issues when copying between - similar but not identical architectures. For instance, the instruction set - for an Intel system is not identical with the AMD processor's instructions, and later - versions of some processors may provide instructions that are unavailable with - earlier versions. + If you want to deploy the LFS system onto a system + with a different CPU, when you build and + you must follow the notes about + overriding the architecture-specific optimization to produce libraries + suitable for both the host system and the system(s) where you'll deploy + the LFS system. Otherwise you'll get Illegal + Instruction errors running LFS. Finally, the new system has to be made bootable via . diff --git a/chapter08/procps.xml b/chapter08/procps.xml index 8a4716ade..eb7d277dc 100644 --- a/chapter08/procps.xml +++ b/chapter08/procps.xml @@ -45,12 +45,14 @@ ./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ --disable-static \ - --disable-kill + --disable-kill \ + --enable-watch8bit ./configure --prefix=/usr \ --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ --disable-static \ --disable-kill \ + --enable-watch8bit \ --with-systemd @@ -63,12 +65,20 @@ command; it will be installed from the Util-linux package. + + + --enable-watch8bit + + This switch enables the ncursesw support for the + watch command, so it can handle 8-bit + characters. + + Compile the package: -make -make src_w_LDADD='$(LDADD) -lsystemd' +make so don't do that + in the .bashrc file or anywhere else. + sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD YESCRYPT:' \ -e 's:/var/spool/mail:/var/mail:' \ -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \ -i etc/login.defs - - If you chose to build Shadow with Cracklib support, issue this command: - -sed -i 's:DICTPATH.*:DICTPATH\t/lib/cracklib/pw_dict:' etc/login.defs - One test named systemd:core / test-namespace is known to fail in the LFS chroot environment. Some other tests may - fail because they depend on various kernel configuration options. + fail because they depend on various kernel configuration options. + The test named systemd:test / test-copy may time out + due to an I/O congestion with a large parallel job number, but it + would pass if running alone with + meson test test-copy. Install the package: diff --git a/chapter08/tcl.xml b/chapter08/tcl.xml index bfb23c3a8..0905af0d4 100644 --- a/chapter08/tcl.xml +++ b/chapter08/tcl.xml @@ -3,8 +3,8 @@ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ %general-entities; - - + + ]> diff --git a/chapter08/udev.xml b/chapter08/udev.xml index b3c318a0b..1be726094 100644 --- a/chapter08/udev.xml +++ b/chapter08/udev.xml @@ -48,17 +48,19 @@ sgx, from the default udev rules: - sed -i -e 's/GROUP="render"/GROUP="video"/' \ - -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in + sed -e 's/GROUP="render"/GROUP="video"/' \ + -e 's/GROUP="sgx", //' \ + -i rules.d/50-udev-default.rules.in Remove one udev rule requiring a full Systemd installation: - sed '/systemd-sysctl/s/^/#/' -i rules.d/99-systemd.rules.in + sed -i '/systemd-sysctl/s/^/#/' rules.d/99-systemd.rules.in Adjust the hardcoded paths to network configuration files for the standalone udev installation: - sed '/NETWORK_DIRS/s/systemd/udev/' -i src/basic/path-lookup.h + sed -e '/NETWORK_DIRS/s/systemd/udev/' \ + -i src/libsystemd/sd-network/network-util.h Prepare Udev for compilation: diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml index 648b204b5..8ea9132b9 100644 --- a/chapter08/util-linux.xml +++ b/chapter08/util-linux.xml @@ -128,6 +128,11 @@ su tester -c "make -k check" enabled. + + Two other tests, lsfd: SOURCE column and utmp: last, are known to + fail in the chroot environment. + + Install the package: make install diff --git a/chapter08/vim.xml b/chapter08/vim.xml index 2ed5cf238..90d07972a 100644 --- a/chapter08/vim.xml +++ b/chapter08/vim.xml @@ -64,9 +64,11 @@ To prepare the tests, ensure that user tester can write - to the source tree: + to the source tree and exclude one file containing tests requiring + curl or wget: -chown -R tester . +chown -R tester . +sed '/test_plugin_glvs/d' -i src/testdir/Make_all.mak Now run the tests as user tester: diff --git a/chapter08/wheel.xml b/chapter08/wheel.xml index 605cda1be..41798157b 100644 --- a/chapter08/wheel.xml +++ b/chapter08/wheel.xml @@ -46,7 +46,7 @@ Install Wheel with the following command: -pip3 install --no-index --find-links=dist wheel +pip3 install --no-index --find-links dist wheel diff --git a/chapter09/network.xml b/chapter09/network.xml index a443ada2c..4c6caafc5 100644 --- a/chapter09/network.xml +++ b/chapter09/network.xml @@ -198,7 +198,7 @@ EOF x can be any number in the range 16-31. y can be any number in the range 0-255. - A valid private IP address could be 192.168.1.1. + A valid private IP address could be 192.168.1.2. If the computer is to be visible to the Internet, a valid FQDN can be the domain name itself, or a string resulted by concatenating a @@ -218,7 +218,7 @@ EOF 127.0.0.1 localhost.localdomain localhost 127.0.1.1 <FQDN> <HOSTNAME> -<192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...] +<192.168.1.2> <FQDN> <HOSTNAME> [alias1] [alias2 ...] ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters @@ -226,7 +226,7 @@ ff02::2 ip6-allrouters # End /etc/hosts EOF - The <192.168.1.1>, + The <192.168.1.2>, <FQDN>, and <HOSTNAME> values need to be changed for specific uses or requirements (if assigned an IP address by a diff --git a/chapter10/fstab.xml b/chapter10/fstab.xml index b98e9822c..e277bd8b4 100644 --- a/chapter10/fstab.xml +++ b/chapter10/fstab.xml @@ -104,6 +104,8 @@ EOF Default iocharset for FAT (). There is no way to specify these settings for the ntfs filesystem at kernel compilation time. + diff --git a/chapter10/grub.xml b/chapter10/grub.xml index bd6bcabbf..807097c62 100644 --- a/chapter10/grub.xml +++ b/chapter10/grub.xml @@ -120,6 +120,7 @@ set timeout=5 insmod part_gpt insmod ext2 set root=(hd0,2) +set gfxpayload=1024x768x32 menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { linux /vmlinuz-&linux-version;-lfs-&version; root=/dev/sda3 ro @@ -144,6 +145,14 @@ EOF be needed with some rare configurations. + + The set gfxpayload=1024x768x32 command sets the + resolution and color depth of the VESA framebuffer to be passed to the + kernel. It's necessary for the kernel SimpleDRM driver to use the + VESA framebuffer. You can use a different resolution or color depth + value which better suits for your monitor. + + From GRUB's perspective, the kernel files are relative to the partition used. If you used a separate /boot partition, remove /boot from the above diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index 71dc04a2a..344a25eda 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -272,6 +272,71 @@
+ + + + Display a user-friendly message when a kernel panic occurs + + + + This will make the kernel correctly display the message + in case a kernel panic happens and a running DRM driver + supports to do so. Without this, it would be more + difficult to diagnose a panic: if no DRM driver is running, + we'd be on the VGA console which can only hold 24 lines and + the relevant kernel message is often flushed away; if a DRM + driver is running, the display is often completely messed up + on panic. As of Linux-6.12, none of the dedicated drivers for + mainstream GPU models really supports this, but it's supported by + the Simple framebuffer driver which runs on the + VESA (or EFI) framebuffer before the dedicated GPU driver is + loaded. If the dedicated GPU driver is built as a module + (instead of a part of the kernel image) and no initramfs is + used, this functionality will work just fine before the root + file system is mounted and it's already enough for providing + information about most LFS configuration errors causing a + panic (for example, an incorrect root= + setting in ). + + + + + + + Panic screen formatter + + + + Set this kmsg to make sure the last + kernel messages lines are displayed when a kernel panic happens. + The default, user, would make the kernel show + only a user friendly panic message which is not + helpful on diagnostic. The third choice, + qr_code, would make the kernel to compress + the last kernel message lines into a QR code and display it. + The QR code can hold more message lines than plain text and it + can be decoded with an external device (like a smart phone). + But it requires a Rust compiler that LFS does not provide. + + + + + + + Mark VGA/VBE/EFI FB as generic system framebuffer + and + Simple framebuffer driver + + + These allow to use the VESA framebuffer (or the EFI + framebuffer if booting the LFS system via UEFI) as a DRM device. + The VESA framebuffer will be set up by GRUB (or the EFI + framebuffer will be set up by the UEFI firmware), so the DRM panic + handler can function before the GPU-specific DRM driver is + loaded. + + + @@ -282,8 +347,8 @@ These are needed to display the Linux console on a GPU driven by a DRI (Direct Rendering Infrastructure) driver. - If (Direct Rendering Manager) is - enabled, you should enable these two options as well or you'll see + As (Direct Rendering Manager) is + enabled, we should enable these two options as well or we'll see a blank screen once the DRI driver is loaded. @@ -399,6 +464,26 @@ chown -R 0:0 on the linux-&linux-version; directory to ensure all files are owned by user root. + + If you are updating the configuration and rebuilding the kernel + from a retained kernel source tree, normally you should + not run the + make mrproper command. The command would purge + the .config file and all the + .o files from the previous + build. Despite it's easy to restore .config from + the copy in /boot, purging all + the .o files is still a waste: + for a simple configuration change, often only a few + .o files need to be (re)built + and the kernel build system will correctly skip other + .o files if they are not + purged. + + On the other hand, if you've upgraded GCC, you should run + make clean to purge all the + .o files from the previous + build, or the new build may fail. @@ -410,17 +495,6 @@ complete. - - The headers in the system's include directory (/usr/include) should - always be the ones against which Glibc was compiled, - that is, the sanitised headers installed in . Therefore, they should - never be replaced by either the raw kernel headers - or any other kernel sanitized headers. - - diff --git a/chapter10/kernel/kernel.version b/chapter10/kernel/kernel.version index 22cb9e553..d7d9d3fbd 100644 --- a/chapter10/kernel/kernel.version +++ b/chapter10/kernel/kernel.version @@ -1 +1 @@ -6.10.2 +6.13.1 diff --git a/chapter10/kernel/systemd.toml b/chapter10/kernel/systemd.toml index bfe7a1b40..387a74b66 100644 --- a/chapter10/kernel/systemd.toml +++ b/chapter10/kernel/systemd.toml @@ -13,7 +13,13 @@ STACKPROTECTOR_STRONG='*' UEVENT_HELPER=' ' DEVTMPFS='*' DEVTMPFS_MOUNT='*' -DRM=' *M' +SYSFB_SIMPLEFB='*' +DRM='*' +DRM_PANIC='*' +DRM_PANIC_SCREEN='kmsg' +DRM_FBDEV_EMULATION='*' +DRM_SIMPLEDRM='*' +FRAMEBUFFER_CONSOLE='*' NET='*' INET='*' IPV6='*' @@ -30,11 +36,3 @@ revision='systemd' [RT_GROUP_SCHED] value = ' ' comment = 'This may cause some systemd features malfunction' - -[DRM_FBDEV_EMULATION] -value = ' *' -comment = 'If [DRM] is selected as * or M, this must be selected' - -[FRAMEBUFFER_CONSOLE] -value = ' *' -comment = 'If [DRM] is selected as * or M, this must be selected' diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml index a03c67402..d143f0578 100644 --- a/chapter10/kernel/systemd.xml +++ b/chapter10/kernel/systemd.xml @@ -42,15 +42,19 @@ ... [FW_LOADER_USER_HELPER] Firmware Drivers ---> [*] Export DMI identification via sysfs to userspace [DMIID] + [*] Mark VGA/VBE/EFI FB as generic system framebuffer [SYSFB_SIMPLEFB] Graphics support ---> - < /*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> + <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> ... [DRM] - # If [DRM] is selected as * or M, this must be selected: - [ /*] Enable legacy fbdev support for your modesetting driver + [*] Display a user-friendly message when a kernel panic occurs + ... [DRM_PANIC] + (kmsg) Panic screen formatter [DRM_PANIC_SCREEN] + Supported DRM clients ---> + [*] Enable legacy fbdev support for your modesetting driver ... [DRM_FBDEV_EMULATION] + <*> Simple framebuffer driver [DRM_SIMPLEDRM] Console display driver support ---> - # If [DRM] is selected as * or M, this must be selected: - [ /*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] + [*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] File systems ---> [*] Inotify support for userspace [INOTIFY_USER] diff --git a/chapter10/kernel/sysv.toml b/chapter10/kernel/sysv.toml index 3f8d2e93c..c8267a303 100644 --- a/chapter10/kernel/sysv.toml +++ b/chapter10/kernel/sysv.toml @@ -12,14 +12,12 @@ STACKPROTECTOR_STRONG='*' UEVENT_HELPER=' ' DEVTMPFS='*' DEVTMPFS_MOUNT='*' -DRM=' *M' +SYSFB_SIMPLEFB='*' +DRM='*' +DRM_PANIC='*' +DRM_PANIC_SCREEN='kmsg' +DRM_FBDEV_EMULATION='*' +DRM_SIMPLEDRM='*' +FRAMEBUFFER_CONSOLE='*' revision='sysv' - -[DRM_FBDEV_EMULATION] -value = ' *' -comment = 'If [DRM] is selected as * or M, this must be selected' - -[FRAMEBUFFER_CONSOLE] -value = ' *' -comment = 'If [DRM] is selected as * or M, this must be selected' diff --git a/chapter10/kernel/sysv.xml b/chapter10/kernel/sysv.xml index 451898a21..759c3aa49 100644 --- a/chapter10/kernel/sysv.xml +++ b/chapter10/kernel/sysv.xml @@ -28,12 +28,17 @@ [*] Maintain a devtmpfs filesystem to mount at /dev [DEVTMPFS] [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs ... [DEVTMPFS_MOUNT] + Firmware Drivers ---> + [*] Mark VGA/VBE/EFI FB as generic system framebuffer [SYSFB_SIMPLEFB] Graphics support ---> - < /*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> + <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> ... [DRM] - # If [DRM] is selected as * or M, this must be selected: - [ /*] Enable legacy fbdev support for your modesetting driver + [*] Display a user-friendly message when a kernel panic occurs + ... [DRM_PANIC] + (kmsg) Panic screen formatter [DRM_PANIC_SCREEN] + Supported DRM clients ---> + [*] Enable legacy fbdev support for your modesetting driver ... [DRM_FBDEV_EMULATION] + <*> Simple framebuffer driver [DRM_SIMPLEDRM] Console display driver support ---> - # If [DRM] is selected as * or M, this must be selected: - [ /*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] + [*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] diff --git a/chapter11/afterlfs.xml b/chapter11/afterlfs.xml index 541ad9b5f..8c75fb0e2 100644 --- a/chapter11/afterlfs.xml +++ b/chapter11/afterlfs.xml @@ -54,7 +54,7 @@ In addition to the above, there is a set of applications for system management for all kinds of systems. These applications are all in the - BLFS book. Not all packages are needed in every environments. For + BLFS book. Not all packages are needed in every environment. For example dhcpcd, is not normally appropriate for a server and wireless_tools, diff --git a/chapter11/theend.xml b/chapter11/theend.xml index 2b5ef95f1..994cba8c3 100644 --- a/chapter11/theend.xml +++ b/chapter11/theend.xml @@ -59,6 +59,7 @@ ID=lfs PRETTY_NAME="Linux From Scratch &version;" VERSION_CODENAME="<your name here>" HOME_URL="&lfs-root;lfs/" +RELEASE_TYPE="&os-release-type;" EOF Be sure to customize the fields 'DISTRIB_CODENAME' and diff --git a/gen-changelog.py b/gen-changelog.py index 3bf6bc064..473554045 100755 --- a/gen-changelog.py +++ b/gen-changelog.py @@ -62,7 +62,7 @@ rem = rem.symmetric_difference(upd) ticket = {} security = set() -url = 'https://wiki.linuxfromscratch.org/lfs/report/1?format=tab' +url = 'https://wiki.linuxfromscratch.org/lfs/query?status=!closed&order=priority&format=tab' tsv = urlopen(url) for i in tsv: fields = i.decode().split('\t') diff --git a/general.ent b/general.ent index cad537e5b..27b62c37f 100644 --- a/general.ent +++ b/general.ent @@ -7,9 +7,9 @@ - - - + + + @@ -34,6 +34,7 @@ &patches-root;, &donwloads-root;, and &test-results; --> + ]]> - + ]]> + ]]> + ]]> - - + + - + + - + - + - - - - + + + + - + @@ -172,14 +164,14 @@ - - + + - + - + - + @@ -189,7 +181,7 @@ - + @@ -200,22 +192,22 @@ - - + + - + - + - - + + - + - + @@ -223,10 +215,10 @@ - + - + @@ -234,35 +226,35 @@ - + - - + + - + - - + + - + - - - - + + + + - - + + - + - - - + + + @@ -273,18 +265,18 @@ - - + + - + - - + + - + @@ -296,7 +288,7 @@ - + @@ -309,28 +301,28 @@ - - + + - + - - + + - + - - + + - + @@ -343,44 +335,44 @@ - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + @@ -393,54 +385,54 @@ - - + + - + - + - - + + - + - - + + - + - + - - + + - + - - + + - - + + - + - - + + - + - + - - - + + + - + - - - - + + + + - - + + @@ -645,54 +645,54 @@ - - + + - + - + - - + + - + - + - - + + - + - + - + - + - + - - + + - - - + + + - - + + - + - + @@ -703,63 +703,62 @@ - + - + - + - + - - + + - + - - + + - + - + - + - - + + - + - - - + + - - - + + + - + - + - + - + - + - + - - + + - - + + - + - + @@ -794,12 +793,12 @@ - - + + - + - + @@ -816,11 +815,11 @@ - - + + - + - + diff --git a/part3intro/toolchaintechnotes.xml b/part3intro/toolchaintechnotes.xml index 3714596fc..2239b2c7a 100644 --- a/part3intro/toolchaintechnotes.xml +++ b/part3intro/toolchaintechnotes.xml @@ -3,6 +3,9 @@ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ %general-entities; + + <the host triplet>"> ]> @@ -44,6 +47,14 @@ book for a cross-toolchain for some purpose other than building LFS, unless you really understand what you are doing. + + + It's known installing GCC pass 2 will break the cross-toolchain. + We don't consider it a bug because GCC pass 2 is the last package + to be cross-compiled in the book, and we won't fix + it until we really need to cross-compile some package after GCC + pass 2 in the future. + Cross-compilation involves some concepts that deserve a section of @@ -197,14 +208,105 @@ page. - In order to fake a cross-compilation in LFS, the name of the host triplet - is slightly adjusted by changing the "vendor" field in the - LFS_TGT variable so it says "lfs". We also use the - --with-sysroot option when building the cross-linker and - cross-compiler, to tell them where to find the needed host files. This - ensures that none of the other programs built in can link to libraries on the build - machine. Only two stages are mandatory, plus one more for tests. + + There are two key points for a cross-compilation: + + + + + + When producing and processing the machine code supposed to be + executed on the host, the cross-toolchain must be + used. Note that the native toolchain from the build + may be still invoked to generate machine code supposed to be + executed on the build. For example, the build system + may compile a generator with the native toolchain, then generate + a C source file with the generator, and finally compile the C + source file with the cross-toolchain so the generated code will + be able to run on the host. + + + With an autoconf-based build system, this requirement is ensured + by using the --host switch to specify + the host triplet. With this switch the build + system will use the toolchain components prefixed + with &host-triplet; + for generating and processing the machine code for + the host; e.g. the compiler will be + &host-triplet;-gcc and the + readelf tool will be + &host-triplet;-readelf. + + + + + The build system should not attempt to run any generated machine + code supposed to be executed on the host. For + example, when building a utility natively, its man page can be + generated by running the utility with the + --help switch and processing the output, + but generally it's not possible to do so for a cross-compilation + as the utility may fail + to run on the build: it's obviously impossible to + run ARM64 machine code on a x86 CPU (without an emulator). + + + With an autoconf-based build system, this requirement is + satisfied in the cross-compilation mode where + the optional features requiring to run machine code for + the host during the build time are disabled. When the + host triplet is explicitly specified, the + cross-compilation mode is enabled if and only if either + the configure script fails to run a dummy + program compiled into the host machine code, or + the build triplet is explicitly specified via the + --build switch and it's different from + the host triplet. + + + + + In order to cross-compile a package for the LFS temporary system, + the name of the system triplet is slightly adjusted by changing the + "vendor" field in the LFS_TGT variable so it + says "lfs" and LFS_TGT is then specified as + the host triplet via --host, so + the cross-toolchain will be used for generating and processing the + machine code running as a part of the LFS temporary system. And, we + also need to enable the cross-compilation mode: despite + the host machine code, i.e. the machine code for the LFS + temporary system, is able to execute on the current CPU, it may refer + to a library not available on the the build (the host + distro), or some code or data non-exist or defined differently in the + library even if it happens to be available. When cross-compiling a + package for the LFS temporary system, we cannot rely on the + configure script to detect this issue with the + dummy program: the dummy only uses a few components in + libc that the host distro + libc likely provides (unless, + maybe the host distro uses a different + libc implementation like Musl), + so it won't fail like how the really useful programs would likely. + Thus we must explicitly specify the build triplet to + enable the cross-compilation mode. The value we use is + just the default, i.e. the original system triplet from + config.guess output, but the cross-compilation + mode depends on an explicit specification as we've + discussed. + + We use the --with-sysroot option when + building the cross-linker and cross-compiler, to tell them where to find + the needed files for the host. This nearly ensures that + none of the other programs built in + can link to libraries on + the build. The word nearly is used because + libtool, a compatibility wrapper of + the compiler and the linker for autoconf-based build systems, + can try to be too clever and mistakenly pass options allowing the linker + to find libraries of the build. + To prevent this fallout, we need to delete the libtool archive + (.la) files and fix up an + outdated libtool copy shipped with the Binutils code. @@ -228,7 +330,7 @@ 3lfslfslfs - Rebuild and test cc-lfs using cc-lfs on lfs. + Rebuild (and maybe test) cc-lfs using cc-lfs on lfs. @@ -256,30 +358,11 @@ The upshot of the preceding paragraph is that cc1 is unable to build a fully functional libstdc++ with the degraded libgcc, but cc1 is the only compiler available for building the C/C++ libraries - during stage 2. There are two reasons we don't immediately use the - compiler built in stage 2, cc-lfs, to build those libraries. - - - - - Generally speaking, cc-lfs cannot run on pc (the host system). Even though the - triplets for pc and lfs are compatible with each other, an executable - for lfs must depend on glibc-&glibc-version;; the host distro - may utilize either a different implementation of libc (for example, musl), or - a previous release of glibc (for example, glibc-2.13). - - - - - Even if cc-lfs can run on pc, using it on pc would create - a risk of linking to the pc libraries, since cc-lfs is a native - compiler. - - - - - So when we build gcc stage 2, we instruct the building system to - rebuild libgcc and libstdc++ with cc1, but we link libstdc++ to the newly + during stage 2. As we've discussed, we cannot run cc-lfs on pc (the + host distro) because it may require some library, code, or data not + available on the build (the host distro). + So when we build gcc stage 2, we override the library + search path to link libstdc++ against the newly rebuilt libgcc instead of the old, degraded build. This makes the rebuilt libstdc++ fully functional. @@ -290,12 +373,11 @@ package on a completed LFS system, the reinstalled content of the package should be the same as the content of the same package when first installed in &ch-final;. The temporary packages installed in &ch-tmp-cross; or - &ch-tmp-chroot; cannot satisfy this requirement, because some of them - are built without optional dependencies, and autoconf cannot - perform some feature checks in &ch-tmp-cross; because of cross-compilation, - causing the temporary packages to lack optional features, - or use suboptimal code routines. Additionally, a minor reason for - rebuilding the packages is to run the test suites. + &ch-tmp-chroot; cannot satisfy this requirement, because some optional + features of them are disabled because of either the missing + dependencies or the cross-compilation mode. + Additionally, a minor reason for rebuilding the packages is to run the + test suites. @@ -357,39 +439,25 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld - Next comes glibc. The most important - considerations for building glibc are the compiler, binary tools, and - kernel headers. The compiler and binary tools are generally not an issue - since glibc will always those relating to the --host - parameter passed to its configure script; e.g., in our case, the compiler - will be $LFS_TGT-gcc and the readelf - tool will be $LFS_TGT-readelf. The kernel headers can - be a bit more complicated. Therefore, we take no risks and use - the available configure switch to enforce the correct selection. After - the run of configure, check the contents of the - config.make file in the build directory for all important details. - These items highlight an important aspect of the glibc - package—it is very self-sufficient in terms of its build machinery, - and generally does not rely on toolchain defaults. + Next comes glibc. This is the first package that we cross-compile. + We use the --host=$LFS_TGT option to make + the build system to use those tools prefixed with + $LFS_TGT-, and the + --build=$(../scripts/config.guess) option to + enable the cross-compilation mode as we've discussed. + The DESTDIR variable is used to force installation into + the LFS file system. As mentioned above, the standard C++ library is compiled next, followed in by other programs that must be cross-compiled to break circular dependencies at build time. - The install step of all those packages uses the - DESTDIR variable to force installation - in the LFS filesystem. + The steps for those packages are similar to the steps for glibc. At the end of the native LFS compiler is installed. First binutils-pass2 is built, in the same DESTDIR directory as the other programs, then the second pass of gcc is constructed, omitting some - non-critical libraries. Due to some weird logic in gcc's - configure script, CC_FOR_TARGET ends up as - cc when the host is the same as the target, but - different from the build system. This is why - CC_FOR_TARGET=$LFS_TGT-gcc is declared explicitly - as one of the configuration options. + non-critical libraries. Upon entering the chroot environment in , diff --git a/patches.ent b/patches.ent index fbb773577..c7b2ab19b 100644 --- a/patches.ent +++ b/patches.ent @@ -7,13 +7,18 @@ --> + - - - + + + @@ -36,7 +41,7 @@ --> - + - + unchanged. Note that the priority attribute is not strictly + required, because the original template is less restrictive in + matching, so has less precedence. But in case the docbook dev + add a match="sect1" template in their chunk-code.xsl, then it will + be necessary!--> + diff --git a/stylesheets/lfs-xsl/pdf/lfs-mixed.xsl b/stylesheets/lfs-xsl/pdf/lfs-mixed.xsl index 834b7057c..8f5576d9f 100644 --- a/stylesheets/lfs-xsl/pdf/lfs-mixed.xsl +++ b/stylesheets/lfs-xsl/pdf/lfs-mixed.xsl @@ -80,6 +80,16 @@ + + + + + + + + + + diff --git a/stylesheets/lfs-xsl/xhtml/lfs-sections.xsl b/stylesheets/lfs-xsl/xhtml/lfs-sections.xsl index b13e5e11b..0ecfaa4f6 100644 --- a/stylesheets/lfs-xsl/xhtml/lfs-sections.xsl +++ b/stylesheets/lfs-xsl/xhtml/lfs-sections.xsl @@ -166,7 +166,7 @@ - +