From 91aeb6f36d52d44f44032985b3917221b7b78590 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 23 Jul 2023 09:52:50 +0800 Subject: [PATCH 01/34] whatsnew: Add revision attribute for "Removed" entries --- chapter01/whatsnew.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index bd3843566..42d10c0aa 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -345,7 +345,7 @@ Removed: - + eudev-3.2.12 @@ -353,7 +353,7 @@ Pkg-config-0.29.2 - + systemd-252-security_fix-1.patch From fb3b88e8f288563f26096ecf5eb6d2ad749ae5e5 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 25 Jul 2023 12:33:32 +0800 Subject: [PATCH 02/34] binutils-pass2: Remove libsframe.{a,la} like other libs --- chapter06/binutils-pass2.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter06/binutils-pass2.xml b/chapter06/binutils-pass2.xml index ef5c18433..7b0f1fc20 100644 --- a/chapter06/binutils-pass2.xml +++ b/chapter06/binutils-pass2.xml @@ -101,7 +101,7 @@ cd build Remove the libtool archive files because they are harmful for cross compilation, and remove unnecessary static libraries: -rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la} +rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la} From b15bebf96f9df4260904cb682c1692bcc43891c2 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 27 Jul 2023 09:43:35 +0800 Subject: [PATCH 03/34] askforhelp: Add a note to stop people from spamming upstream I've seen two cases of invalid upstream "bug" reports this month because the user has (mis)built LFS. Let's stop this before irritating the upstream maintainers. --- chapter01/askforhelp.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/chapter01/askforhelp.xml b/chapter01/askforhelp.xml index 367e880c0..405b40804 100644 --- a/chapter01/askforhelp.xml +++ b/chapter01/askforhelp.xml @@ -10,6 +10,27 @@ Help + + + We strongly discourage posting your issues building one LFS package + directly onto the upstream support channel, without discussing via + a LFS support channel listed in + first. Doing so is often quite inefficient because the upstream + maintainers are rarely familiar with LFS building procedure. Even if + you've really hit an upstream issue, the LFS community can still help + to isolate the information wanted by the upstream maintainers and make + a proper report. + + + + If you must ask a question directly via an upstream support channel, + you shall at least note that many upstream projects have the support + channels separated from the bug tracker. The bug + reports for asking questions are considered invalid and may annoy + upstream developers for these projects. + + + If an issue or a question is encountered while working through this book, please check the FAQ page at . Questions are often already answered there. If your question is not From 49d402ee78cc17fab3501b544a83dca826f7a91d Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 27 Jul 2023 10:03:30 +0800 Subject: [PATCH 04/34] askforhelp: Reword the note added in previous commit a little --- chapter01/askforhelp.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chapter01/askforhelp.xml b/chapter01/askforhelp.xml index 405b40804..5eb1d939f 100644 --- a/chapter01/askforhelp.xml +++ b/chapter01/askforhelp.xml @@ -12,10 +12,11 @@ - We strongly discourage posting your issues building one LFS package - directly onto the upstream support channel, without discussing via - a LFS support channel listed in - first. Doing so is often quite inefficient because the upstream + In case you've hit an issue building one package with the LFS + instruction, we strongly discourage posting the issue directly onto + the upstream support channel before discussing via a LFS support + channel listed in . + Doing so is often quite inefficient because the upstream maintainers are rarely familiar with LFS building procedure. Even if you've really hit an upstream issue, the LFS community can still help to isolate the information wanted by the upstream maintainers and make From d0de26cbe0bf877b25219936b7b688f0b17d0a16 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 27 Jul 2023 13:06:49 +0800 Subject: [PATCH 05/34] gmp: (Optionally) use --host=none-linux-gnu for generic library This is suggested by GCC maintainer Andrew Pinski in https://gcc.gnu.org/PR110789. It's easier than what we've suggested in the book. --- chapter08/gmp.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chapter08/gmp.xml b/chapter08/gmp.xml index 0820f726c..01dace92f 100644 --- a/chapter08/gmp.xml +++ b/chapter08/gmp.xml @@ -54,10 +54,12 @@ The default settings of GMP produce libraries optimized for the host processor. If libraries suitable for processors less capable than the host's CPU are desired, generic libraries can be - created by running the following: + created by appending the option + to the configure command. -cp -v configfsf.guess config.guess -cp -v configfsf.sub config.sub + Prepare GMP for compilation: @@ -106,7 +108,7 @@ make html the system capabilities and there will be errors in the tests or other applications using the gmp libraries with the message "Illegal instruction". In this case, gmp should be reconfigured with the option - --build=x86_64-pc-linux-gnu and rebuilt. + and rebuilt. Ensure that all 197 tests in the test suite passed. Check the results by issuing the following command: From 44674e4c92f7ef20dbc985f479c5c19548378a08 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 28 Jul 2023 19:59:01 +0800 Subject: [PATCH 06/34] sysv: Mount cgroup fs for memory pressure information early Prepare for systemd-254 update. See #5293 for details. --- bootscripts/ChangeLog | 3 +++ bootscripts/lfs/init.d/mountvirtfs | 4 ++++ chapter01/changelog.xml | 13 +++++++++++++ chapter10/fstab.xml | 21 +++++++++++---------- chapter10/kernel.xml | 5 +++++ packages.ent | 2 +- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index d255411b1..aff30cb41 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,3 +1,6 @@ +2023-07-28 Xi Ruoyao + * In mountvirtfs, mount /sys/fs/cgroup for udev from systemd-254. + 2023-07-22 Xi Ruoyao * In mountvirtfs, create symlinks /dev/{fd,std{in,out,err}} and /dev/core (optional). diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs index bbf30cf90..fd797787a 100644 --- a/bootscripts/lfs/init.d/mountvirtfs +++ b/bootscripts/lfs/init.d/mountvirtfs @@ -63,6 +63,10 @@ case "${1}" in log_info_msg2 " ${INFO}/dev/shm" mount -o nosuid,nodev /dev/shm || failed=1 + mkdir -p /sys/fs/cgroup + log_info_msg2 " ${INFO}/sys/fs/cgroup" + mount -o nosuid,noexec,nodev /sys/fs/cgroup || failed=1 + (exit ${failed}) evaluate_retval if [ "${failed}" = 1 ]; then diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index cfb845733..73fc65f72 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,19 @@ appropriate for the entry or if needed the entire day's listitem. --> + + 2023-07-28 + + + [xry111] - Enable cgroup-based memory pressure information + in kernel, and add the cgroup file system into /etc/fstab and the + mountvirtfs bootscript. This is a preparation for udev from + systemd-254. Addresses + #5293. + + + + 2023-07-22 diff --git a/chapter10/fstab.xml b/chapter10/fstab.xml index f78b234db..ccf767ab6 100644 --- a/chapter10/fstab.xml +++ b/chapter10/fstab.xml @@ -22,17 +22,18 @@ cat > /etc/fstab << "EOF" # Begin /etc/fstab -# file system mount-point type options dump fsck -# order +# file system mount-point type options dump fsck +# order -/dev/<xxx> / <fff> defaults 1 1 -/dev/<yyy> swap swap pri=1 0 0 -proc /proc proc nosuid,noexec,nodev 0 0 -sysfs /sys sysfs nosuid,noexec,nodev 0 0 -devpts /dev/pts devpts gid=5,mode=620 0 0 -tmpfs /run tmpfs defaults 0 0 -devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 -tmpfs /dev/shm tmpfs nosuid,nodev 0 0 +/dev/<xxx> / <fff> defaults 1 1 +/dev/<yyy> swap swap pri=1 0 0 +proc /proc proc nosuid,noexec,nodev 0 0 +sysfs /sys sysfs nosuid,noexec,nodev 0 0 +devpts /dev/pts devpts gid=5,mode=620 0 0 +tmpfs /run tmpfs defaults 0 0 +devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 +tmpfs /dev/shm tmpfs nosuid,nodev 0 0 +cgroup2 /sys/fs/cgroup cgroup2 nosuid,noexec,nodev 0 0 # End /etc/fstab EOF diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index ad6b252a7..376f6cdff 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -135,7 +135,12 @@ [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] General setup ---> [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] + CPU/Task time and stats accounting ---> + [*] Pressure stall information tracking [CONFIG_PSI] + [ ] Require boot parameter to enable pressure stall information tracking [CONFIG_PSI_DEFAULT_DISABLED] < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] + [*] Control Group support [CONFIG_CGROUPS] ---> + [*] Memory controller [CONFIG_MEMCG] [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] General architecture-dependent options ---> [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] diff --git a/packages.ent b/packages.ent index 6fd5c0280..09008604d 100644 --- a/packages.ent +++ b/packages.ent @@ -383,7 +383,7 @@ - + From ac90ea8104148900ca3209cf5a56c4a16cbafd77 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 28 Jul 2023 20:01:29 +0800 Subject: [PATCH 07/34] package choices: Fix a typo Reported-by: rhubarbpieguy --- prologue/why.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prologue/why.xml b/prologue/why.xml index b43bb3a20..b5ac050eb 100644 --- a/prologue/why.xml +++ b/prologue/why.xml @@ -371,7 +371,7 @@ libcrypt library needed by various packages (notably, Shadow) for hashing passwords. It replaces the obsolete - libcrypt implmentation in + libcrypt implementation in Glibc. From 6de383a26215753a2b0a6d2dba6956ecfd786a90 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Fri, 28 Jul 2023 19:23:11 -0500 Subject: [PATCH 08/34] Package updates. Update udev-lfs tarball to remove obsolete cdrom rules and references to ISDN devices. Update to wheel-0.41.0 (Python Module). Update to tar-1.35. Update to systemd-254. Update to meson-1.2.0. Update to linux-6.4.7. Update to gcc-13.2.0. Update to file-5.45. --- chapter01/changelog.xml | 39 +++++++++++++++++++++++ chapter01/whatsnew.xml | 14 ++++----- chapter08/gcc.xml | 4 +-- chapter08/udev.xml | 4 +-- packages.ent | 54 ++++++++++++++++---------------- udev-lfs/55-lfs.rules | 6 ---- udev-lfs/55-lfs.txt | 11 ++----- udev-lfs/81-cdrom.rules | 3 -- udev-lfs/83-cdrom-symlinks.rules | 13 -------- udev-lfs/ChangeLog | 4 +++ udev-lfs/Makefile.lfs | 9 +++--- udev-lfs/README | 2 -- 12 files changed, 88 insertions(+), 75 deletions(-) delete mode 100644 udev-lfs/81-cdrom.rules delete mode 100644 udev-lfs/83-cdrom-symlinks.rules diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 73fc65f72..d5debd345 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,45 @@ appropriate for the entry or if needed the entire day's listitem. --> + + 2023-07-28 + + + [bdubbs] - Update udev-lfs tarball to remove obsolete + cdrom rules and references to ISDN devices. Fixes + #5291. + + + [bdubbs] - Update to wheel-0.41.0 (Python Module). Fixes + #5290. + + + [bdubbs] - Update to tar-1.35. Fixes + #5287. + + + [bdubbs] - Update to systemd-254. Fixes + #5293. + + + [bdubbs] - Update to meson-1.2.0. Fixes + #5286. + + + [bdubbs] - Update to linux-6.4.7. Fixes + #5288. + + + [bdubbs] - Update to gcc-13.2.0. Fixes + #5292. + + + [bdubbs] - Update to file-5.45. Fixes + #5294. + + + + 2023-07-28 diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index 42d10c0aa..f40d3b33a 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -100,9 +100,9 @@ - + @@ -250,15 +250,15 @@ Sysklogd-&sysklogd-version; - + Systemd-&systemd-version; - + @@ -274,9 +274,9 @@ Vim-&vim-version; - + diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index 43f699689..bb22fbca5 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -172,10 +172,10 @@ su tester -c "PATH=$PATH make -k check" url="&test-results;"/> and . - Two tests named pr104610.c and + Two tests named copy.cc and pr56837.c are known to fail. diff --git a/chapter08/udev.xml b/chapter08/udev.xml index 2d3792511..67e835afc 100644 --- a/chapter08/udev.xml +++ b/chapter08/udev.xml @@ -127,7 +127,7 @@ meson setup \ install -vm755 -d /usr/{lib,share}/pkgconfig install -vm755 udevadm /usr/bin/ install -vm755 systemd-hwdb /usr/bin/udev-hwdb -ln -sv ../bin/udevadm /usr/sbin/udevd +ln -svfn ../bin/udevadm /usr/sbin/udevd cp -av libudev.so{,*[0-9]} /usr/lib/ install -vm644 ../src/libudev/libudev.h /usr/include/ install -vm644 src/libudev/*.pc /usr/lib/pkgconfig/ @@ -147,7 +147,7 @@ make -f &udev-lfs-version;/Makefile.lfs install -tar -xf ../../systemd-man-pages-253.tar.xz --strip-components=1 \ +tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz --strip-components=1 \ -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \ '*/systemd-'{hwdb,udevd.service}.8 sed 's/systemd\(\\\?-\)/udev-/' /usr/share/man/man8/systemd-hwdb.8 \ diff --git a/packages.ent b/packages.ent index 09008604d..66e7314ab 100644 --- a/packages.ent +++ b/packages.ent @@ -172,10 +172,10 @@ - - + + - + @@ -218,10 +218,10 @@ - - + + - + @@ -433,12 +433,12 @@ - + - + - + - + - + - - + + - + @@ -668,10 +668,10 @@ - - + + - + @@ -709,10 +709,10 @@ - - + + - + @@ -737,10 +737,10 @@ - - + + - + diff --git a/udev-lfs/55-lfs.rules b/udev-lfs/55-lfs.rules index 34229ea2c..8d37ba920 100644 --- a/udev-lfs/55-lfs.rules +++ b/udev-lfs/55-lfs.rules @@ -6,9 +6,3 @@ SUBSYSTEM=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start" KERNEL=="rtc", ACTION=="add", MODE="0644", RUN+="/etc/rc.d/init.d/setclock start" -# Comms devices - -KERNEL=="ippp[0-9]*", GROUP="dialout" -KERNEL=="isdn[0-9]*", GROUP="dialout" -KERNEL=="isdnctrl[0-9]*", GROUP="dialout" -KERNEL=="dcbri[0-9]*", GROUP="dialout" diff --git a/udev-lfs/55-lfs.txt b/udev-lfs/55-lfs.txt index 5f116f9b7..6e0afda59 100644 --- a/udev-lfs/55-lfs.txt +++ b/udev-lfs/55-lfs.txt @@ -7,14 +7,9 @@ Description of rules: By default, Udev creates device nodes with UID 0, GID 0, and permissions 0660. -ISDN-related devices should be owned by the 'dialout' group, hence the following -rule (and similar): - -KERNEL=="ippp[0-9]*", GROUP="dialout" - -The RTC-related rules cause the setclock bootscript to be run as soon as the +The RTC-related rule causes the setclock bootscript to be run as soon as the RTC device has been created by Udev, meaning that times in log files, for example, are as accurate as possible as quickly as possible. -A final word of caution: Any particular rule must be written on one line, and a -comma must separate each part of the rule. +A word of caution: A comma must separate each part of the rule. A rule can span +multiple lines if the newline is escaped by a backslash. diff --git a/udev-lfs/81-cdrom.rules b/udev-lfs/81-cdrom.rules deleted file mode 100644 index cb7ea5748..000000000 --- a/udev-lfs/81-cdrom.rules +++ /dev/null @@ -1,3 +0,0 @@ -# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions and get device capabilities - -ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", IMPORT{program}="cdrom_id --export $tempnode", GROUP="cdrom" diff --git a/udev-lfs/83-cdrom-symlinks.rules b/udev-lfs/83-cdrom-symlinks.rules deleted file mode 100644 index 1a21a0649..000000000 --- a/udev-lfs/83-cdrom-symlinks.rules +++ /dev/null @@ -1,13 +0,0 @@ -# /etc/udev/rules.d/83-cdrom-symlinks.rules: Determine CD drive capability. - -ACTION!="add", GOTO="cd_aliases_generator_end" -SUBSYSTEM!="block", GOTO="cd_aliases_generator_end" -ENV{GENERATED}=="?*", GOTO="cd_aliases_generator_end" - -# Fail the uevent if the autogenerated rules cannot be saved -ENV{ID_CDROM}=="?*", PROGRAM="/bin/grep -c ' / [^[:space:]]* rw' /proc/mounts", \ - RESULT!="1", RUN+="/bin/false", GOTO="cd_aliases_generator_end" - -ENV{ID_CDROM}=="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" - -LABEL="cd_aliases_generator_end" diff --git a/udev-lfs/ChangeLog b/udev-lfs/ChangeLog index 560346143..53660938a 100644 --- a/udev-lfs/ChangeLog +++ b/udev-lfs/ChangeLog @@ -1,3 +1,7 @@ +2023-07-28 + * Remove obsolete 83-cdrom-symlinks.rules and 81-cdrom.rules + * Remove references to obsolete ISDN devices + 2017-10-27 * 83-cdrom-symlinks.rules: Adjust test for writable root directory. diff --git a/udev-lfs/Makefile.lfs b/udev-lfs/Makefile.lfs index 1218d9dcd..a8b4d7f30 100644 --- a/udev-lfs/Makefile.lfs +++ b/udev-lfs/Makefile.lfs @@ -3,7 +3,7 @@ # vim: tabstop=3 -VERSION=20171102 +VERSION=20230728 SHELL=/bin/bash ifeq ($(V),) @@ -16,15 +16,14 @@ all: @echo "Use the install target" install: - @mkdir -pv $(DESTDIR)/lib/udev/rules.d \ + @mkdir -pv $(DESTDIR)/usr/lib/udev/rules.d \ $(DESTDIR)/etc/udev/rules.d \ $(DESTDIR)/usr/share/doc/udev-$(VERSION)/lfs # Copy rules @cp -v udev-lfs-$(VERSION)/*.rules $(DESTDIR)/etc/udev/rules.d - @cp -v udev-lfs-$(VERSION)/*_rules \ - udev-lfs-$(VERSION)/init-net-rules.sh \ - udev-lfs-$(VERSION)/rule_generator.functions $(DESTDIR)/lib/udev + @cp -v udev-lfs-$(VERSION)/init-net-rules.sh \ + udev-lfs-$(VERSION)/rule_generator.functions $(DESTDIR)/usr/lib/udev # Copy documentation @cp -v udev-lfs-$(VERSION)/README $(DESTDIR)/usr/share/doc/udev-$(VERSION)/lfs diff --git a/udev-lfs/README b/udev-lfs/README index 61d0e86bc..1f050eb15 100644 --- a/udev-lfs/README +++ b/udev-lfs/README @@ -14,9 +14,7 @@ Makefile.lfs - The LFS Makefile. Installs udev rules for LFS. contrib - Useful rules from debian contrib/debian -contrib/debian/83-cdrom-symlinks.rules contrib/debian/write_cd_aliases -contrib/debian/81-cdrom.rules 55-lfs.rules - LFS custom rules write_net_rules - Scripts for LFS rules From 7dcd8c782bab203dcba04013f4ecc6846a12bd93 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 29 Jul 2023 09:51:28 +0800 Subject: [PATCH 09/34] systemd: Remove sed unneeded with 254 --- chapter08/systemd.xml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml index e99167d07..c71616725 100644 --- a/chapter08/systemd.xml +++ b/chapter08/systemd.xml @@ -40,19 +40,6 @@ Installation of systemd - - Remove several inappropriate uses of the pure - attribute that cause runtime issues when the package is built - with gcc-13 or later: - - -sed '/bus_message_type_from_string/s/_pure_//' \ - -i src/libsystemd/sd-bus/bus-internal.h && -sed '/devt_hash_func/s/_pure_//' \ - -i src/basic/hash-funcs.h && -sed '/job_get_timeout/s/_pure_//' \ - -i src/core/job.h - Remove two unneeded groups, render and sgx, from the default udev From 57f16783edb41bf517c52d453278f5b3b4bac434 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 29 Jul 2023 09:53:44 +0800 Subject: [PATCH 10/34] systemd: Add --no-same-owner for man page extraction Well, I forgot to create the man pages tarball as root, so if we don't use --no-same-owner the man pages will be owned by UID 1000 :(. Instead of regenerating the tarball again let's just fix this in the book. --- chapter08/systemd.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml index c71616725..eb8ea77b0 100644 --- a/chapter08/systemd.xml +++ b/chapter08/systemd.xml @@ -192,7 +192,9 @@ meson setup \ -tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz --strip-components=1 -C /usr/share/man +tar -xf ../../systemd-man-pages-&systemd-version;.tar.xz \ + --no-same-owner --strip-components=1 \ + -C /usr/share/man Create the /etc/machine-id file needed by systemd-journald: From bec5f879a3940faf011c853b66f37c242fe85302 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 29 Jul 2023 09:59:44 +0800 Subject: [PATCH 11/34] changelog: Prefix new "systemd" entry with "udev from" for sysv --- chapter01/changelog.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index d5debd345..ac551a947 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -57,7 +57,8 @@ #5287. - [bdubbs] - Update to systemd-254. Fixes + [bdubbs] - Update to udev + from systemd-254. Fixes #5293. From c2ccad14a5ed01857b84199133d7468ccd02c461 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 29 Jul 2023 10:19:04 +0800 Subject: [PATCH 12/34] systemd: Add two new symlinks into contents --- chapter08/systemd.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml index eb8ea77b0..63003ac68 100644 --- a/chapter08/systemd.xml +++ b/chapter08/systemd.xml @@ -233,12 +233,14 @@ meson setup \ busctl, coredumpctl, halt (symlink to systemctl), hostnamectl, init, journalctl, kernel-install, localectl, loginctl, - machinectl, networkctl, oomctl, portablectl, poweroff (symlink to + machinectl, mount.ddi (symlink to systemd-dissect), networkctl, + oomctl, portablectl, poweroff (symlink to systemctl), reboot (symlink to systemctl), resolvconf (symlink to resolvectl), resolvectl, runlevel (symlink to systemctl), shutdown (symlink to systemctl), systemctl, systemd-ac-power, systemd-analyze, systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop, - systemd-creds, systemd-delta, systemd-detect-virt, + systemd-confext (symlink to systemd-sysext), systemd-creds, + systemd-delta, systemd-detect-virt, systemd-dissect, systemd-escape, systemd-hwdb, systemd-id128, systemd-inhibit, systemd-machine-id-setup, systemd-mount, systemd-notify, systemd-nspawn, systemd-path, From 83e616f79e84539b34d912b4a4ed430e00b86839 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Fri, 28 Jul 2023 23:14:10 -0500 Subject: [PATCH 13/34] Reformat kernel configuuration options. A couple of the newer kernel options overflow past 80 columns on the kernel page. It's not optimal, but insert newlines for these options. Also reorder the options to to same ordeer as they appear in menuconfig and add some blank lines between major setions for clarity. --- chapter10/kernel.xml | 62 +++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index 376f6cdff..ea367054a 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -130,58 +130,70 @@ Be sure to enable/disable/set the following features or the system might not work correctly or boot at all: - Processor type and features ---> - [*] Build a relocatable kernel [CONFIG_RELOCATABLE] - [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] -General setup ---> +General setup ---> [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] - CPU/Task time and stats accounting ---> - [*] Pressure stall information tracking [CONFIG_PSI] - [ ] Require boot parameter to enable pressure stall information tracking [CONFIG_PSI_DEFAULT_DISABLED] + CPU/Task time and stats accounting ---> + [*] Pressure stall information tracking [CONFIG_PSI] + [ ] Require boot parameter to enable pressure stall information tracking + [CONFIG_PSI_DEFAULT_DISABLED] < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] [*] Control Group support [CONFIG_CGROUPS] ---> [*] Memory controller [CONFIG_MEMCG] [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] + +Processor type and features ---> + [*] Build a relocatable kernel [CONFIG_RELOCATABLE] + [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] + General architecture-dependent options ---> [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] -Device Drivers ---> - Graphics support ---> - Frame buffer Devices ---> - <*> Support for frame buffer devices ---> - Console display driver support ---> - [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT] - Processor type and features ---> - [*] Build a relocatable kernel [CONFIG_RELOCATABLE] - [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs + [CONFIG_DEVTMPFS_MOUNT] + Graphics support ---> + Frame buffer Devices ---> + <*> Support for frame buffer devices ---> + Console display driver support ---> + [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] + + General setup ---> [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] [ ] Auditing Support [CONFIG_AUDIT] CPU/Task time and stats accounting ---> [*] Pressure stall information tracking [CONFIG_PSI] - [ ] Require boot parameter to enable pressure stall information tracking [CONFIG_PSI_DEFAULT_DISABLED] + [ ] Require boot parameter to enable pressure stall information tracking + [CONFIG_PSI_DEFAULT_DISABLED] < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] [*] Control Group support [CONFIG_CGROUPS] ---> [*] Memory controller [CONFIG_MEMCG] [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] + +Processor type and features ---> + [*] Build a relocatable kernel [CONFIG_RELOCATABLE] + [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] + General architecture-dependent options ---> [*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP] [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] - [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] + [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] + [*] Networking support ---> [CONFIG_NET] Networking options ---> [*] TCP/IP networking [CONFIG_INET] <*> The IPv6 protocol [CONFIG_IPV6] + Device Drivers ---> Generic Driver Options ---> [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT] + [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs + [CONFIG_DEVTMPFS_MOUNT] Firmware Loader ---> [ ] Enable the firmware sysfs fallback mechanism [CONFIG_FW_LOADER_USER_HELPER] Firmware Drivers ---> @@ -191,6 +203,7 @@ Device Drivers ---> <*> Support for frame buffer devices ---> Console display driver support ---> [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] + File systems ---> [*] Inotify support for userspace [CONFIG_INOTIFY_USER] Pseudo filesystems ---> @@ -203,8 +216,9 @@ File systems ---> CONFIG_X86_X2APIC because an option only shows up after its dependencies are selected. - Processor type and features ---> +Processor type and features ---> [*] Support x2apic [CONFIG_X86_X2APIC] + Device Drivers ---> [*] PCI Support ---> [CONFIG_PCI] [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI] From 2cf01ab7023ce34da711af45413f4ed7850a9837 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Mon, 31 Jul 2023 01:09:24 -0500 Subject: [PATCH 14/34] Add some color to kernel options --- chapter10/kernel.xml | 74 ++++++++++++++++++------------------- stylesheets/lfs-xsl/lfs.css | 3 ++ 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index ea367054a..9e522cb0d 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -130,36 +130,36 @@ Be sure to enable/disable/set the following features or the system might not work correctly or boot at all: -General setup ---> - [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] - CPU/Task time and stats accounting ---> - [*] Pressure stall information tracking [CONFIG_PSI] - [ ] Require boot parameter to enable pressure stall information tracking +General setup ---> + [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] + CPU/Task time and stats accounting ---> + [*] Pressure stall information tracking [CONFIG_PSI] + [ ] Require boot parameter to enable pressure stall information tracking [CONFIG_PSI_DEFAULT_DISABLED] - < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] - [*] Control Group support [CONFIG_CGROUPS] ---> - [*] Memory controller [CONFIG_MEMCG] - [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] + < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] + [*] Control Group support [CONFIG_CGROUPS] ---> + [*] Memory controller [CONFIG_MEMCG] + [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] -Processor type and features ---> - [*] Build a relocatable kernel [CONFIG_RELOCATABLE] - [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] +Processor type and features ---> + [*] Build a relocatable kernel [CONFIG_RELOCATABLE] + [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] -General architecture-dependent options ---> - [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] - [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] +General architecture-dependent options ---> + [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] + [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] -Device Drivers ---> - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT] - Graphics support ---> - Frame buffer Devices ---> - <*> Support for frame buffer devices ---> - Console display driver support ---> - [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] + Graphics support ---> + Frame buffer Devices ---> + <*> Support for frame buffer devices ---> + Console display driver support ---> + [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] General setup ---> @@ -216,31 +216,31 @@ File systems ---> CONFIG_X86_X2APIC because an option only shows up after its dependencies are selected. -Processor type and features ---> - [*] Support x2apic [CONFIG_X86_X2APIC] +Processor type and features ---> + [*] Support x2apic [CONFIG_X86_X2APIC] Device Drivers ---> - [*] PCI Support ---> [CONFIG_PCI] - [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI] - [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT] - [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP] + [*] PCI Support ---> [CONFIG_PCI] + [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI] + [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT] + [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP] If you are building a 32-bit system running on a hardware with RAM more than 4GB, adjust the configuration so the kernel will be able to use up to 64GB physical RAM: - Processor type and features ---> - High Memory Support ---> - (X) 64GB [CONFIG_HIGHMEM64G] + Processor type and features ---> + High Memory Support ---> + (X) 64GB [CONFIG_HIGHMEM64G] If the partition for the LFS system is in a NVME SSD (i. e. the device node for the partition is /dev/nvme* instead of /dev/sd*), enable NVME support or the LFS system won't boot: - Device Drivers ---> - NVME Support ---> - <*> NVM Express block device [CONFIG_BLK_DEV_NVME] + Device Drivers ---> + NVME Support ---> + <*> NVM Express block device [CONFIG_BLK_DEV_NVME] diff --git a/stylesheets/lfs-xsl/lfs.css b/stylesheets/lfs-xsl/lfs.css index 3cadbc469..80eca11ed 100644 --- a/stylesheets/lfs-xsl/lfs.css +++ b/stylesheets/lfs-xsl/lfs.css @@ -265,6 +265,9 @@ li.chapter h4 a { margin: .6em 0 .2em 0; } +span.blue { + color: #2ac; +} /* Index */ .item { From 70bf5512d96389ea1c068cd20a48093a10d6a963 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 1 Aug 2023 00:08:56 +0800 Subject: [PATCH 15/34] kernel: Use new kernel configuration rendering method Import kernel-config infrastructure from BLFS and use it for kernel configuration. Note that kernel-config.py is slightly different from BLFS: we need role="nodump" for here. --- chapter10/kernel.xml | 103 ++-------- chapter10/kernel/.gitignore | 2 + chapter10/kernel/Makefile | 19 ++ chapter10/kernel/highmem.toml | 1 + chapter10/kernel/highmem.xml | 8 + chapter10/kernel/kernel-config.py | 293 +++++++++++++++++++++++++++++ chapter10/kernel/kernel.version | 1 + chapter10/kernel/kernel_version.py | 27 +++ chapter10/kernel/nvme.toml | 1 + chapter10/kernel/nvme.xml | 8 + chapter10/kernel/systemd.toml | 30 +++ chapter10/kernel/systemd.xml | 48 +++++ chapter10/kernel/sysv.toml | 18 ++ chapter10/kernel/sysv.xml | 32 ++++ chapter10/kernel/x2apic.toml | 5 + chapter10/kernel/x2apic.xml | 12 ++ 16 files changed, 518 insertions(+), 90 deletions(-) create mode 100644 chapter10/kernel/.gitignore create mode 100644 chapter10/kernel/Makefile create mode 100644 chapter10/kernel/highmem.toml create mode 100644 chapter10/kernel/highmem.xml create mode 100755 chapter10/kernel/kernel-config.py create mode 100644 chapter10/kernel/kernel.version create mode 100755 chapter10/kernel/kernel_version.py create mode 100644 chapter10/kernel/nvme.toml create mode 100644 chapter10/kernel/nvme.xml create mode 100644 chapter10/kernel/systemd.toml create mode 100644 chapter10/kernel/systemd.xml create mode 100644 chapter10/kernel/sysv.toml create mode 100644 chapter10/kernel/sysv.xml create mode 100644 chapter10/kernel/x2apic.toml create mode 100644 chapter10/kernel/x2apic.xml diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml index 9e522cb0d..8609b1474 100644 --- a/chapter10/kernel.xml +++ b/chapter10/kernel.xml @@ -130,84 +130,15 @@ Be sure to enable/disable/set the following features or the system might not work correctly or boot at all: -General setup ---> - [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] - CPU/Task time and stats accounting ---> - [*] Pressure stall information tracking [CONFIG_PSI] - [ ] Require boot parameter to enable pressure stall information tracking - [CONFIG_PSI_DEFAULT_DISABLED] - < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] - [*] Control Group support [CONFIG_CGROUPS] ---> - [*] Memory controller [CONFIG_MEMCG] - [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] + -Processor type and features ---> - [*] Build a relocatable kernel [CONFIG_RELOCATABLE] - [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] + -General architecture-dependent options ---> - [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] - [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] - -Device Drivers ---> - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs - [CONFIG_DEVTMPFS_MOUNT] - Graphics support ---> - Frame buffer Devices ---> - <*> Support for frame buffer devices ---> - Console display driver support ---> - [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] - - -General setup ---> - [ ] Compile the kernel with warnings as errors [CONFIG_WERROR] - [ ] Auditing Support [CONFIG_AUDIT] - CPU/Task time and stats accounting ---> - [*] Pressure stall information tracking [CONFIG_PSI] - [ ] Require boot parameter to enable pressure stall information tracking - [CONFIG_PSI_DEFAULT_DISABLED] - < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] - [*] Control Group support [CONFIG_CGROUPS] ---> - [*] Memory controller [CONFIG_MEMCG] - [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] - -Processor type and features ---> - [*] Build a relocatable kernel [CONFIG_RELOCATABLE] - [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] - -General architecture-dependent options ---> - [*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP] - [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] - [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG] - -[*] Networking support ---> [CONFIG_NET] - Networking options ---> - [*] TCP/IP networking [CONFIG_INET] - <*> The IPv6 protocol [CONFIG_IPV6] - -Device Drivers ---> - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs - [CONFIG_DEVTMPFS_MOUNT] - Firmware Loader ---> - [ ] Enable the firmware sysfs fallback mechanism [CONFIG_FW_LOADER_USER_HELPER] - Firmware Drivers ---> - [*] Export DMI identification via sysfs to userspace [CONFIG_DMIID] - Graphics support ---> - Frame buffer Devices ---> - <*> Support for frame buffer devices ---> - Console display driver support ---> - [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE] - -File systems ---> - [*] Inotify support for userspace [CONFIG_INOTIFY_USER] - Pseudo filesystems ---> - [*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL] + Enable some additional features if you are building a 64-bit system. If you are using menuconfig, enable them in the order of @@ -216,31 +147,23 @@ File systems ---> CONFIG_X86_X2APIC because an option only shows up after its dependencies are selected. -Processor type and features ---> - [*] Support x2apic [CONFIG_X86_X2APIC] - -Device Drivers ---> - [*] PCI Support ---> [CONFIG_PCI] - [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI] - [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT] - [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP] + If you are building a 32-bit system running on a hardware with RAM more than 4GB, adjust the configuration so the kernel will be able to use up to 64GB physical RAM: - Processor type and features ---> - High Memory Support ---> - (X) 64GB [CONFIG_HIGHMEM64G] + If the partition for the LFS system is in a NVME SSD (i. e. the device node for the partition is /dev/nvme* instead of /dev/sd*), enable NVME support or the LFS system won't boot: - Device Drivers ---> - NVME Support ---> - <*> NVM Express block device [CONFIG_BLK_DEV_NVME] + diff --git a/chapter10/kernel/.gitignore b/chapter10/kernel/.gitignore new file mode 100644 index 000000000..e22d2c3a4 --- /dev/null +++ b/chapter10/kernel/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +s-kernel-version diff --git a/chapter10/kernel/Makefile b/chapter10/kernel/Makefile new file mode 100644 index 000000000..d02408dcc --- /dev/null +++ b/chapter10/kernel/Makefile @@ -0,0 +1,19 @@ +INPUT = $(wildcard *.toml) +OUTPUT = $(patsubst %.toml, %.xml, $(INPUT)) + +ifeq ($(KERNEL_TREE),) +$(error "must set KERNEL_TREE=/path/to/kernel/source") +endif + +all: $(OUTPUT) + +kernel.version: s-kernel-version; @true +s-kernel-version: Makefile kernel_version.py + ./kernel_version.py $(KERNEL_TREE) > tmp-kernel.version + if ! diff tmp-kernel.version $@ 2>/dev/null >/dev/null; then \ + mv tmp-kernel.version kernel.version; \ + fi + touch s-kernel-version + +%.xml: %.toml kernel-config.py kernel_version.py kernel.version + ./kernel-config.py $(KERNEL_TREE) $< > $@ diff --git a/chapter10/kernel/highmem.toml b/chapter10/kernel/highmem.toml new file mode 100644 index 000000000..2caf42385 --- /dev/null +++ b/chapter10/kernel/highmem.toml @@ -0,0 +1 @@ +HIGHMEM64G='X' diff --git a/chapter10/kernel/highmem.xml b/chapter10/kernel/highmem.xml new file mode 100644 index 000000000..4f0938142 --- /dev/null +++ b/chapter10/kernel/highmem.xml @@ -0,0 +1,8 @@ + + + +Processor type and features ---> + High Memory Support ---> + (X) 64GB [HIGHMEM64G] diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py new file mode 100755 index 000000000..93b203a46 --- /dev/null +++ b/chapter10/kernel/kernel-config.py @@ -0,0 +1,293 @@ +#!/usr/bin/env python3 + +# SPDX-License-Identifier: MIT +# Copyright 2023 The LFS Editors + +# Stupid script to render "mconf"-style kernel configuration +# Usage: kernel-config.py [path to kernel tree] [needed config].toml +# The toml file should be like: +# for bool and tristate: +# EXT4="*" +# DRM="*M" +# EXPERT=" " +# DRM_I915="*M" +# for choice: +# HIGHMEM64G="X" +# an entry with comment: +# DRM_I915 = { value = " *M", comment = "for i915, crocus, or iris" } + +choice_bit = 1 << 30 +ind0 = 0 +ind1 = 0 +menu_id = 1 +stack = [] +if_stack = [] + +expand_var_mp = { 'SRCARCH': 'x86' } +main_dep = {} + +def expand_var(s): + for k in expand_var_mp: + s = s.replace('$(' + k + ')', expand_var_mp[k]) + return s + +def pop_stack(cond): + global ind0, ind1, stack + assert(cond(stack[-1][0])) + s, i0, i1, _ = stack[-1] + stack = stack[:-1] + ind0 -= i0 + ind1 -= i1 + +def pop_stack_while(cond): + while stack and cond(stack[-1][0]): + pop_stack(cond) + +def cur_menu(): + global stack + return stack[-1][3] if stack else 0 + +def cur_if(): + global if_stack + return if_stack[-1][:] if if_stack else [] + +def clean_dep(d): + d = d.strip() + if d.endswith('=y') or d.endswith('=M'): + d = d[:-2] + elif d.endswith(' != ""'): + d = d[:-6] + return d + +def parse_config(buf): + global ind0, ind1, stack, menu_id + is_choice = buf[0].strip() == 'choice' + is_menu = buf[0].startswith('menu') or is_choice + is_nonconfig_menu = buf[0].startswith('menu ') or is_choice + key = None if is_nonconfig_menu else buf[0].split()[1].strip() + title = buf[0][len('menu '):] if is_nonconfig_menu else None + deps = ['menu'] + cur_if() + klass = None + + for line in buf[1:]: + line = line.strip() + if line.startswith('depends on '): + new_deps = line[len('depends on '):].split('&&') + deps += [clean_dep(x) for x in new_deps] + elif line.startswith('prompt'): + title = line[len('prompt '):] + else: + for prefix in ['tristate', 'bool', 'string']: + if line.startswith(prefix + ' '): + title = line[len(prefix) + 1:] + klass = prefix + elif line == prefix: + klass = prefix + elif line.startswith('def_' + prefix + ' '): + klass = prefix + else: + continue + + if '"' in line: + tail = line[line.rfind('"') + 1:].strip() + if tail[:3] == 'if ': + deps += [clean_dep(x) for x in tail[3:].split('&&')] + + pop_stack_while(lambda x: x not in deps) + + menu_id += is_menu + internal_key = key or menu_id + if stack: + fa = stack[-1][0] + if fa == 'menu': + fa = cur_menu() & ~choice_bit + main_dep[internal_key] = fa + + val = known_config.get(key) + comment = None + forced = None + + if type(val) == dict: + comment = val.get('comment') + forced = val.get('forced') + val = val['value'] + + klass = klass or 'string' + if title: + title = title.strip().lstrip('"') + title = title[:title.find('"')] + + if not val: + pass + elif klass == 'string': + val = '(' + val + ')' + else: + assert((val == 'X') == bool(cur_menu() & choice_bit)) + if (val == 'X'): + val = '(X)' + else: + val = list(val) + val.sort() + for c in val: + if c not in 'M* ' or (c == 'M' and klass != 'tristate'): + raise Exception('unknown setting %s for %s' % (c, key)) + bracket = None + if klass == 'tristate' and forced != '*' : + bracket = '{}' if forced else '<>' + else: + bracket = '--' if forced else '[]' + + val = bracket[0] + '/'.join(val) + bracket[1] + + arrow = ' --->' if is_menu else '' + r = [ind0, val, ind1, title, arrow, internal_key, cur_menu(), comment] + + # Don't indent for untitled (internal) entries + x = 2 if title else 0 + + key = key or 'menu' + menu = (menu_id if is_menu else cur_menu()) + menu |= choice_bit if is_choice else 0 + stack_ent = (key, 2, 0, menu) if is_menu else (key, 0, x, menu) + ind0 += stack_ent[1] + ind1 += stack_ent[2] + stack += [stack_ent] + + return r + +def load_kconfig(file): + global ind0, ind1, stack, path, menu_id, if_stack + r = [] + config_buf = [] + with open(path + file) as f: + for line in f: + if config_buf: + if not (line.startswith('\t') or line.startswith(' ')): + r += [parse_config(config_buf)] + config_buf = [] + else: + config_buf += [line] + continue + if line.startswith('source') or line.startswith('\tsource'): + sub = expand_var(line.strip().split()[1].strip('"')) + r += load_kconfig(sub) + elif line.startswith('config') or line.startswith('menu'): + config_buf = [line] + elif line.startswith('choice'): + config_buf = [line] + elif line.startswith('endmenu') or line.startswith('endchoice'): + pop_stack_while(lambda x: x != 'menu') + pop_stack(lambda x: x == 'menu') + elif line.startswith('if '): + line = line[3:] + top = cur_if() + top += [x.strip() for x in line.split("&&")] + if_stack += [top] + elif line.startswith('endif'): + if_stack = if_stack[:-1] + return r + +known_config = {} + +def escape(x): + return x.replace('<', '<').replace('>', '>') + +from sys import argv +import tomllib + +path = argv[1] +if path[-1] != '/': + path += '/' +with open(argv[2], 'rb') as f: + known_config = tomllib.load(f) + +r = load_kconfig('Kconfig') + +# Refcount all menus + +index_ikey = {} +for i in reversed(range(len(r))): + index_ikey[r[i][5]] = i + +for i in reversed(range(len(r))): + if r[i][1] != None: + key = r[i][5] + fa = main_dep.get(key) + if not fa: + continue + j = index_ikey[fa] + if type(fa) == int or not r[j][3]: + # The main dependency is a menu or untitled magic entry, + # just mark it used + r[j][1] = '' + if r[j][1] is None: + raise Exception('[%s] needs unselected [%s]' % (key, fa)) + +r = [i for i in r if i[1] != None and i[3]] + +# Now we are going to pretty-print r + +## Calculate the maximum value length for each menu +max_val_len = {} +for _, val, _, _, _, _, menu, _ in r: + x = max_val_len.get(menu) or 0 + max_val_len[menu] = max(x, len(val)) + +## Output + +max_line = 80 +buf = [] + +done = [x[5] for x in r] + ['revision'] +for i in known_config: + if i not in done: + raise Exception("%s seems not exist" % i) + +for i0, val, i1, title, arrow, key, menu, comment in r: + rem = max_line + + if val: + val += (max_val_len[menu] - len(val)) * ' ' + + rem -= i0 + i1 + bool(val) + len(val) + line = i0 * ' ' + escape(val) + (i1 + bool(val)) * ' ' + + rem -= len(arrow) + + if len(title) > rem: + title = title[:rem - 3] + '...' + + b = title.lstrip('YyMmNnHh') + a = title[:len(title) - len(b)] + b0 = "" + escape(b[0]) + "" + line += escape(a) + b0 + escape(b[1:]) + escape(arrow) + + rem -= len(title) + + key = ' [' + key + ']' if type(key) == str else '' + + if len(key) <= rem: + line += (rem - len(key)) * ' ' + key + else: + key = '... ' + key + line += '\n' + ' ' * (max_line - len(key)) + key + if type(comment) == str: + comment = [comment] + if comment: + comment = '\n'.join([' ' * i0 + '# ' + line for line in comment]) + line = escape(comment) + ':\n' + line + + buf += [line.rstrip()] + +from jinja2 import Template + +t = Template(''' + + +{{ '\n'.join(buf) }}''') + +rev = known_config.get('revision') +rev = ' revision="%s"' % rev if rev else '' +print(t.render(rev = rev, buf = buf)) diff --git a/chapter10/kernel/kernel.version b/chapter10/kernel/kernel.version new file mode 100644 index 000000000..3c43d7159 --- /dev/null +++ b/chapter10/kernel/kernel.version @@ -0,0 +1 @@ +6.4.7 diff --git a/chapter10/kernel/kernel_version.py b/chapter10/kernel/kernel_version.py new file mode 100755 index 000000000..764bb2d33 --- /dev/null +++ b/chapter10/kernel/kernel_version.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +def kernel_version(path): + version = None + patchlevel = None + sublevel = None + + with open(path + 'Makefile') as f: + for line in f: + if line.startswith('VERSION ='): + version = line[len('VERSION ='):].strip() + elif line.startswith('PATCHLEVEL ='): + patchlevel = line[len('PATCHLEVEL ='):].strip() + elif line.startswith('SUBLEVEL ='): + sublevel = line[len('SUBLEVEL ='):].strip() + + assert(version and patchlevel and sublevel) + return '.'.join([version, patchlevel, sublevel]) + +if __name__ == '__main__': + from sys import argv + + path = argv[1] + if path[:-1] != '/': + path += '/' + + print(kernel_version(path)) diff --git a/chapter10/kernel/nvme.toml b/chapter10/kernel/nvme.toml new file mode 100644 index 000000000..1e3170fe9 --- /dev/null +++ b/chapter10/kernel/nvme.toml @@ -0,0 +1 @@ +BLK_DEV_NVME='*' diff --git a/chapter10/kernel/nvme.xml b/chapter10/kernel/nvme.xml new file mode 100644 index 000000000..2b55b7c1d --- /dev/null +++ b/chapter10/kernel/nvme.xml @@ -0,0 +1,8 @@ + + + +Device Drivers ---> + NVME Support ---> + <*> NVM Express block device [BLK_DEV_NVME] diff --git a/chapter10/kernel/systemd.toml b/chapter10/kernel/systemd.toml new file mode 100644 index 000000000..936c50492 --- /dev/null +++ b/chapter10/kernel/systemd.toml @@ -0,0 +1,30 @@ +# This part should be sync with sysv.toml +WERROR=' ' +PSI='*' +PSI_DEFAULT_DISABLED=' ' +IKHEADERS=' ' +CGROUPS='*' +MEMCG='*' +EXPERT=' ' +RELOCATABLE='*' +RANDOMIZE_BASE='*' +STACKPROTECTOR='*' +STACKPROTECTOR_STRONG='*' +UEVENT_HELPER=' ' +DEVTMPFS='*' +DEVTMPFS_MOUNT='*' +FB='*' +FRAMEBUFFER_CONSOLE='*' + +AUDIT=' ' +NET='*' +INET='*' +IPV6='*' +FW_LOADER=' *' +FW_LOADER_USER_HELPER='*' +DMIID='*' +INOTIFY_USER='*' +TMPFS='*' +TMPFS_POSIX_ACL='*' + +revision='systemd' diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml new file mode 100644 index 000000000..0bbe1d42a --- /dev/null +++ b/chapter10/kernel/systemd.xml @@ -0,0 +1,48 @@ + + + +General setup ---> + [ ] Compile the kernel with warnings as errors [WERROR] + [ ] Auditing support [AUDIT] + CPU/Task time and stats accounting ---> + [*] Pressure stall information tracking [PSI] + [ ] Require boot parameter to enable pressure stall information tracking + ... [PSI_DEFAULT_DISABLED] + < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [IKHEADERS] + [*] Control Group support ---> [CGROUPS] + [*] Memory controller [MEMCG] + [ ] Configure standard kernel features (expert users) ---> [EXPERT] +Processor type and features ---> + [*] Build a relocatable kernel [RELOCATABLE] + [*] Randomize the address of the kernel image (KASLR) [RANDOMIZE_BASE] +General architecture-dependent options ---> + [*] Stack Protector buffer overflow detection [STACKPROTECTOR] + [*] Strong Stack Protector [STACKPROTECTOR_STRONG] +[*] Networking support ---> [NET] + Networking options ---> + [*] TCP/IP networking [INET] + <*> The IPv6 protocol ---> [IPV6] +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [DEVTMPFS] + [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs + ... [DEVTMPFS_MOUNT] + Firmware loader ---> + < /*> Firmware loading facility [FW_LOADER] + [*] Enable the firmware sysfs fallback mechanism + ... [FW_LOADER_USER_HELPER] + Firmware Drivers ---> + [*] Export DMI identification via sysfs to userspace [DMIID] + Graphics support ---> + Frame buffer Devices ---> + <*> Support for frame buffer devices ---> [FB] + Console display driver support ---> + [*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] +File systems ---> + [*] Inotify support for userspace [INOTIFY_USER] + Pseudo filesystems ---> + [*] Tmpfs virtual memory file system support (former shm fs) [TMPFS] + [*] Tmpfs POSIX Access Control Lists [TMPFS_POSIX_ACL] diff --git a/chapter10/kernel/sysv.toml b/chapter10/kernel/sysv.toml new file mode 100644 index 000000000..5c8b2df6e --- /dev/null +++ b/chapter10/kernel/sysv.toml @@ -0,0 +1,18 @@ +WERROR=' ' +PSI='*' +PSI_DEFAULT_DISABLED=' ' +IKHEADERS=' ' +CGROUPS='*' +MEMCG='*' +EXPERT=' ' +RELOCATABLE='*' +RANDOMIZE_BASE='*' +STACKPROTECTOR='*' +STACKPROTECTOR_STRONG='*' +UEVENT_HELPER=' ' +DEVTMPFS='*' +DEVTMPFS_MOUNT='*' +FB='*' +FRAMEBUFFER_CONSOLE='*' + +revision='sysv' diff --git a/chapter10/kernel/sysv.xml b/chapter10/kernel/sysv.xml new file mode 100644 index 000000000..7e615a56c --- /dev/null +++ b/chapter10/kernel/sysv.xml @@ -0,0 +1,32 @@ + + + +General setup ---> + [ ] Compile the kernel with warnings as errors [WERROR] + CPU/Task time and stats accounting ---> + [*] Pressure stall information tracking [PSI] + [ ] Require boot parameter to enable pressure stall information tracking + ... [PSI_DEFAULT_DISABLED] + < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [IKHEADERS] + [*] Control Group support ---> [CGROUPS] + [*] Memory controller [MEMCG] + [ ] Configure standard kernel features (expert users) ---> [EXPERT] +Processor type and features ---> + [*] Build a relocatable kernel [RELOCATABLE] + [*] Randomize the address of the kernel image (KASLR) [RANDOMIZE_BASE] +General architecture-dependent options ---> + [*] Stack Protector buffer overflow detection [STACKPROTECTOR] + [*] Strong Stack Protector [STACKPROTECTOR_STRONG] +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [DEVTMPFS] + [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs + ... [DEVTMPFS_MOUNT] + Graphics support ---> + Frame buffer Devices ---> + <*> Support for frame buffer devices ---> [FB] + Console display driver support ---> + [*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] diff --git a/chapter10/kernel/x2apic.toml b/chapter10/kernel/x2apic.toml new file mode 100644 index 000000000..6f7657b13 --- /dev/null +++ b/chapter10/kernel/x2apic.toml @@ -0,0 +1,5 @@ +X86_X2APIC='*' +PCI='*' +PCI_MSI='*' +IOMMU_SUPPORT='*' +IRQ_REMAP='*' diff --git a/chapter10/kernel/x2apic.xml b/chapter10/kernel/x2apic.xml new file mode 100644 index 000000000..4e4bd9571 --- /dev/null +++ b/chapter10/kernel/x2apic.xml @@ -0,0 +1,12 @@ + + + +Processor type and features ---> + [*] Support x2apic [X86_X2APIC] +Device Drivers ---> + [*] PCI support ---> [PCI] + [*] Message Signaled Interrupts (MSI and MSI-X) [PCI_MSI] + [*] IOMMU Hardware Support ---> [IOMMU_SUPPORT] + [*] Support for Interrupt Remapping [IRQ_REMAP] From 57499d5909d515e8e4d9bfab91c90350816e148c Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 1 Aug 2023 09:17:05 +0800 Subject: [PATCH 16/34] kernel: Separate toplevel menus in rendering --- chapter10/kernel/kernel-config.py | 7 ++++++- chapter10/kernel/systemd.xml | 5 +++++ chapter10/kernel/sysv.xml | 3 +++ chapter10/kernel/x2apic.xml | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py index 93b203a46..fc9bcc0d2 100755 --- a/chapter10/kernel/kernel-config.py +++ b/chapter10/kernel/kernel-config.py @@ -243,6 +243,8 @@ for i in known_config: if i not in done: raise Exception("%s seems not exist" % i) +sep = known_config.get('separate_toplevel_menu') + for i0, val, i1, title, arrow, key, menu, comment in r: rem = max_line @@ -275,7 +277,10 @@ for i0, val, i1, title, arrow, key, menu, comment in r: comment = [comment] if comment: comment = '\n'.join([' ' * i0 + '# ' + line for line in comment]) - line = escape(comment) + ':\n' + line + buf += escape(comment) + ':' + + if not menu and buf: + buf += [''] buf += [line.rstrip()] diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml index 0bbe1d42a..4c57776c2 100644 --- a/chapter10/kernel/systemd.xml +++ b/chapter10/kernel/systemd.xml @@ -14,16 +14,20 @@ [*] Control Group support ---> [CGROUPS] [*] Memory controller [MEMCG] [ ] Configure standard kernel features (expert users) ---> [EXPERT] + Processor type and features ---> [*] Build a relocatable kernel [RELOCATABLE] [*] Randomize the address of the kernel image (KASLR) [RANDOMIZE_BASE] + General architecture-dependent options ---> [*] Stack Protector buffer overflow detection [STACKPROTECTOR] [*] Strong Stack Protector [STACKPROTECTOR_STRONG] + [*] Networking support ---> [NET] Networking options ---> [*] TCP/IP networking [INET] <*> The IPv6 protocol ---> [IPV6] + Device Drivers ---> Generic Driver Options ---> [ ] Support for uevent helper [UEVENT_HELPER] @@ -41,6 +45,7 @@ <*> Support for frame buffer devices ---> [FB] Console display driver support ---> [*] Framebuffer Console support [FRAMEBUFFER_CONSOLE] + File systems ---> [*] Inotify support for userspace [INOTIFY_USER] Pseudo filesystems ---> diff --git a/chapter10/kernel/sysv.xml b/chapter10/kernel/sysv.xml index 7e615a56c..7e62725e6 100644 --- a/chapter10/kernel/sysv.xml +++ b/chapter10/kernel/sysv.xml @@ -13,12 +13,15 @@ [*] Control Group support ---> [CGROUPS] [*] Memory controller [MEMCG] [ ] Configure standard kernel features (expert users) ---> [EXPERT] + Processor type and features ---> [*] Build a relocatable kernel [RELOCATABLE] [*] Randomize the address of the kernel image (KASLR) [RANDOMIZE_BASE] + General architecture-dependent options ---> [*] Stack Protector buffer overflow detection [STACKPROTECTOR] [*] Strong Stack Protector [STACKPROTECTOR_STRONG] + Device Drivers ---> Generic Driver Options ---> [ ] Support for uevent helper [UEVENT_HELPER] diff --git a/chapter10/kernel/x2apic.xml b/chapter10/kernel/x2apic.xml index 4e4bd9571..9bd2a719f 100644 --- a/chapter10/kernel/x2apic.xml +++ b/chapter10/kernel/x2apic.xml @@ -5,6 +5,7 @@ DO NOT EDIT! --> Processor type and features ---> [*] Support x2apic [X86_X2APIC] + Device Drivers ---> [*] PCI support ---> [PCI] [*] Message Signaled Interrupts (MSI and MSI-X) [PCI_MSI] From 3d99820133c0ffcd2f51a6a88b4a476f2f6d340a Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 1 Aug 2023 09:20:08 +0800 Subject: [PATCH 17/34] kernel: Fix a typo --- chapter10/kernel/kernel-config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py index fc9bcc0d2..a36113175 100755 --- a/chapter10/kernel/kernel-config.py +++ b/chapter10/kernel/kernel-config.py @@ -277,7 +277,7 @@ for i0, val, i1, title, arrow, key, menu, comment in r: comment = [comment] if comment: comment = '\n'.join([' ' * i0 + '# ' + line for line in comment]) - buf += escape(comment) + ':' + buf += [escape(comment) + ':'] if not menu and buf: buf += [''] From be5b2e03fc6e7382f8c012d9fdb8e29a9bbbf17c Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 1 Aug 2023 13:52:22 -0500 Subject: [PATCH 18/34] Package updates: Update to vim-9.0.1677. Update to openssl-3.1.2. Update to man-pages-6.05. Update to binutils-2.41. Update to gmp-6.3.0. Update to glibc-2.38. --- chapter01/changelog.xml | 30 ++++++++++++++++++++++++++++++ chapter01/whatsnew.xml | 12 ++++++------ chapter06/diffutils.xml | 4 +++- chapter06/grep.xml | 5 +++-- chapter06/sed.xml | 5 +++-- chapter08/binutils.xml | 2 ++ chapter08/glibc.xml | 2 ++ chapter08/gmp.xml | 2 +- chapter08/stripping.xml | 2 +- packages.ent | 37 +++++++++++++++++++------------------ 10 files changed, 70 insertions(+), 31 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index ac551a947..caf35cc90 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,36 @@ appropriate for the entry or if needed the entire day's listitem. --> + + 2023-08-01 + + + [bdubbs] - Update to vim-9.0.1677. Addresses + #4500. + + + [bdubbs] - Update to openssl-3.1.2. Fixes + #5305. + + + [bdubbs] - Update to man-pages-6.05. Fixes + #5303. + + + [bdubbs] - Update to binutils-2.41. Fixes + #5300. + + + [bdubbs] - Update to gmp-6.3.0. Fixes + #5301. + + + [bdubbs] - Update to glibc-2.38. Fixes + #5302. + + + + 2023-07-28 diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index f40d3b33a..a2e7823da 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -64,9 +64,9 @@ Bc &bc-version; - + @@ -124,12 +124,12 @@ Gettext-&gettext-version; - - + diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml index af4d95429..d2b875a9d 100644 --- a/chapter06/diffutils.xml +++ b/chapter06/diffutils.xml @@ -45,7 +45,9 @@ Prepare Diffutils for compilation: -./configure --prefix=/usr --host=$LFS_TGT + ./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./build-aux/config.guess) Compile the package: diff --git a/chapter06/grep.xml b/chapter06/grep.xml index 1bccd7486..dd942c712 100644 --- a/chapter06/grep.xml +++ b/chapter06/grep.xml @@ -45,8 +45,9 @@ Prepare Grep for compilation: -./configure --prefix=/usr \ - --host=$LFS_TGT + ./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./build-aux/config.guess) Compile the package: diff --git a/chapter06/sed.xml b/chapter06/sed.xml index b3e39c215..b297afedd 100644 --- a/chapter06/sed.xml +++ b/chapter06/sed.xml @@ -45,8 +45,9 @@ Prepare Sed for compilation: -./configure --prefix=/usr \ - --host=$LFS_TGT + ./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./build-aux/config.guess) Compile the package: diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index cf1c4f895..c35bf136e 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -145,6 +145,8 @@ cd build and options are passed to GCC. + Three tests in the gprofng suite are also known to fail. + Install the package: make tooldir=/usr install diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 4245b0ff4..a1f23a96b 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -166,10 +166,12 @@ esac is known to fail in the LFS chroot environment. + diff --git a/chapter08/gmp.xml b/chapter08/gmp.xml index 01dace92f..05e16722a 100644 --- a/chapter08/gmp.xml +++ b/chapter08/gmp.xml @@ -110,7 +110,7 @@ make html instruction". In this case, gmp should be reconfigured with the option and rebuilt. - Ensure that all 197 tests in the test suite passed. + Ensure that all 199 tests in the test suite passed. Check the results by issuing the following command: awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml index 70e0d6ebb..9e71f4382 100644 --- a/chapter08/stripping.xml +++ b/chapter08/stripping.xml @@ -88,7 +88,7 @@ done online_usrbin="bash find strip" online_usrlib="libbfd-&binutils-version;.so - libsframe.so.0.0.0 + libsframe.so.&libsframe-version; libhistory.so.&readline-soversion; libncursesw.so.&ncurses-version; libm.so.6 diff --git a/packages.ent b/packages.ent index 66e7314ab..ac08d20a8 100644 --- a/packages.ent +++ b/packages.ent @@ -66,10 +66,10 @@ - - + + - + @@ -77,6 +77,7 @@ + @@ -256,20 +257,20 @@ - - + + - + - - + + - + @@ -477,10 +478,10 @@ - - + + - + @@ -535,10 +536,10 @@ - - + + - + @@ -726,13 +727,13 @@ - + - + - + From 8ada78d73e3bb15ad193dee84b830e3d8cf64cea Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 2 Aug 2023 10:37:52 +0800 Subject: [PATCH 19/34] binutils: gprofng man pages are OK now --- chapter08/binutils.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index c35bf136e..5ff11a755 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -151,10 +151,9 @@ cd build make tooldir=/usr install - Remove useless static libraries and an empty man page: + Remove useless static libraries: -rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a -rm -fv /usr/share/man/man1/{gprofng,gp-*}.1 +rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a From 7a8fcc39182cf2c556f9a738f0f3fe6e39cd0737 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 2 Aug 2023 10:54:44 +0800 Subject: [PATCH 20/34] glibc: Remove sed and option unneeded with 2.38 --disable-crypt is now the default, and the security fix for 2.37 is included. --- chapter05/glibc.xml | 1 - chapter08/glibc.xml | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 7fb5e98c5..14f1fac6c 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -91,7 +91,6 @@ cd build --build=$(../scripts/config.guess) \ --enable-kernel=&min-kernel; \ --with-headers=$LFS/usr/include \ - --disable-crypt \ libc_cv_slibdir=/usr/lib diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index a1f23a96b..791a6b707 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -50,16 +50,6 @@ patch -Np1 -i ../&glibc-fhs-patch; - - Fix a security issue identified upstream: - -sed '/width -=/s/workend - string/number_length/' \ - -i stdio-common/vfprintf-process-arg.c - The Glibc documentation recommends building Glibc in a dedicated build directory: @@ -79,7 +69,6 @@ cd build --enable-kernel=&min-kernel; \ --enable-stack-protector=strong \ --with-headers=/usr/include \ - --disable-crypt \ libc_cv_slibdir=/usr/lib From f40b2e7be5bba58ee021211e872426262a093000 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 2 Aug 2023 14:02:08 +0800 Subject: [PATCH 21/34] gcc: Document new test failures with Glibc-2.38 Well, the analyzer failures are introduced by literally *my* Glibc change [1] and I'll sort them out for GCC 14... And the ASAN failures seem caused by the introduction of __isoc23_strtol (the libsanitizer does not know to intercept it). I'll test with LLVM once I reach it in BLFS (LLVM is the upstream of libsanitizer) and make a bug report. limits-exprparen.c also fails to me, it needs "ulimit -s 65536" instead of "ulimit -s 32768" in my build but maybe it's caused by my custom *FLAGS. [1]:https://sourceware.org/git/?p=glibc.git;a=commit;h=71d9e0fe766a --- chapter08/gcc.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index bb22fbca5..0c4f591f2 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -184,6 +184,16 @@ su tester -c "PATH=$PATH make -k check" vect directory are known to fail if the hardware does not support AVX. + + With Glibc-2.38, the analyzer tests named + data-model-4.c and + conftest-1.c are known to fail. + In the asan tests, the subtest named + AddressSanitizer_StrtolOOBTest in the test + asan_test.C and the test named + interception-malloc-test-1.C are known to fail. + + A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. Unless the test results are vastly different from those at the above URL, From e65bfc4f69efeae0d18c0158b2050c045b724239 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 2 Aug 2023 18:54:42 +0800 Subject: [PATCH 22/34] procps: The "free with commit" test failure is fixed now Link: https://gitlab.com/procps-ng/procps/-/commit/414e33a8afb6 --- chapter08/procps.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/chapter08/procps.xml b/chapter08/procps.xml index e17d199ca..20a6be096 100644 --- a/chapter08/procps.xml +++ b/chapter08/procps.xml @@ -83,16 +83,6 @@ make check make check - - One test named free with commit - may fail if some applications with a custom memory allocator (for - example, JVM and Web browsers) are running on the host distro. - Install the package: make install From c7c6c1548a055aeba377ab2ec1dd100042b91da7 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 2 Aug 2023 19:06:09 +0800 Subject: [PATCH 23/34] kernel: systemd: FW_LOADER_USER_HELPER should be n, not y --- chapter10/kernel/systemd.toml | 2 +- chapter10/kernel/systemd.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter10/kernel/systemd.toml b/chapter10/kernel/systemd.toml index 936c50492..26ac61c46 100644 --- a/chapter10/kernel/systemd.toml +++ b/chapter10/kernel/systemd.toml @@ -21,7 +21,7 @@ NET='*' INET='*' IPV6='*' FW_LOADER=' *' -FW_LOADER_USER_HELPER='*' +FW_LOADER_USER_HELPER=' ' DMIID='*' INOTIFY_USER='*' TMPFS='*' diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml index 4c57776c2..6705fdd35 100644 --- a/chapter10/kernel/systemd.xml +++ b/chapter10/kernel/systemd.xml @@ -36,7 +36,7 @@ ... [DEVTMPFS_MOUNT] Firmware loader ---> < /*> Firmware loading facility [FW_LOADER] - [*] Enable the firmware sysfs fallback mechanism + [ ] Enable the firmware sysfs fallback mechanism ... [FW_LOADER_USER_HELPER] Firmware Drivers ---> [*] Export DMI identification via sysfs to userspace [DMIID] From 264a80d60fe1938d94718c6e3f353c5e4e27e1cb Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 3 Aug 2023 10:10:11 +0800 Subject: [PATCH 24/34] udev: Use --no-same-owner for man pages, like systemd By the way, fix a minor formatting issue in udev-hwdb.8. --- chapter08/udev.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chapter08/udev.xml b/chapter08/udev.xml index 67e835afc..35bb12f46 100644 --- a/chapter08/udev.xml +++ b/chapter08/udev.xml @@ -147,11 +147,12 @@ make -f &udev-lfs-version;/Makefile.lfs install -tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz --strip-components=1 \ +tar -xf ../../systemd-man-pages-&systemd-man-version;.tar.xz \ + --no-same-owner --strip-components=1 \ -C /usr/share/man --wildcards '*/udev*' '*/libudev*' \ '*/systemd-'{hwdb,udevd.service}.8 -sed 's/systemd\(\\\?-\)/udev-/' /usr/share/man/man8/systemd-hwdb.8 \ - > /usr/share/man/man8/udev-hwdb.8 +sed 's/systemd\(\\\?-\)/udev\1/' /usr/share/man/man8/systemd-hwdb.8 \ + > /usr/share/man/man8/udev-hwdb.8 sed 's|lib.*udevd|sbin/udevd|' \ /usr/share/man/man8/systemd-udevd.service.8 \ > /usr/share/man/man8/udevd.8 From 308ec7a37ffbf0d8fb43dcd897c44df69daa5ca3 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 3 Aug 2023 15:07:06 +0800 Subject: [PATCH 25/34] dbus: Add --enable-user-session like BLFS This will install dbus.service and dbus.socket into /usr/lib/systemd/user. In a base LFS installation the systemd per-user daemon is not usable at all, so they may seem useless. But if we install them, we can start to use them once systemd is rebuilt with PAM in BLFS (without rebuilding dbus). --- chapter08/dbus.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/chapter08/dbus.xml b/chapter08/dbus.xml index f59dd122b..62200fc27 100644 --- a/chapter08/dbus.xml +++ b/chapter08/dbus.xml @@ -52,6 +52,7 @@ --sysconfdir=/etc \ --localstatedir=/var \ --runstatedir=/run \ + --enable-user-session \ --disable-static \ --disable-doxygen-docs \ --disable-xml-docs \ @@ -73,6 +74,18 @@ + + + --enable-user-session + + + These 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. + + + Compile the package: From 2ce66c4197c41ce73f095a36892e420f0c13f3c2 Mon Sep 17 00:00:00 2001 From: Thomas Trepl Date: Thu, 3 Aug 2023 12:27:16 +0200 Subject: [PATCH 26/34] Remove shasum (automake is the only one pkg were a sha sum is presented). Remove it for consistency --- chapter03/packages.xml | 1 - packages.ent | 1 - 2 files changed, 2 deletions(-) diff --git a/chapter03/packages.xml b/chapter03/packages.xml index 4db7bb5a1..dba151cac 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -62,7 +62,6 @@ Home page: Download: MD5 sum: &automake-md5; - SHA256 sum: &automake-sha256; diff --git a/packages.ent b/packages.ent index ac08d20a8..e87b49588 100644 --- a/packages.ent +++ b/packages.ent @@ -43,7 +43,6 @@ - From 2d6ced8aec6d7e8691bb2e3b04ed6fc2bb0d8322 Mon Sep 17 00:00:00 2001 From: Anton Mosich Date: Thu, 3 Aug 2023 15:47:57 +0200 Subject: [PATCH 27/34] Fix small typos --- chapter04/settingenviron.xml | 2 +- obfuscate.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index d801aa9ab..b255a4b45 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -104,7 +104,7 @@ EOF - LFS_TGT=(uname -m)-lfs-linux-gnu + LFS_TGT=$(uname -m)-lfs-linux-gnu The LFS_TGT variable sets a non-default, but compatible machine description for use when building our cross-compiler and linker and when diff --git a/obfuscate.sh b/obfuscate.sh index dd2bf24d2..a01cc58b6 100644 --- a/obfuscate.sh +++ b/obfuscate.sh @@ -4,7 +4,7 @@ # obfuscate email addresses in XML/HTML # Script written (and slight perl modification) by Archaic # Modified from "sed -i" to old style "sed -e" by Manuel Canales -# to prevent hangs on very long files, like nonckunked books. +# to prevent hangs on very long files, like nonchunked books. # Original Perl expression by Anderson Lizardo # Released under the GNU General Public License # From 67ca5ef3f788e952e04f142808193b9504afc468 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Thu, 3 Aug 2023 13:13:16 -0500 Subject: [PATCH 28/34] Add insmod part_gpt to example grub.cfg --- chapter10/grub.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/chapter10/grub.xml b/chapter10/grub.xml index f3ffc8ab8..965fa56c3 100644 --- a/chapter10/grub.xml +++ b/chapter10/grub.xml @@ -141,6 +141,7 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso Date: Mon, 7 Aug 2023 23:00:42 +0800 Subject: [PATCH 29/34] dbus: Fix a typo (misusing plural) --- chapter08/dbus.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter08/dbus.xml b/chapter08/dbus.xml index 62200fc27..8ab4744ad 100644 --- a/chapter08/dbus.xml +++ b/chapter08/dbus.xml @@ -79,7 +79,7 @@ --enable-user-session - These ensures the D-Bus per-user service and socket unit + 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. From 9b7d651a54314b80138f1254a64005e6b7e95e53 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Mon, 7 Aug 2023 15:46:36 -0500 Subject: [PATCH 30/34] Package updates. Update to xz-5.4.4. Update to wheel-0.41.1 (Python Module). Update to man-pages-6.05.01. Update to linux-6.4.8. Update to iana-etc-20230804. Update to pkgconf 2.0.0. --- chapter01/changelog.xml | 29 +++++++++++++++++++++++++++++ chapter01/whatsnew.xml | 9 ++++++--- chapter08/pkgconf.xml | 8 ++++++++ packages.ent | 34 +++++++++++++++++----------------- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index caf35cc90..df8af5973 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -39,6 +39,35 @@ or as appropriate for the entry or if needed the entire day's listitem. --> + + 2023-08-07 + + + [bdubbs] - Update to xz-5.4.4. Fixes + #5307. + + + [bdubbs] - Update to wheel-0.41.1 (Python Module). Fixes + #5311. + + + [bdubbs] - Update to man-pages-6.05.01. Fixes + #5306. + + + [bdubbs] - Update to linux-6.4.8. Fixes + #5309. + + + [bdubbs] - Update to iana-etc-20230804. Addresses + #5006. + + + [rahul] - Update to pkgconf 2.0.0. Fixes + #5310. + + + 2023-08-01 diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index a2e7823da..4b95515cc 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -226,6 +226,9 @@ + + pkgconf-&pkgconf-version; + Perl-&perl-version; @@ -280,9 +283,9 @@ - + @@ -321,7 +324,7 @@ - Pkgconf-&flit-core-version; + Pkgconf-&pkgconf-version; diff --git a/chapter08/pkgconf.xml b/chapter08/pkgconf.xml index 724a1ff24..8c1031b14 100644 --- a/chapter08/pkgconf.xml +++ b/chapter08/pkgconf.xml @@ -41,8 +41,16 @@ + Installation of Pkgconf + Pkgconf 2.0.0 explicitly errors when attempting to run + --modversion with multiple packages. This breaks many + packages in BLFS. Run this sed to reinstate the old + output for pkgconf. + + sed -i '/1330,1336/s|^|//|' cli/main.c + Prepare Pkgconf for compilation: ./configure --prefix=/usr \ diff --git a/packages.ent b/packages.ent index e87b49588..59797bed2 100644 --- a/packages.ent +++ b/packages.ent @@ -318,10 +318,10 @@ - + - + @@ -433,12 +433,12 @@ - + - + - + - - pkgconf-&pkgconf-version; - + Perl-&perl-version; From 70b20e7c25088c5bc42bcb176f0dff4d9b1a552f Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 8 Aug 2023 08:31:33 +0800 Subject: [PATCH 32/34] changelog: Use a dash before pkgconf version number To be consistent will all other entries. --- chapter01/changelog.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index df8af5973..5f0b0a98c 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -63,7 +63,7 @@ #5006. - [rahul] - Update to pkgconf 2.0.0. Fixes + [rahul] - Update to pkgconf-2.0.0. Fixes #5310. @@ -253,7 +253,7 @@ #5273. - [rahul] - Changed from pkg-config to pkgconf 1.9.5. Fixes + [rahul] - Changed from pkg-config to pkgconf-1.9.5. Fixes #5274. From f4835ed6ad3d808c4f06cd109e657120e8f22fb5 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 8 Aug 2023 08:35:21 +0800 Subject: [PATCH 33/34] pkgconf: Reword the reason of sed Specifying --modversion with multiple packages just does not make sense. The real problem here is it's erroring out even if the multiple arguments are for the same package. --- chapter08/pkgconf.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chapter08/pkgconf.xml b/chapter08/pkgconf.xml index 8c1031b14..7a9569178 100644 --- a/chapter08/pkgconf.xml +++ b/chapter08/pkgconf.xml @@ -44,10 +44,11 @@ Installation of Pkgconf - Pkgconf 2.0.0 explicitly errors when attempting to run - --modversion with multiple packages. This breaks many - packages in BLFS. Run this sed to reinstate the old - output for pkgconf. + Pkgconf-2.0.0 explicitly errors when attempting to run + with multiple arguments, even if these + arguments are constraints for the same package. This breaks many + packages in BLFS. Run this sed to reinstate the old + output for pkgconf: sed -i '/1330,1336/s|^|//|' cli/main.c From 9cca53dcac7a29b471491be27076cfcc06f21921 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 8 Aug 2023 11:12:36 +0800 Subject: [PATCH 34/34] kernel: Fix move-if-changed logic and regenerate with 6.4.8 --- chapter10/kernel/Makefile | 8 ++++++-- chapter10/kernel/kernel.version | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chapter10/kernel/Makefile b/chapter10/kernel/Makefile index d02408dcc..e04d2d6b1 100644 --- a/chapter10/kernel/Makefile +++ b/chapter10/kernel/Makefile @@ -8,10 +8,14 @@ endif all: $(OUTPUT) kernel.version: s-kernel-version; @true -s-kernel-version: Makefile kernel_version.py + +.PHONY: s-kernel-version +s-kernel-version: ./kernel_version.py $(KERNEL_TREE) > tmp-kernel.version - if ! diff tmp-kernel.version $@ 2>/dev/null >/dev/null; then \ + if ! diff tmp-kernel.version kernel.version ; then \ mv tmp-kernel.version kernel.version; \ + else \ + rm tmp-kernel.version; \ fi touch s-kernel-version diff --git a/chapter10/kernel/kernel.version b/chapter10/kernel/kernel.version index 3c43d7159..4b20d9700 100644 --- a/chapter10/kernel/kernel.version +++ b/chapter10/kernel/kernel.version @@ -1 +1 @@ -6.4.7 +6.4.8