From 779b798e5fd717b603d34c882d0faf563ef0ffe6 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Thu, 2 Mar 2023 16:00:48 +0800 Subject: [PATCH 01/10] whatsnew: Comment out all entries for a new release --- chapter01/whatsnew.xml | 200 ++++++++++++++++++++--------------------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index bf69cb08f..fcd286f79 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -46,15 +46,15 @@ - + + + @@ -70,57 +70,57 @@ - + + + - + - + - + - + + - + @@ -130,18 +130,18 @@ - + + - + @@ -151,63 +151,63 @@ - + - + + + - + - + + + + + + + + + + @@ -217,66 +217,66 @@ - + + + + + + - + + - + + + - + + - + + + - + - + - + Removed: - + From 140e9a445dd1321d5bb617a1058c3a1ccd0a5953 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sat, 4 Mar 2023 16:26:31 -0600 Subject: [PATCH 02/10] q --- chapter02/hostreqs.xml | 138 ++++++++++++++++++++++------------------- general.ent | 6 +- 2 files changed, 78 insertions(+), 66 deletions(-) diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml index 52ccc97ed..d8e6f06d2 100644 --- a/chapter02/hostreqs.xml +++ b/chapter02/hostreqs.xml @@ -165,78 +165,90 @@ the ability to compile programs, run the following commands: cat > version-check.sh << "EOF" -#!/bin/bash -# Simple script to list version numbers of critical development tools -export LC_ALL=C -bash --version | head -n1 | cut -d" " -f2-4 -MYSH=$(readlink -f /bin/sh) -echo "/bin/sh -> $MYSH" -echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash" -unset MYSH + #!/bin/bash +# A script to list version numbers of critical development tools -echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- -bison --version | head -n1 +# If you have tools installed in other directories, adjust PATH here AND +# in ~lfs/.bashrc (section 4.4) as well. -if [ -h /usr/bin/yacc ]; then - echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`"; -elif [ -x /usr/bin/yacc ]; then - echo yacc is `/usr/bin/yacc --version | head -n1` -else - echo "yacc not found" -fi +LC_ALL=C +PATH=/usr/bin:/bin -echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 -diff --version | head -n1 -find --version | head -n1 -gawk --version | head -n1 +bail() { echo "FATAL: $1"; exit 1; } +grep --version > /dev/null 2> /dev/null || bail "grep does not work" +sed '' /dev/null || bail "sed does not work" +sort /dev/null || bail "sort does not work" -if [ -h /usr/bin/awk ]; then - echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`"; -elif [ -x /usr/bin/awk ]; then - echo awk is `/usr/bin/awk --version | head -n1` -else - echo "awk not found" -fi +ver_check() +{ + if ! type -p $2 &>/dev/null + then + echo "ERROR: Cannot find $2 ($1)"; return 1; + fi + v=$($2 --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+' | head -n1) + if printf '%s\n' $3 $v | sort --version-sort --check &>/dev/null + then + printf "OK: %-9s %-6s >= $3\n" "$1" "$v"; return 0; + else + printf "ERROR: %-9s is TOO OLD ($3 or later required)\n" "$1"; + return 1; + fi +} -gcc --version | head -n1 -g++ --version | head -n1 -grep --version | head -n1 -gzip --version | head -n1 -cat /proc/version -m4 --version | head -n1 -make --version | head -n1 -patch --version | head -n1 -echo Perl `perl -V:version` -python3 --version -sed --version | head -n1 -tar --version | head -n1 -makeinfo --version | head -n1 # texinfo version -xz --version | head -n1 +ver_kernel() +{ + kver=$(uname -r | sed -E 's/^([0-9\.]+).*/\1/') + if printf '%s\n' $1 $kver | sort --version-sort --check &>/dev/null + then + printf "OK: Linux Kernel $kver >= $1\n"; return 0; + else + printf "ERROR: Linux Kernel ($kver) is TOO OLD ($1 or later required)\n" "$kver"; + return 1; + fi +} -echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c -if [ -x dummy ] - then echo "g++ compilation OK"; - else echo "g++ compilation failed"; fi -rm -f dummy.c dummy +# Coreutils first because-sort needs Coreutils >= 7.0 +ver_check Coreutils sort 7.0 || bail "--version-sort unsupported" +ver_check Bash bash 3.2 +ver_check Binutils ld 2.13.1 +ver_check Bison bison 2.7 +ver_check Diffutils diff 2.8.1 +ver_check Findutils find 4.2.31 +ver_check Gawk gawk 4.0.1 +ver_check GCC gcc 5.1 +ver_check "GCC (C++)" g++ 5.1 +ver_check Grep grep 2.6.1 +ver_check Gzip gzip 1.3.12 +ver_check M4 m4 1.4.10 +ver_check Make make 4.0 +ver_check Patch patch 2.5.4 +ver_check Perl perl 5.8.8 +ver_check Python python3 3.4 +ver_check Sed sed 4.1.5 +ver_check Tar tar 1.22 +ver_check Texinfo texi2any 4.7 +ver_check Xz xz 5.0.0 +#ver_check "Linux Kernel" "" 3.2 'cat /proc/version' +ver_kernel 3.2 + +alias_check() { + if $1 --version 2>&1 | grep -qi $2 + then printf "OK: %-4s is $2\n" "$1"; + else printf "ERROR: %-4s is NOT $2\n" "$1"; fi +} +echo "Aliases:" +alias_check awk GNU +alias_check yacc Bison +alias_check sh Bash + +echo "Compiler check" +if printf "int main(){}" | g++ -x c++ - +then echo "OK: g++ works"; +else echo "ERROR: g++ does NOT work"; fi +rm -f a.out EOF bash version-check.sh - diff --git a/general.ent b/general.ent index ee5fd35db..1cc9fe030 100644 --- a/general.ent +++ b/general.ent @@ -7,10 +7,10 @@ - - + + - + From 73e2b9c18912272c98a502deb4d327377334b7e4 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sat, 4 Mar 2023 16:29:00 -0600 Subject: [PATCH 03/10] Add a changelog entry. --- chapter01/changelog.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index d9d2b1558..9b388342a 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -39,6 +39,15 @@ or as appropriate for the entry or if needed the entire day's listitem. --> + + 2023-03-04 + + + [bdubbs] - Change to a better host requirements script in Chapter 2. + + + + 2023-03-01 From b789d881957ec03daee8455a49953f5645ae080a Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Mar 2023 10:01:40 +0800 Subject: [PATCH 04/10] hostreq: Minor script adjustment - Remove an extra whitespace breaking shebang (though our instruction does not use the shebang). - Adjust the regex to allow several letters after the version number, and match grep version to the text. - Raise Coreutils to 7.0 (for the host requirement script itself). It was released in 2008 so I don't think it's a problem. - Add a colon after the text "Compiler check" to match "Aliases:". - Use grep -o instead of sed to make kernel version check simpler. --- chapter02/hostreqs.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml index d8e6f06d2..6c74986a0 100644 --- a/chapter02/hostreqs.xml +++ b/chapter02/hostreqs.xml @@ -55,7 +55,7 @@ - Coreutils-6.9 + Coreutils-7.0 @@ -165,7 +165,7 @@ the ability to compile programs, run the following commands: cat > version-check.sh << "EOF" - #!/bin/bash +#!/bin/bash # A script to list version numbers of critical development tools # If you have tools installed in other directories, adjust PATH here AND @@ -185,7 +185,7 @@ ver_check() then echo "ERROR: Cannot find $2 ($1)"; return 1; fi - v=$($2 --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+' | head -n1) + v=$($2 --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+[a-z]*' | head -n1) if printf '%s\n' $3 $v | sort --version-sort --check &>/dev/null then printf "OK: %-9s %-6s >= $3\n" "$1" "$v"; return 0; @@ -197,7 +197,7 @@ ver_check() ver_kernel() { - kver=$(uname -r | sed -E 's/^([0-9\.]+).*/\1/') + kver=$(uname -r | grep -E -o '[0-9\.]+') if printf '%s\n' $1 $kver | sort --version-sort --check &>/dev/null then printf "OK: Linux Kernel $kver >= $1\n"; return 0; @@ -217,7 +217,7 @@ ver_check Findutils find 4.2.31 ver_check Gawk gawk 4.0.1 ver_check GCC gcc 5.1 ver_check "GCC (C++)" g++ 5.1 -ver_check Grep grep 2.6.1 +ver_check Grep grep 2.5.1a ver_check Gzip gzip 1.3.12 ver_check M4 m4 1.4.10 ver_check Make make 4.0 @@ -241,7 +241,7 @@ alias_check awk GNU alias_check yacc Bison alias_check sh Bash -echo "Compiler check" +echo "Compiler check:" if printf "int main(){}" | g++ -x c++ - then echo "OK: g++ works"; else echo "ERROR: g++ does NOT work"; fi From 770e78952755c89d4a68d22e5245a97438ffa089 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Mar 2023 10:06:48 +0800 Subject: [PATCH 05/10] Package updates - Update to systemd-253 - Update to bc-6.3.1 - Update to linux-6.2.2 - Update to procps-ng-4.0.3 - Update to iproute2-6.2.0 - Update to meson-1.0.1 - Update to make-4.4.1 - Update to elfutils-0.189 --- appendices/dependencies.xml | 5 ++-- chapter01/changelog.xml | 32 +++++++++++++++++++++ chapter01/whatsnew.xml | 38 ++++++++++++------------- chapter03/patches.xml | 4 +-- chapter06/make.xml | 6 ---- chapter08/make.xml | 6 ---- chapter08/systemd.xml | 6 ---- packages.ent | 56 ++++++++++++++++++------------------- patches.ent | 4 +-- 9 files changed, 86 insertions(+), 71 deletions(-) diff --git a/appendices/dependencies.xml b/appendices/dependencies.xml index 697d0d1d7..e97588da3 100644 --- a/appendices/dependencies.xml +++ b/appendices/dependencies.xml @@ -1685,7 +1685,7 @@ &dependencies; - Bash, Binutils, Coreutils, GCC, Glibc, and Make + Bash, Binutils, Coreutils, GCC, Glibc, Make, and Zstd @@ -3282,7 +3282,8 @@ &before; - GCC and Systemd + GCC and Libelf + GCC, Libelf, and Systemd diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 9b388342a..97b342299 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -42,6 +42,38 @@ 2023-03-04 + + [xry111] - Update to systemd-253. Fixes + #5206. + + + [xry111] - Update to bc-6.3.1. Fixes + #5217. + + + [xry111] - Update to linux-6.2.2. Fixes + #5218. + + + [xry111] - Update to procps-ng-4.0.3. Fixes + #5220. + + + [xry111] - Update to iproute2-6.2.0. Fixes + #5221. + + + [xry111] - Update to meson-1.0.1. Fixes + #5222. + + + [xry111] - Update to make-4.4.1. Fixes + #5223. + + + [xry111] - Update to libelf-0.189. Fixes + #5224. + [bdubbs] - Change to a better host requirements script in Chapter 2. diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index fcd286f79..21722a863 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -49,9 +49,9 @@ - + @@ -139,9 +139,9 @@ - + @@ -160,9 +160,9 @@ - + @@ -172,15 +172,15 @@ - + - + @@ -190,9 +190,9 @@ - + @@ -217,9 +217,9 @@ - + @@ -238,9 +238,9 @@ - + @@ -309,9 +309,9 @@ Removed: - + + systemd-252-security_fix-1.patch + diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 44367898f..5f1bbf0c2 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -143,7 +143,7 @@ - + - + + - + @@ -342,10 +342,10 @@ - - + + - + @@ -423,13 +423,13 @@ - - + + - + - + - + - + - - + + - + diff --git a/patches.ent b/patches.ent index c381cd0a8..7c0009583 100644 --- a/patches.ent +++ b/patches.ent @@ -89,11 +89,11 @@ - + To test the results, issue: -make check +chown -Rv tester . +su tester -c "PATH=$PATH make check" Install the package: From f54b8be70f5a23d26b6b47fff21d38b87c28f8e9 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Mar 2023 11:09:11 +0800 Subject: [PATCH 07/10] dependencies: List bzip2, xz, and zlib as libelf dependencies libelf.so links to libbz2.so.1.0, liblzma.so.5, and libz.so.1. libz is really used, but to me liblzma and libbz2 are "unneeded dependencies": the building system apparently thinks they are needed by zstd but actually not. I don't want to "fix the upstream" so just list them here anyway. --- appendices/dependencies.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/appendices/dependencies.xml b/appendices/dependencies.xml index e97588da3..a1efa3d01 100644 --- a/appendices/dependencies.xml +++ b/appendices/dependencies.xml @@ -387,7 +387,7 @@ &before; - File + File and Libelf @@ -1685,14 +1685,15 @@ &dependencies; - Bash, Binutils, Coreutils, GCC, Glibc, Make, and Zstd + Bash, Binutils, Bzip2, Coreutils, GCC, Glibc, Make, Xz, + Zlib, and Zstd &runtime; - Glibc and Zlib + Bzip2, Glibc, Xz, Zlib, and Zstd @@ -3205,7 +3206,7 @@ &before; Eudev, File, GRUB, Kmod, - and Man-DBand Man-DB, and Systemd @@ -3244,7 +3245,7 @@ &before; - File, Kmod, Perl, and Util-linux + File, Kmod, Libelf, Perl, and Util-linux From e2469c5a80e86a2125ed7fb5e2fd9662aea3d877 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Mar 2023 13:01:04 +0800 Subject: [PATCH 08/10] changelog: Mark linux-6.2.2 a security update --- chapter01/changelog.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 97b342299..20cf06f58 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -51,7 +51,7 @@ #5217. - [xry111] - Update to linux-6.2.2. Fixes + [xry111] - Update to linux-6.2.2 (security fixes). Fixes #5218. From 82d6a570b4a36fa27c21b3ee05c73c5ee1d7f78c Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 1 Mar 2023 11:55:23 +0800 Subject: [PATCH 09/10] libelf: Remove run-native-test failure It's fixed in 0.189. (cherry picked from commit 4fd9716e1563b70f149b53f0bd22a4aced1115c9) --- chapter08/libelf.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/chapter08/libelf.xml b/chapter08/libelf.xml index 739dffb46..dab277dc6 100644 --- a/chapter08/libelf.xml +++ b/chapter08/libelf.xml @@ -58,10 +58,6 @@ make check - - The test named run-native-test.sh is known to - fail. - Install only Libelf: make -C libelf install From 2efe1e81902ea8f1d4bf3b88864e1f9ac4bcdba3 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 5 Mar 2023 15:20:24 +0800 Subject: [PATCH 10/10] systemd: Document systemd-ac-power It has been moved to /usr/bin for general use by upstream, so list it in programs. --- chapter08/systemd.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml index 6c844c603..fcac04602 100644 --- a/chapter08/systemd.xml +++ b/chapter08/systemd.xml @@ -223,7 +223,7 @@ meson --prefix=/usr \ machinectl, 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-analyze, + (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-dissect, systemd-escape, systemd-hwdb, systemd-id128, @@ -476,6 +476,17 @@ meson --prefix=/usr \ + + systemd-ac-power + + Reports whether the system is connected to an external + power source. + + systemd-ac-power + + + + systemd-analyze