aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chapter01/changelog.xml28
-rw-r--r--chapter01/whatsnew.xml12
-rw-r--r--chapter02/hostreqs.xml49
-rw-r--r--chapter03/patches.xml12
-rw-r--r--chapter04/addinguser.xml5
-rw-r--r--chapter04/creatingminlayout.xml8
-rw-r--r--chapter05/gcc-pass1.xml12
-rw-r--r--chapter05/glibc.xml17
-rw-r--r--chapter06/gcc-pass2.xml12
-rw-r--r--chapter06/m4.xml4
-rw-r--r--chapter06/patch.xml4
-rw-r--r--chapter07/changingowner.xml5
-rw-r--r--chapter08/acl.xml4
-rw-r--r--chapter08/attr.xml4
-rw-r--r--chapter08/binutils.xml32
-rw-r--r--chapter08/check.xml4
-rw-r--r--chapter08/expect.xml4
-rw-r--r--chapter08/flex.xml4
-rw-r--r--chapter08/gcc.xml53
-rw-r--r--chapter08/gdbm.xml4
-rw-r--r--chapter08/grub.xml30
-rw-r--r--chapter08/libcap.xml3
-rw-r--r--chapter08/libelf.xml5
-rw-r--r--chapter08/libffi.xml4
-rw-r--r--chapter08/openssl.xml1
-rw-r--r--chapter08/patch.xml4
-rw-r--r--chapter08/stripping.xml4
-rw-r--r--chapter08/systemd.xml1
-rw-r--r--chapter08/udev.xml1
-rw-r--r--chapter08/util-linux.xml28
-rw-r--r--chapter10/grub.xml127
-rw-r--r--chapter10/kernel.xml51
-rw-r--r--chapter10/kernel/highmem.toml1
-rw-r--r--chapter10/kernel/highmem.xml8
-rwxr-xr-xchapter10/kernel/kernel-config.py5
-rw-r--r--chapter10/kernel/kernel.version2
-rw-r--r--chapter10/kernel/systemd.toml2
-rw-r--r--chapter10/kernel/systemd.xml8
-rw-r--r--chapter10/kernel/sysv.toml2
-rw-r--r--chapter10/kernel/sysv.xml9
-rw-r--r--chapter10/kernel/x2apic.toml5
-rw-r--r--chapter10/kernel/x2apic.xml13
-rw-r--r--general.ent15
-rwxr-xr-xgit-version.sh2
-rw-r--r--packages.ent8
-rw-r--r--patches.ent3
-rw-r--r--prologue/architecture.xml42
-rw-r--r--prologue/bookinfo.xml2
48 files changed, 365 insertions, 298 deletions
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 624ce61e6..35e720215 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -256,6 +256,15 @@
<para>2023-07-02</para>
<itemizedlist>
<listitem>
+ <para>[xry111] - Update to grub-2.12~rc1.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>2023-07-02</para>
+ <itemizedlist>
+ <listitem>
<para>[xry111] - Add libxcrypt-4.4.35. Fixes
<ulink url='&lfs-ticket-root;5280'>#5280</ulink>.</para>
</listitem>
@@ -301,6 +310,15 @@
</listitem>
<listitem>
+ <para>2023-06-20</para>
+ <itemizedlist>
+ <listitem>
+ <para>[xry111] - Patch libelf for LoongArch support.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
<para>2023-06-17</para>
<itemizedlist>
<listitem>
@@ -319,6 +337,16 @@
</listitem>
<listitem>
+ <para>2023-06-11</para>
+ <itemizedlist>
+ <listitem>
+ <para>[xry111] - Update to grub-2.11-pre-gc016a969d for
+ LoongArch support.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
<para>2023-06-09</para>
<itemizedlist>
<listitem revision='systemd'>
diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml
index aba1f0428..328b35c70 100644
--- a/chapter01/whatsnew.xml
+++ b/chapter01/whatsnew.xml
@@ -139,9 +139,9 @@
<listitem>
<para>Groff-&groff-version;</para>
</listitem>
- <!--<listitem>
+ <listitem>
<para>GRUB-&grub-version;</para>
- </listitem>-->
+ </listitem>
<!--<listitem>
<para>Gzip-&gzip-version;</para>
</listitem>-->
@@ -328,6 +328,10 @@
</listitem>
<listitem>
+ <para>&elfutils-loongarch-patch;</para>
+ </listitem>
+
+ <listitem>
<para>Flit-core-&flit-core-version;</para>
</listitem>
@@ -357,6 +361,10 @@
</listitem>
<listitem>
+ <para>grub-2.06-upstream_fixes-1.patch</para>
+ </listitem>
+
+ <listitem>
<para>Pkg-config-0.29.2</para>
</listitem>
diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml
index e2fbce07b..291eaace4 100644
--- a/chapter02/hostreqs.xml
+++ b/chapter02/hostreqs.xml
@@ -44,7 +44,7 @@
</listitem>
<listitem>
- <para><emphasis role="strong">Binutils-2.13.1</emphasis> (Versions
+ <para><emphasis role="strong">Binutils-2.38</emphasis> (Versions
greater than &binutils-version; are not recommended as they have
not been tested)</para>
</listitem>
@@ -72,7 +72,7 @@
</listitem>
<listitem>
- <para><emphasis role="strong">GCC-5.1</emphasis> including the C++
+ <para><emphasis role="strong">GCC-12.2</emphasis> including the C++
compiler, <command>g++</command> (Versions greater than &gcc-version; are
not recommended as they have not been tested). C and C++ standard
libraries (with headers) must also be present so the C++ compiler can
@@ -93,20 +93,31 @@
<para>The reason for the kernel version requirement is that we specify
that version when building <application>glibc</application> in
<xref linkend="chapter-cross-tools"/> and
- <xref linkend="chapter-building-system"/>, so the workarounds for
- older kernels are not enabled and the compiled
- <application>glibc</application> is slightly faster and smaller.
- As at June 2023, &min-kernel; is the oldest kernel release still
- supported by the kernel developers.</para>
-
- <para>If the host kernel is earlier than &min-kernel; you will need to replace
- the kernel with a more up-to-date version. There are two ways
- you can go about this. First, see if your Linux vendor provides a &min-kernel;
- or later kernel package. If so, you may wish to install it. If your
- vendor doesn't offer an acceptable kernel package, or you would prefer not to
- install it, you can compile a kernel yourself. Instructions for
- compiling the kernel and configuring the boot loader (assuming the host
- uses GRUB) are located in <xref linkend="chapter-bootable"/>.</para>
+ <xref linkend="chapter-building-system"/>, and
+ &min-kernel; is the oldest kernel release supported by Glibc for
+ LoongArch.</para>
+
+ <important>
+ <para>
+ If a Linux distribution on LoongArch provides a kernel older than
+ &min-kernel;, it indicates the distribution is using a preliminary
+ version of the kernel ABI. The preliminary draft was rejected by
+ the kernel maintainers and it's fundamentally incompatible with
+ the packages we will built for LFS. Such <quote>old-world</quote>
+ distributions (for example, Loongnix) cannot be used as a host
+ distro for building LFS.
+ </para>
+
+ <para>
+ Do not attempt to update the kernel to &min-kernel; or later on
+ a old-world distro because doing so will cause a boot failure.
+ Use a <quote>new-world</quote> distribution providing Linux Kernel
+ &min-kernel; or newer instead. You may need to contact the vendor
+ of your hardware to get a firmware update for booting a new-world
+ distribution because the boot protocol of LoongArch is stabilized
+ after the launch of the early LoongArch hardwares.
+ </para>
+ </important>
<para>We require the host kernel to support UNIX 98 pseudo terminal
(PTY). It should be enabled on all desktop or server distros shipping
@@ -219,13 +230,13 @@ ver_kernel()
# 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 Binutils ld 2.38
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 GCC gcc 12.2
+ver_check "GCC (C++)" g++ 12.2
ver_check Grep grep 2.5.1a
ver_check Gzip gzip 1.3.12
ver_check M4 m4 1.4.10
diff --git a/chapter03/patches.xml b/chapter03/patches.xml
index bbf09ae27..e11974335 100644
--- a/chapter03/patches.xml
+++ b/chapter03/patches.xml
@@ -78,6 +78,14 @@
</varlistentry>
-->
<varlistentry>
+ <term>Elfutils LoongArch Support Patch - <token>&elfutils-loongarch-patch-size;</token>:</term>
+ <listitem>
+ <para>Download: <ulink url="https://www.linuxfromscratch.org/~xry111/lfs/patches/&elfutils-loongarch-patch;"/></para>
+ <para>MD5 sum: <literal>&elfutils-loongarch-patch-md5;</literal></para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>Glibc Memalign Patch - <token>&glibc-memalign-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&glibc-memalign-patch;"/></para>
@@ -92,7 +100,7 @@
<para>MD5 sum: <literal>&glibc-fhs-patch-md5;</literal></para>
</listitem>
</varlistentry>
-
+<!--
<varlistentry>
<term>GRUB Upstream Fixes Patch - <token>&grub-upstream-fixes-patch-size;</token>:</term>
<listitem>
@@ -100,7 +108,7 @@
<para>MD5 sum: <literal>&grub-upstream-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-
+-->
<varlistentry>
<term>Kbd Backspace/Delete Fix Patch - <token>&kbd-backspace-patch-size;</token>:</term>
<listitem>
diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml
index 2db1f756f..3a32fb987 100644
--- a/chapter04/addinguser.xml
+++ b/chapter04/addinguser.xml
@@ -80,10 +80,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
all the directories under <filename class="directory">$LFS</filename> by making
<systemitem class="username">lfs</systemitem> the owner:</para>
-<screen><userinput>chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools}
-case $(uname -m) in
- x86_64) chown -v lfs $LFS/lib64 ;;
-esac</userinput></screen>
+<screen><userinput>chown -v lfs $LFS/{usr{,/*},lib,lib64,var,etc,bin,sbin,tools}</userinput></screen>
<note><para>In some host systems, the following <command>su</command> command does not complete
properly and suspends the login for the &lfs-user; user to the background.
diff --git a/chapter04/creatingminlayout.xml b/chapter04/creatingminlayout.xml
index 90c825577..19919d5c7 100644
--- a/chapter04/creatingminlayout.xml
+++ b/chapter04/creatingminlayout.xml
@@ -21,15 +21,11 @@
<para>Create the required directory layout by issuing the following commands as
<systemitem class="username">root</systemitem>:</para>
-<screen><userinput>mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
+<screen><userinput>mkdir -pv $LFS/{etc,lib64,var} $LFS/usr/{bin,lib,sbin}
for i in bin lib sbin; do
ln -sv usr/$i $LFS/$i
-done
-
-case $(uname -m) in
- x86_64) mkdir -pv $LFS/lib64 ;;
-esac</userinput></screen>
+done</userinput></screen>
<para>Programs in <xref linkend="chapter-temporary-tools"/> will be compiled
with a cross-compiler (more details can be found in section <xref
diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
index 8ca2e92b5..ed8acb1f4 100644
--- a/chapter05/gcc-pass1.xml
+++ b/chapter05/gcc-pass1.xml
@@ -62,15 +62,10 @@ mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
- <para>On x86_64 hosts, set the default directory name for
+ <para>Set the default directory name for
64-bit libraries to <quote>lib</quote>:</para>
-<screen><userinput remap="pre">case $(uname -m) in
- x86_64)
- sed -e '/m64=/s/lib64/lib/' \
- -i.orig gcc/config/i386/t-linux64
- ;;
-esac</userinput></screen>
+<screen><userinput remap="pre">sed 's/lib64/lib/' -i.orig gcc/config/loongarch/{t-linux,linux.h}</userinput></screen>
<para>The GCC documentation recommends building GCC
in a dedicated build directory:</para>
@@ -159,8 +154,7 @@ cd build</userinput></screen>
<varlistentry>
<term><parameter>--disable-multilib</parameter></term>
<listitem>
- <para>On x86_64, LFS does not support a multilib configuration.
- This switch is harmless for x86.</para>
+ <para>On LoongArch, LFS does not support a multilib configuration.</para>
</listitem>
</varlistentry>
diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml
index 14f1fac6c..409e210a1 100644
--- a/chapter05/glibc.xml
+++ b/chapter05/glibc.xml
@@ -43,17 +43,10 @@
<sect2 role="installation">
<title>Installation of Glibc</title>
- <para>First, create a symbolic link for LSB compliance. Additionally,
- for x86_64, create a compatibility symbolic link required for proper
+ <para>Create a compatibility symbolic link required for proper
operation of the dynamic library loader:</para>
-<screen><userinput remap="pre">case $(uname -m) in
- i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
- ;;
- x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
- ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
- ;;
-esac</userinput></screen>
+<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-loongarch-lp64d.so.1 $LFS/lib64</userinput></screen>
<note>
<para>
@@ -201,11 +194,11 @@ readelf -l a.out | grep ld-linux</userinput></screen>
<para>If everything is working correctly, there should be no errors,
and the output of the last command will be of the form:</para>
-<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
-
+<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-loongarch-lp64d.so.1]</computeroutput></screen>
+<!--
<para>Note that for 32-bit machines, the interpreter name will be
<filename>/lib/ld-linux.so.2</filename>.</para>
-
+-->
<para>If the output is not as shown above, or there is no output at all,
then something is wrong. Investigate and retrace the steps to find out
where the problem is and correct it. This issue must be resolved before
diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml
index b342ae484..05173661e 100644
--- a/chapter06/gcc-pass2.xml
+++ b/chapter06/gcc-pass2.xml
@@ -57,14 +57,10 @@ mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
- <para>If building on x86_64, change the default directory name for 64-bit
- libraries to <quote>lib</quote>:</para>
-
-<screen><userinput remap="pre">case $(uname -m) in
- x86_64)
- sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
- ;;
-esac</userinput></screen>
+ <para>Set the default directory name for
+ 64-bit libraries to <quote>lib</quote>:</para>
+
+<screen><userinput remap="pre">sed 's/lib64/lib/' -i.orig gcc/config/loongarch/{t-linux,linux.h}</userinput></screen>
<para>Override the building rule of libgcc and libstdc++ headers, to
allow building these libraries with POSIX threads support:</para>
diff --git a/chapter06/m4.xml b/chapter06/m4.xml
index 91e0a9ea2..acdea4f32 100644
--- a/chapter06/m4.xml
+++ b/chapter06/m4.xml
@@ -52,7 +52,9 @@ echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
- --build=$(build-aux/config.guess)</userinput></screen>
+ --build=$(build-aux/config.guess) \
+ sv_cv_stack_direction=-1 \
+ sv_cv_stack_direction_msg="grows down"</userinput></screen>
<para>Compile the package:</para>
diff --git a/chapter06/patch.xml b/chapter06/patch.xml
index 7032d6eea..b11cd56f9 100644
--- a/chapter06/patch.xml
+++ b/chapter06/patch.xml
@@ -43,6 +43,10 @@
<sect2 role="installation">
<title>Installation of Patch</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare Patch for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml
index b412bb278..93ec19a40 100644
--- a/chapter07/changingowner.xml
+++ b/chapter07/changingowner.xml
@@ -33,9 +33,6 @@
user <systemitem class="username">root</systemitem> by running the following
command:</para>
-<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
-case $(uname -m) in
- x86_64) chown -R root:root $LFS/lib64 ;;
-esac</userinput></screen>
+<screen><userinput>chown -R root:root $LFS/{usr,lib,lib64,var,etc,bin,sbin,tools}</userinput></screen>
</sect1>
diff --git a/chapter08/acl.xml b/chapter08/acl.xml
index 6702af90f..65b4e62bc 100644
--- a/chapter08/acl.xml
+++ b/chapter08/acl.xml
@@ -42,6 +42,10 @@
<sect2 role="installation">
<title>Installation of Acl</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare Acl for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/attr.xml b/chapter08/attr.xml
index 5272cfcb2..847a4935f 100644
--- a/chapter08/attr.xml
+++ b/chapter08/attr.xml
@@ -41,6 +41,10 @@
<sect2 role="installation">
<title>Installation of Attr</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare Attr for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml
index 1fd436bd1..e2650218a 100644
--- a/chapter08/binutils.xml
+++ b/chapter08/binutils.xml
@@ -51,7 +51,6 @@ cd build</userinput></screen>
<screen><userinput remap="configure">../configure --prefix=/usr \
--sysconfdir=/etc \
- --enable-gold \
--enable-ld=default \
--enable-plugins \
--enable-shared \
@@ -62,14 +61,6 @@ cd build</userinput></screen>
<title>The meaning of the configure parameters:</title>
<varlistentry>
- <term><parameter>--enable-gold</parameter></term>
- <listitem>
- <para>Build the gold linker and install it as ld.gold (alongside the
- default linker).</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><parameter>--enable-ld=default</parameter></term>
<listitem>
<para>Build the original bfd linker and install it as both ld (the
@@ -115,8 +106,8 @@ cd build</userinput></screen>
<para>Normally, the tooldir (the directory where the executables will
ultimately be located) is set to <filename
class="directory">$(exec_prefix)/$(target_alias)</filename>. For
- example, x86_64 machines would expand that to <filename
- class="directory">/usr/x86_64-pc-linux-gnu</filename>. Because this is
+ example, 64-bit LoongArch machines would expand that to <filename
+ class="directory">/usr/loongarch64-unknown-linux-gnu</filename>. Because this is
a custom system, this target-specific directory in <filename
class="directory">/usr</filename> is not required. <filename
class="directory">$(exec_prefix)/$(target_alias)</filename> would be
@@ -141,12 +132,6 @@ cd build</userinput></screen>
<screen><userinput remap="test">grep '^FAIL:' $(find -name '*.log')</userinput></screen>
- <para>Twelve tests fail in the gold test suite when the
- <option>--enable-default-pie</option> and
- <option>--enable-default-ssp</option> options are passed to GCC.</para>
-
- <para>Three tests in the gprofng suite are also known to fail.</para>
-
<para>Install the package:</para>
<screen><userinput remap="install">make tooldir=/usr install</userinput></screen>
@@ -166,7 +151,7 @@ cd build</userinput></screen>
<segtitle>Installed directory</segtitle>
<seglistitem>
- <seg>addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, ld.gold, nm,
+ <seg>addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, nm,
objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
<seg>libbfd.so, libctf.so, libctf-nobfd.so, libgprofng.so,
libopcodes.so, and libsframe.so</seg>
@@ -276,17 +261,6 @@ cd build</userinput></screen>
</listitem>
</varlistentry>
- <varlistentry id="ld.gold">
- <term><command>ld.gold</command></term>
- <listitem>
- <para>A cut down version of ld that only supports the
- elf object file format</para>
- <indexterm zone="ch-system-binutils ld.gold">
- <primary sortas="b-ld.gold">ld.gold</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
<varlistentry id="ld.bfd">
<term><command>ld.bfd</command></term>
<listitem>
diff --git a/chapter08/check.xml b/chapter08/check.xml
index cb6b3590d..59e0d67cf 100644
--- a/chapter08/check.xml
+++ b/chapter08/check.xml
@@ -40,6 +40,10 @@
<sect2 role="installation">
<title>Installation of Check</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar &update-config-arg;</userinput></screen>
+
<para>Prepare Check for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --disable-static</userinput></screen>
diff --git a/chapter08/expect.xml b/chapter08/expect.xml
index 7b6dac354..02848f7fc 100644
--- a/chapter08/expect.xml
+++ b/chapter08/expect.xml
@@ -48,6 +48,10 @@
<sect2 role="installation">
<title>Installation of Expect</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C tclconfig &update-config-arg;</userinput></screen>
+
<para>Prepare Expect for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/flex.xml b/chapter08/flex.xml
index 478637adc..d572edf22 100644
--- a/chapter08/flex.xml
+++ b/chapter08/flex.xml
@@ -51,6 +51,10 @@
This is not present, so we use an environment variable to skip this process.
Now, prepare Flex for compilation:</para> -->
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare Flex for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml
index 693d6e975..167495a50 100644
--- a/chapter08/gcc.xml
+++ b/chapter08/gcc.xml
@@ -54,15 +54,10 @@
<screen><userinput remap="pre">patch -Np1 -i ../&gcc-upstream-fixes-patch;</userinput></screen>
-->
- <para>If building on x86_64, change the default directory name for 64-bit
- libraries to <quote>lib</quote>:</para>
+ <para>Set the default directory name for
+ 64-bit libraries to <quote>lib</quote>:</para>
-<screen><userinput remap="pre">case $(uname -m) in
- x86_64)
- sed -e '/m64=/s/lib64/lib/' \
- -i.orig gcc/config/i386/t-linux64
- ;;
-esac</userinput></screen>
+<screen><userinput remap="pre">sed 's/lib64/lib/' -i.orig gcc/config/loongarch/{t-linux,linux.h}</userinput></screen>
<para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
@@ -172,17 +167,15 @@ su tester -c "PATH=$PATH make -k check"</userinput></screen>
url="&test-results;"/> and
<ulink url="https://gcc.gnu.org/ml/gcc-testresults/"/>.</para>
- <para><!--Two tests named <filename>pr104610.c</filename> and
- <filename>pr69482-1.c</filename> are known to fail because the test
- files does not account for the
- <parameter>- -enable-default-ssp</parameter> option.-->
- <!-- https://gcc.gnu.org/PR106375 and https://gcc.gnu.org/PR109353 -->
- Two tests named <filename>copy.cc</filename> and
- <filename>pr56837.c</filename> are known to fail.
- <!-- https://gcc.gnu.org/PR107855#c6 -->
- Additionally, several tests in the
- <filename class='directory'>vect</filename> directory are known to fail
- if the hardware does not support AVX.</para>
+ <para>The tests named
+ <filename>pr64076</filename>,
+ <filename>pr90883.C</filename>,
+ <filename>pr108357.c</filename>,
+ <filename>uninit-pred-9_b.c</filename>,
+ <filename>ssa-dom-cse-2.c</filename>,
+ <filename>stack-check-cfa-1.c</filename>, and
+ <filename>stack-check-cfa-2.c</filename>
+ are known to fail.</para>
<para>
With Glibc-2.38, the analyzer tests named
@@ -252,7 +245,7 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
and the output of the last command will be (allowing for
platform-specific differences in the dynamic linker name):</para>
-<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
+<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-loongarch-lp64d.so.1]</computeroutput></screen>
<para>Now make sure that we're set up to use the correct start files:</para>
@@ -260,9 +253,9 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
<para>The output of the last command should be:</para>
-<screen><computeroutput>/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/Scrt1.o succeeded
-/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded
-/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded</computeroutput></screen>
+<screen><computeroutput>/usr/lib/gcc/loongarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/Scrt1.o succeeded
+/usr/lib/gcc/loongarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded
+/usr/lib/gcc/loongarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded</computeroutput></screen>
<para>Depending on your machine architecture, the above may differ slightly.
The difference will be the name of the directory
@@ -279,9 +272,9 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
<para>This command should return the following output:</para>
<screen><computeroutput>#include &lt;...&gt; search starts here:
- /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include
+ /usr/lib/gcc/loongarch64-unknown-linux-gnu/&gcc-version;/include
/usr/local/include
- /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed
+ /usr/lib/gcc/loongarch64-unknown-linux-gnu/&gcc-version;/include-fixed
/usr/include</computeroutput></screen>
<para>Again, the directory named after your target triplet may be
@@ -294,15 +287,15 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
<para>References to paths that have components with '-linux-gnu' should
be ignored, but otherwise the output of the last command should be:</para>
-<screen><computeroutput>SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64")
+<screen><computeroutput>SEARCH_DIR("/usr/loongarch64-unknown-linux-gnu/lib64")
SEARCH_DIR("/usr/local/lib64")
SEARCH_DIR("/lib64")
SEARCH_DIR("/usr/lib64")
-SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib")
+SEARCH_DIR("/usr/loongarch64-unknown-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");</computeroutput></screen>
-
+<!--
<para>A 32-bit system may use a few other directories. For example, here
is the output from an i686 machine:</para>
@@ -314,7 +307,7 @@ SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");</computeroutput></screen>
-
+-->
<para>Next make sure that we're using the correct libc:</para>
<screen><userinput>grep "/lib.*/libc.so.6 " dummy.log</userinput></screen>
@@ -330,7 +323,7 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
<para>The output of the last command should be (allowing for
platform-specific differences in dynamic linker name):</para>
-<screen><computeroutput>found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2</computeroutput></screen>
+<screen><computeroutput>found ld-linux-loongarch-lp64d.so.1 at /usr/lib/ld-linux-loongarch-lp64d.so.1</computeroutput></screen>
<para>If the output does not appear as shown above or is not received
at all, then something is seriously wrong. Investigate and retrace the
diff --git a/chapter08/gdbm.xml b/chapter08/gdbm.xml
index 80961a65d..7f7b4d855 100644
--- a/chapter08/gdbm.xml
+++ b/chapter08/gdbm.xml
@@ -48,6 +48,10 @@
<screen><userinput remap="pre">sed -r -i '/^char.*parseopt_program_(doc|args)/d' src/parseopt.c</userinput></screen>
-->
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare GDBM for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/grub.xml b/chapter08/grub.xml
index 357036c34..63a4e13c0 100644
--- a/chapter08/grub.xml
+++ b/chapter08/grub.xml
@@ -42,11 +42,22 @@
<note>
<para>
- If your system has UEFI support and you wish to boot LFS with UEFI,
- you can skip this package in LFS,
- and install GRUB with UEFI support (and its dependencies) by following
- the instructions on
- <ulink url="&blfs-book;postlfs/grub-efi.html">the BLFS page</ulink>.
+ On LoongArch systems, the following instruction builds GRUB for UEFI.
+ But the built GRUB lacks some features because a few optional
+ dependencies of GRUB for UEFI is beyond the scope of LFS and not
+ installed yet.
+ </para>
+ <para>
+ If your system firmware does not support UEFI, you need to skip the
+ content of this page and try to figure out how to boot your system.
+ </para>
+ <para>
+ If your system firmware supports UEFI and you want a fully
+ functional GRUB, you can skip the content of this page,
+ and install GRUB with UEFI support (and its dependencies) following
+ <ulink url="&blfs-book;postlfs/grub-efi.html">the BLFS page</ulink>
+ (with <parameter>--target=x86_64</parameter> removed) at the end of
+ this chapter.
</para>
</note>
@@ -61,15 +72,6 @@
aggressive optimization.</para>
</warning>
- <para>
- Fix an issue causing <command>grub-install</command> to fail when the
- <filename class='directory'>/boot</filename> partition (or the root
- partition if <filename class='directory'>/boot</filename> is not a
- separate partition) is created by e2fsprogs-1.47.0 or later:
- </para>
-
-<screen><userinput remap='pre'>patch -Np1 -i ../grub-&grub-version;-upstream_fixes-1.patch</userinput></screen>
-
<para>Prepare GRUB for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/libcap.xml b/chapter08/libcap.xml
index 367e05c3f..f5d142210 100644
--- a/chapter08/libcap.xml
+++ b/chapter08/libcap.xml
@@ -59,8 +59,7 @@
<listitem>
<para>This parameter sets the library directory to
<filename>/usr/lib</filename> rather than
- <filename>/usr/lib64</filename> on x86_64. It has no effect on
- x86.</para>
+ <filename>/usr/lib64</filename> on 64-bit LoongArch.</para>
</listitem>
</varlistentry>
</variablelist>
diff --git a/chapter08/libelf.xml b/chapter08/libelf.xml
index 23b66222a..dd3642857 100644
--- a/chapter08/libelf.xml
+++ b/chapter08/libelf.xml
@@ -44,6 +44,11 @@
<para>Libelf is part of the elfutils-&elfutils-version; package. Use
the elfutils-&elfutils-version;.tar.bz2 file as the source tarball.</para>
+ <para>Add LoongArch support for this package:</para>
+
+<screen><userinput remap="pre">patch -Np1 -i ../&elfutils-loongarch-patch;
+autoreconf -fi</userinput></screen>
+
<para>Prepare Libelf for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml
index 4c6d2830f..411beba5c 100644
--- a/chapter08/libffi.xml
+++ b/chapter08/libffi.xml
@@ -76,8 +76,8 @@
will be copied from the native system to a less capable
system, use the less capable system as a parameter. For details
about alternative system types, see <ulink
- url='https://gcc.gnu.org/onlinedocs/gcc-&gcc-version;/gcc/x86-Options.html'>
- the x86 options in the GCC manual</ulink>.</para>
+ url='https://gcc.gnu.org/onlinedocs/gcc-&gcc-version;/gcc/LoongArch-Options.html'>
+ the LoongArch options in the GCC manual</ulink>.</para>
</listitem>
</varlistentry>
</variablelist>
diff --git a/chapter08/openssl.xml b/chapter08/openssl.xml
index 40a769311..704c6dec4 100644
--- a/chapter08/openssl.xml
+++ b/chapter08/openssl.xml
@@ -54,6 +54,7 @@
<screen><userinput remap="configure">./config --prefix=/usr \
--openssldir=/etc/ssl \
--libdir=lib \
+ linux64-loongarch64 \
shared \
zlib-dynamic</userinput></screen>
diff --git a/chapter08/patch.xml b/chapter08/patch.xml
index 870007b98..631803321 100644
--- a/chapter08/patch.xml
+++ b/chapter08/patch.xml
@@ -42,6 +42,10 @@
<sect2 role="installation">
<title>Installation of Patch</title>
+ &update-config-text;
+
+<screen><userinput remap="pre">tar -C build-aux &update-config-arg;</userinput></screen>
+
<para>Prepare Patch for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml
index 9e71f4382..effbe3724 100644
--- a/chapter08/stripping.xml
+++ b/chapter08/stripping.xml
@@ -46,8 +46,8 @@
(The related entry in <xref linkend="pkgmgmt-upgrade-issues"/> gives the
rationale for using the <command>install</command> command here.)</para>
- <note><para>The ELF loader's name is ld-linux-x86-64.so.2 on 64-bit systems
- and ld-linux.so.2 on 32-bit systems. The construct below selects the
+ <note><para>The ELF loader's name may vary on different systems.
+ The construct below selects the
correct name for the current architecture, excluding anything ending
with <quote>g</quote>, in case the commands below have already been
run.</para></note>
diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml
index 63003ac68..d0eea82dc 100644
--- a/chapter08/systemd.xml
+++ b/chapter08/systemd.xml
@@ -53,6 +53,7 @@
<screen><userinput remap="configure">mkdir -p build
cd build
+CFLAGS+=" -Wno-format-overflow" \
meson setup \
--prefix=/usr \
--buildtype=release \
diff --git a/chapter08/udev.xml b/chapter08/udev.xml
index 35bb12f46..9bfed8dfa 100644
--- a/chapter08/udev.xml
+++ b/chapter08/udev.xml
@@ -60,6 +60,7 @@
<screen><userinput remap="configure">mkdir -p build
cd build
+CFLAGS+=" -Wno-format-overflow" \
meson setup \
--prefix=/usr \
--buildtype=release \
diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml
index 6c37af728..fac66fe06 100644
--- a/chapter08/util-linux.xml
+++ b/chapter08/util-linux.xml
@@ -115,6 +115,10 @@ su tester -c "make -k check"</userinput></screen>
two sub-tests from misc: mbsencode and one sub-test from script: replay are
known to fail.</para>
+ <!-- Related to non-4K page size. -->
+ <para>Two tests named <filename>fadvise/drop</filename> and
+ <filename>fincore/count</filename> are known to fail.</para>
+
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
@@ -138,7 +142,7 @@ su tester -c "make -k check"</userinput></screen>
chmem, choom, chrt, col, colcrt, colrm, column, ctrlaltdel, delpart, dmesg,
eject, fallocate, fdisk, fincore, findfs, findmnt, flock, fsck,
fsck.cramfs, fsck.minix, fsfreeze, fstrim, getopt, hardlink, hexdump, hwclock,
- i386 (link to setarch), ionice, ipcmk, ipcrm, ipcs, irqtop, isosize, kill, last,
+ ionice, ipcmk, ipcrm, ipcs, irqtop, isosize, kill, last,
lastb (link to last), ldattach, linux32 (link to setarch), linux64 (link to setarch),
logger, look, losetup, lsblk, lscpu, lsipc, lsirq, lsfd, lslocks, lslogins,
lsmem, lsns, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap,
@@ -147,7 +151,7 @@ su tester -c "make -k check"</userinput></screen>
scriptlive, scriptreplay, setarch, setsid, setterm, sfdisk, sulogin, swaplabel,
swapoff, swapon, switch_root, taskset, uclampset, ul,
umount, uname26 (link to setarch), unshare, utmpdump, uuidd, uuidgen, uuidparse,
- wall, wdctl, whereis, wipefs, x86_64 (link to setarch), and zramctl</seg>
+ wall, wdctl, whereis, wipefs, and zramctl</seg>
<seg>libblkid.so, libfdisk.so, libmount.so,
libsmartcols.so, and libuuid.so</seg>
<seg>/usr/include/blkid,
@@ -530,16 +534,6 @@ su tester -c "make -k check"</userinput></screen>
</listitem>
</varlistentry>
- <varlistentry id="i386">
- <term><command>i386</command></term>
- <listitem>
- <para>A symbolic link to setarch</para>
- <indexterm zone="ch-system-util-linux i386">
- <primary sortas="b-i386">i386</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
<varlistentry id="ionice">
<term><command>ionice</command></term>
<listitem>
@@ -1289,16 +1283,6 @@ su tester -c "make -k check"</userinput></screen>
</listitem>
</varlistentry>
- <varlistentry id="x86_64">
- <term><command>x86_64</command></term>
- <listitem>
- <para>A symbolic link to setarch</para>
- <indexterm zone="ch-system-util-linux x86_64">
- <primary sortas="b-x86_64">x86_64</primary>
- </indexterm>
- </listitem>
- </varlistentry>
-
<varlistentry id="zramctl">
<term><command>zramctl</command></term>
<listitem>
diff --git a/chapter10/grub.xml b/chapter10/grub.xml
index 1b2335623..334d086b8 100644
--- a/chapter10/grub.xml
+++ b/chapter10/grub.xml
@@ -18,12 +18,24 @@
<note>
<para>
- If your system has UEFI support and you wish to boot LFS with UEFI,
- you should skip the instructions in this page but still learn the
+ This section assume your system has UEFI support and you wish to boot
+ LFS with UEFI and GRUB built following the instructions in Chapter 8.
+ </para>
+ <para>
+ If you've installed GRUB for UEFI with optional dependencies following
+ BLFS, you should skip the instructions in this page but still learn the
syntax of <filename>grub.cfg</filename> and the method to specify
a partition in the file from this page, and configure GRUB with UEFI
- support using the instructions provided in
- <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.
+ using the instructions provided in
+ <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>,
+ but replace <parameter>--target=x86_64-efi</parameter> with
+ <parameter>--target=loongarch64-efi</parameter> for the 64-bit
+ LoongArch system.
+ </para>
+ <para>
+ If your system does not support UEFI or you don't want to use it,
+ you'll need to figure out how to configure the booting process of
+ the system on your own.
</para>
</note>
@@ -36,18 +48,23 @@
just want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or
LILO.</para></warning>
- <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
+ <para>Ensure that an emergency boot disk is ready to <quote>rescue</quote>
the computer if the computer becomes unusable (un-bootable). If you do not
- already have a boot device, you can create one. In order for the procedure
- below to work, you need to jump ahead to BLFS and install
- <userinput>xorriso</userinput> from the <ulink
- url="&blfs-book;multimedia/libisoburn.html">
- libisoburn</ulink> package.</para>
+ already have a boot device, you can create one. To create a emergency
+ boot device for UEFI, consult section <quote>Create an Emergency Boot
+ Disk</quote> in
+ <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.</para>
-<screen role="nodump"><userinput>cd /tmp
-grub-mkrescue --output=grub-img.iso
-xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></screen>
+ </sect2>
+
+ <sect2>
+ <title>Turn off Secure Boot</title>
+ <para>LFS does not have the essential packages to support Secure Boot.
+ To set up the boot process following the instructions in this section,
+ Secure Boot must be turned off from the configuration interface of the
+ firmware. Read the documentation provided by the manufacturer of your
+ system to find out how.</para>
</sect2>
<sect2>
@@ -73,10 +90,31 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
<sect2>
<title>Setting Up the Configuration</title>
- <para>GRUB works by writing data to the first physical track of the
- hard disk. This area is not part of any file system. The programs
- there access GRUB modules in the boot partition. The default location
- is /boot/grub/.</para>
+ <para>GRUB works by creating an EFI executable in the EFI System
+ Partition (ESP). You can find the ESP with:</para>
+
+<screen role="nodump"><userinput>fdisk -l | grep 'EFI System'</userinput></screen>
+
+ <para>If no ESP exists on your hard drive (for example, you are building
+ LFS on a fresh new system with a Live CD as the host distro), read
+ <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>
+ for the instruction to create an ESP on your hard drive.</para>
+
+ <para>If the ESP is not mounted at
+ <filename class="directory">/boot/efi</filename> (in the chroot),
+ mount it now:</para>
+
+<screen role="nodump"><userinput>mkdir -pv /boot/efi
+mount /boot/efi</userinput></screen>
+
+ <note>
+ <para>The path to the device node is intentionally omitted in the
+ command. We expect the entry for mounting the ESP to
+ <filename class="directory">/boot/efi</filename> is already in
+ <filename>/etc/fstab</filename>. Add the entry before running the
+ command if you forgot to create an entry for the ESP in
+ <xref linkend="ch-bootable-fstab"/>.</para>
+ </note>
<para>The location of the boot partition is a choice of the user that
affects the configuration. One recommendation is to have a separate small
@@ -101,23 +139,54 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
class="partition">sda2</filename>.</para>
<para>Install the GRUB files into <filename
- class="directory">/boot/grub</filename> and set up the boot track:</para>
+ class="directory">/boot/grub</filename> and the GRUB EFI executable into
+ <filename>/boot/efi/EFI/BOOT/BOOTLOONGARCH64.EFI</filename>:</para>
<warning>
- <para>The following command will overwrite the current boot loader. Do not
- run the command if this is not desired, for example, if using a third party
- boot manager to manage the Master Boot Record (MBR).</para>
+ <para>The following command will overwrite
+ <filename>BOOTLOONGARCH64.EFI</filename>. Do not run the command if
+ this is not desired, for example, if it contains a third party boot
+ manager. You can backup it with <command>cp</command> as it's a
+ regular file.</para>
</warning>
-<screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
+<screen role="nodump"><userinput>grub-install --removable</userinput></screen>
<note>
- <para>If the system has been booted using UEFI,
- <command>grub-install</command> will try to install files for the
- <emphasis>x86_64-efi</emphasis> target, but those files
- have not been installed in <xref linkend="chapter-building-system"/>.
- If this is the case, add <option>--target i386-pc</option> to the
- command above.</para>
+ <para>
+ <parameter>--removable</parameter> may seem strange here. The UEFI
+ firmware searches EFI executables for boot loaders in a hardcoded
+ path, <filename>EFI/BOOT/BOOTLOONGARCH64.EFI</filename> in the ESP, and other
+ boot loader paths listed in the EFI variables. We've not installed
+ the utilities for manipulating EFI variables so we need to install
+ the EFI executable into the hardcoded path. The hardcoded path is
+ usually used by removable devices (for example, USB thumb devices)
+ so the <command>grub-install</command> option for this purpose is
+ named <parameter>--removable</parameter>.
+ </para>
+ <para>
+ UEFI implementation usually prefers the boot loaders with paths
+ recorded in an EFI variable, to the boot loader with the hardcoded
+ search path. You may need to invoke the boot device selection menu
+ or setting interface of your EFI firmware on next boot to explicitly
+ select the bootloader.
+ </para>
+ <para>
+ Some UEFI implementation may completely skip the hardcoded path if
+ there are other boot loaders in the same hard drive with paths
+ recorded in an EFI variable. Then you need to create an EFI
+ variable for the newly installed boot loader. Install
+ <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
+ then run the following commands:
+
+<screen role="nodump"><userinput>mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
+efibootmgr -B -L LFS || true
+efibootmgr -c -L LFS -l '\EFI\BOOT\BOOTLOONGARCH64.EFI' -d /dev/sda
+umount /sys/firmware/efi/efivars</userinput></screen>
+
+ Replace <filename>/dev/sda</filename> with the device node of the
+ hard drive where you are installing GRUB into.
+ </para>
</note>
<!-- This does not seem to be true any more
@@ -147,6 +216,8 @@ insmod part_gpt
insmod ext2
set root=(hd0,2)
+insmod all_video
+
menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" {
linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro
}</literal>
diff --git a/chapter10/kernel.xml b/chapter10/kernel.xml
index 8609b1474..51c1d2cce 100644
--- a/chapter10/kernel.xml
+++ b/chapter10/kernel.xml
@@ -140,23 +140,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="kernel/systemd.xml"/>
- <para>Enable some additional features if you are building a 64-bit
- system. If you are using menuconfig, enable them in the order of
- <parameter>CONFIG_PCI_MSI</parameter> first, then
- <parameter>CONFIG_IRQ_REMAP</parameter>, at last
- <parameter>CONFIG_X86_X2APIC</parameter> because an option only
- shows up after its dependencies are selected.</para>
-
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="kernel/x2apic.xml"/>
-
- <para>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:</para>
-
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
- href="kernel/highmem.xml"/>
-
<para>If the partition for the LFS system is in a NVME SSD (i. e. the
device node for the partition is <filename>/dev/nvme*</filename>
instead of <filename>/dev/sd*</filename>), enable NVME support or
@@ -272,6 +255,15 @@
</varlistentry>
<varlistentry>
+ <term><parameter>Enable the generic EFI decompressor</parameter></term>
+ <listitem>
+ <para>Create the bootable image as an EFI application that carries
+ the actual kernel image in compressed form. It can make the
+ bootable image 50% smaller.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><parameter>Framebuffer Console support</parameter></term>
<listitem>
<para>This is needed to display the Linux console on a frame
@@ -285,18 +277,6 @@
</listitem>
</varlistentry>
- <varlistentry>
- <term><parameter>Support x2apic</parameter></term>
- <listitem>
- <para>Support running the interrupt controller of 64-bit x86
- processors in x2APIC mode. x2APIC may be enabled by firmware on
- 64-bit x86 systems, and a kernel without this option enabled will
- panic on boot if x2APIC is enabled by firmware. This option has
- has no effect, but also does no harm if x2APIC is disabled by the
- firmware.</para>
- </listitem>
- </varlistentry>
-
</variablelist>
<para>Alternatively, <command>make oldconfig</command> may be more
@@ -311,6 +291,14 @@
configuration menus and create the kernel configuration from
scratch.</para>
+ <para>Fix an issue causing all kernel modules built with Binutils-2.41
+ or later not loadable:</para>
+
+<screen><userinput remap="pre">cat &gt;&gt; arch/loongarch/Makefile &lt;&lt; EOF
+<literal>KBUILD_AFLAGS_MODULE += -Wa,-mno-relax
+KBUILD_CFLAGS_MODULE += -Wa,-mno-relax</literal>
+EOF</userinput></screen>
+
<para>Compile the kernel image and modules:</para>
<screen><userinput remap="make">make</userinput></screen>
@@ -351,9 +339,10 @@
used. The filename below can be changed to suit your taste, but the stem of
the filename should be <emphasis>vmlinuz</emphasis> to be compatible with
the automatic setup of the boot process described in the next section. The
- following command assumes an x86 architecture:</para>
+ following command assumes a LoongArch platform with an EFI boot loader
+ (for example, GRUB built in &ch-final;):</para>
-<screen><userinput remap="install">cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;</userinput></screen>
+<screen><userinput remap="install">cp -iv arch/loongarch/boot/vmlinuz.efi /boot/vmlinuz-&linux-version;-lfs-&version;</userinput></screen>
<para><filename>System.map</filename> is a symbol file for the kernel.
It maps the function entry points of every function in the kernel API,
diff --git a/chapter10/kernel/highmem.toml b/chapter10/kernel/highmem.toml
deleted file mode 100644
index 2caf42385..000000000
--- a/chapter10/kernel/highmem.toml
+++ /dev/null
@@ -1 +0,0 @@
-HIGHMEM64G='X'
diff --git a/chapter10/kernel/highmem.xml b/chapter10/kernel/highmem.xml
deleted file mode 100644
index 4f0938142..000000000
--- a/chapter10/kernel/highmem.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<!-- Automatically generated by kernel-config.py
- DO NOT EDIT! -->
-<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features ---&gt;
- H<emphasis role='blue'>i</emphasis>gh Memory Support ---&gt;
- (X) <emphasis role='blue'>6</emphasis>4GB [HIGHMEM64G]</screen>
diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py
index a36113175..ffea2c1bc 100755
--- a/chapter10/kernel/kernel-config.py
+++ b/chapter10/kernel/kernel-config.py
@@ -23,7 +23,7 @@ menu_id = 1
stack = []
if_stack = []
-expand_var_mp = { 'SRCARCH': 'x86' }
+expand_var_mp = { 'SRCARCH': 'loongarch' }
main_dep = {}
def expand_var(s):
@@ -170,6 +170,9 @@ def load_kconfig(file):
continue
if line.startswith('source') or line.startswith('\tsource'):
sub = expand_var(line.strip().split()[1].strip('"'))
+ # Ugly. TODO: remove once this is resolved in kernel.
+ if file[:4] == 'arch' and sub == 'drivers/firmware/Kconfig':
+ continue
r += load_kconfig(sub)
elif line.startswith('config') or line.startswith('menu'):
config_buf = [line]
diff --git a/chapter10/kernel/kernel.version b/chapter10/kernel/kernel.version
index 4b20d9700..a22892044 100644
--- a/chapter10/kernel/kernel.version
+++ b/chapter10/kernel/kernel.version
@@ -1 +1 @@
-6.4.8
+6.4.9
diff --git a/chapter10/kernel/systemd.toml b/chapter10/kernel/systemd.toml
index 26ac61c46..096b1618e 100644
--- a/chapter10/kernel/systemd.toml
+++ b/chapter10/kernel/systemd.toml
@@ -16,6 +16,8 @@ DEVTMPFS_MOUNT='*'
FB='*'
FRAMEBUFFER_CONSOLE='*'
+EFI_ZBOOT='*'
+
AUDIT=' '
NET='*'
INET='*'
diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml
index 6705fdd35..9357a9b8c 100644
--- a/chapter10/kernel/systemd.xml
+++ b/chapter10/kernel/systemd.xml
@@ -15,9 +15,9 @@
[*] M<emphasis role='blue'>e</emphasis>mory controller [MEMCG]
[ ] <emphasis role='blue'>C</emphasis>onfigure standard kernel features (expert users) ---&gt; [EXPERT]
-<emphasis role='blue'>P</emphasis>rocessor type and features ---&gt;
- [*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel [RELOCATABLE]
- [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image (KASLR) [RANDOMIZE_BASE]
+<emphasis role='blue'>K</emphasis>ernel type and options ---&gt;
+ [*] <emphasis role='blue'>R</emphasis>elocatable kernel [RELOCATABLE]
+ [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel (KASLR) [RANDOMIZE_BASE]
<emphasis role='blue'>G</emphasis>eneral architecture-dependent options ---&gt;
[*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR]
@@ -40,6 +40,8 @@
... [FW_LOADER_USER_HELPER]
<emphasis role='blue'>F</emphasis>irmware Drivers ---&gt;
[*] <emphasis role='blue'>E</emphasis>xport DMI identification via sysfs to userspace [DMIID]
+ <emphasis role='blue'>E</emphasis>FI (Extensible Firmware Interface) Support ---&gt;
+ [*] <emphasis role='blue'>E</emphasis>nable the generic EFI decompressor [EFI_ZBOOT]
<emphasis role='blue'>G</emphasis>raphics support ---&gt;
<emphasis role='blue'>F</emphasis>rame buffer Devices ---&gt;
&lt;*&gt; <emphasis role='blue'>S</emphasis>upport for frame buffer devices ---&gt; [FB]
diff --git a/chapter10/kernel/sysv.toml b/chapter10/kernel/sysv.toml
index 5c8b2df6e..64a5333fd 100644
--- a/chapter10/kernel/sysv.toml
+++ b/chapter10/kernel/sysv.toml
@@ -15,4 +15,6 @@ DEVTMPFS_MOUNT='*'
FB='*'
FRAMEBUFFER_CONSOLE='*'
+EFI_ZBOOT='*'
+
revision='sysv'
diff --git a/chapter10/kernel/sysv.xml b/chapter10/kernel/sysv.xml
index 7e62725e6..bac8c6773 100644
--- a/chapter10/kernel/sysv.xml
+++ b/chapter10/kernel/sysv.xml
@@ -14,9 +14,9 @@
[*] M<emphasis role='blue'>e</emphasis>mory controller [MEMCG]
[ ] <emphasis role='blue'>C</emphasis>onfigure standard kernel features (expert users) ---&gt; [EXPERT]
-<emphasis role='blue'>P</emphasis>rocessor type and features ---&gt;
- [*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel [RELOCATABLE]
- [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image (KASLR) [RANDOMIZE_BASE]
+<emphasis role='blue'>K</emphasis>ernel type and options ---&gt;
+ [*] <emphasis role='blue'>R</emphasis>elocatable kernel [RELOCATABLE]
+ [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel (KASLR) [RANDOMIZE_BASE]
<emphasis role='blue'>G</emphasis>eneral architecture-dependent options ---&gt;
[*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR]
@@ -28,6 +28,9 @@
[*] M<emphasis role='blue'>a</emphasis>intain a devtmpfs filesystem to mount at /dev [DEVTMPFS]
[*] <emphasis role='blue'>A</emphasis>utomount devtmpfs at /dev, after the kernel mounted the rootfs
... [DEVTMPFS_MOUNT]
+ <emphasis role='blue'>F</emphasis>irmware Drivers ---&gt;
+ <emphasis role='blue'>E</emphasis>FI (Extensible Firmware Interface) Support ---&gt;
+ [*] <emphasis role='blue'>E</emphasis>nable the generic EFI decompressor [EFI_ZBOOT]
<emphasis role='blue'>G</emphasis>raphics support ---&gt;
<emphasis role='blue'>F</emphasis>rame buffer Devices ---&gt;
&lt;*&gt; <emphasis role='blue'>S</emphasis>upport for frame buffer devices ---&gt; [FB]
diff --git a/chapter10/kernel/x2apic.toml b/chapter10/kernel/x2apic.toml
deleted file mode 100644
index 6f7657b13..000000000
--- a/chapter10/kernel/x2apic.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-X86_X2APIC='*'
-PCI='*'
-PCI_MSI='*'
-IOMMU_SUPPORT='*'
-IRQ_REMAP='*'
diff --git a/chapter10/kernel/x2apic.xml b/chapter10/kernel/x2apic.xml
deleted file mode 100644
index 9bd2a719f..000000000
--- a/chapter10/kernel/x2apic.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<!-- Automatically generated by kernel-config.py
- DO NOT EDIT! -->
-<screen role="nodump"><emphasis role='blue'>P</emphasis>rocessor type and features ---&gt;
- [*] <emphasis role='blue'>S</emphasis>upport x2apic [X86_X2APIC]
-
-<emphasis role='blue'>D</emphasis>evice Drivers ---&gt;
- [*] <emphasis role='blue'>P</emphasis>CI support ---&gt; [PCI]
- [*] M<emphasis role='blue'>e</emphasis>ssage Signaled Interrupts (MSI and MSI-X) [PCI_MSI]
- [*] <emphasis role='blue'>I</emphasis>OMMU Hardware Support ---&gt; [IOMMU_SUPPORT]
- [*] <emphasis role='blue'>S</emphasis>upport for Interrupt Remapping [IRQ_REMAP]</screen>
diff --git a/general.ent b/general.ent
index dd9771789..7c58589a1 100644
--- a/general.ent
+++ b/general.ent
@@ -92,9 +92,7 @@
<!ENTITY test-results "&lfs-root;lfs/build-logs/&generic-version;/">
<!ENTITY secadv "&lfs-root;lfs/advisories/">
-<!-- 4.14 EOL is Jan 2024
- so for LFS 11.5 we may consider moving to 4.19 -->
-<!ENTITY min-kernel "4.14">
+<!ENTITY min-kernel "5.19">
<!--
<!ENTITY patches-rootd "&lfs-root;patches/lfs/&generic-versiond;/">
@@ -139,3 +137,14 @@
<!ENTITY % patches-entities SYSTEM "patches.ent">
%patches-entities;
+
+<!ENTITY update-config-text
+ "<para>Update the auxilary scripts of the building system to allow
+ building this package for LoongArch:</para>">
+
+<!-- Use "tar &update-config-arg" or "tar -C build-aux update-config-arg"
+ We cannot append -C build-aux after these arguments because -C only
+ affects options that follow. -->
+<!ENTITY update-config-arg
+ "-xvf ../autoconf-&autoconf-version;.tar.xz --strip-components=2 \
+ autoconf-&autoconf-version;/build-aux/config.{guess,sub}">
diff --git a/git-version.sh b/git-version.sh
index 6dd3d90be..396add872 100755
--- a/git-version.sh
+++ b/git-version.sh
@@ -48,7 +48,7 @@ esac
full_date="$month $day$suffix, $year"
sha="$(git describe --abbrev=1)"
-rev=$(echo "$sha" | sed 's/-g[^-]*$//')
+rev=loongarch-$(echo "$sha" | sed 's/-g[^-]*$//')
version="$rev"
versiond="$rev-systemd"
diff --git a/packages.ent b/packages.ent
index 8d80296f9..42957155c 100644
--- a/packages.ent
+++ b/packages.ent
@@ -300,10 +300,10 @@
<!ENTITY groff-fin-du "107 MB">
<!ENTITY groff-fin-sbu "0.2 SBU">
-<!ENTITY grub-version "2.06">
-<!ENTITY grub-size "6,428 KB">
-<!ENTITY grub-url "https://ftp.gnu.org/gnu/grub/grub-&grub-version;.tar.xz">
-<!ENTITY grub-md5 "cf0fd928b1e5479c8108ee52cb114363">
+<!ENTITY grub-version "2.12~rc1">
+<!ENTITY grub-size "6,436 KB">
+<!ENTITY grub-url "&alpha-gnu;grub/grub-&grub-version;.tar.xz">
+<!ENTITY grub-md5 "b02415b4dcfd3d31482b33d3f6b79114">
<!ENTITY grub-home "&gnu-software;grub/">
<!ENTITY grub-fin-du "161 MB">
<!ENTITY grub-fin-sbu "0.3 SBU">
diff --git a/patches.ent b/patches.ent
index c3b6dfb18..92d20d1a9 100644
--- a/patches.ent
+++ b/patches.ent
@@ -30,6 +30,9 @@
<!ENTITY coreutils-chmod-patch-md5 "4709df88e68279e6ef357aa819ba5b1a">
<!ENTITY coreutils-chmod-patch-size "3.8 KB">
-->
+<!ENTITY elfutils-loongarch-patch "elfutils-&elfutils-version;-loongarch-3.patch">
+<!ENTITY elfutils-loongarch-patch-md5 "cd7125a123145d1e2911b1dd2186793a">
+<!ENTITY elfutils-loongarch-patch-size "44 KB">
<!--
<!ENTITY flex-fixes-patch "flex-&flex-version;-upstream_fixes-3.patch">
<!ENTITY flex-fixes-patch-md5 "b46f6b0380e502a3dfb8b503227cd680">
diff --git a/prologue/architecture.xml b/prologue/architecture.xml
index d416780e4..b0d87d260 100644
--- a/prologue/architecture.xml
+++ b/prologue/architecture.xml
@@ -10,41 +10,27 @@
<title>LFS Target Architectures</title>
-<para>The primary target architectures of LFS are the AMD/Intel x86 (32-bit)
-and x86_64 (64-bit) CPUs. On the other hand, the instructions in this book are
-also known to work, with some modifications, with the Power PC and ARM CPUs. To
-build a system that utilizes one of these alternative CPUs, the main prerequisite, in
+<para>The primary target architectures of this LFS edition are LoongArch
+CPUs.
+<!--On the other hand, the instructions in this book are
+also known to work, with some modifications, with the Power PC and ARM
+CPUs. -->
+To build a system that utilizes one of these CPUs, the main prerequisite, in
addition to those on the next page, is an existing Linux system such as an
-earlier LFS installation, Ubuntu, Red Hat/Fedora, SuSE, or some other distribution
-that targets that architecture. (Note that a 32-bit
-distribution can be installed and used as a host system on a 64-bit AMD/Intel
-computer.)</para>
+earlier LFS installation, Loong Arch Linux, CLFS for LoongArch, Gentoo,
+Slackware, or other distribution that targets LoongArch.</para>
-<para>The gain from building on a 64-bit system, as
-compared to a 32-bit system, is minimal.
-For example, in a test build of LFS-9.1 on a Core i7-4790 CPU based system,
-using 4 cores, the following statistics were measured:</para>
-
-<screen><computeroutput>Architecture Build Time Build Size
-32-bit 239.9 minutes 3.6 GB
-64-bit 233.2 minutes 4.4 GB</computeroutput></screen>
-
-<para>As you can see, on the same hardware, the 64-bit build is only 3% faster
-(and 22% larger) than the 32-bit build. If you plan to use LFS as a LAMP
-server, or a firewall, a 32-bit CPU may be good enough. On the other
-hand, several packages in BLFS now need more than 4 GB of RAM to be built
-and/or to run; if you plan to use LFS as a desktop, the LFS authors
-recommend building a 64-bit system.</para>
-
-<para>The default 64-bit build that results from LFS is a
-<quote>pure</quote> 64-bit system. That is, it supports 64-bit executables
+<para>The build that results from this LFS edition is a
+<quote>pure</quote> lp64d system. That is, it supports executables with
+the lp64d ABI
only. Building a <quote>multi-lib</quote> system requires compiling many
-applications twice, once for a 32-bit system and once for a 64-bit system.
+applications multiple times, once for each ABI to be supported.
This is not directly supported in LFS because it would interfere with the
educational objective of providing the minimal instructions needed for a
basic Linux system. Some of the LFS/BLFS editors maintain a multilib fork
of LFS, accessible at <ulink
url="https://www.linuxfromscratch.org/~thomas/multilib/index.html"/>. But
-that's an advanced topic.</para>
+the multilib edition is for x86_64, and multilib is an advanced topic
+anyway.</para>
</sect1>
diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml
index 18ba29e02..40aac7b42 100644
--- a/prologue/bookinfo.xml
+++ b/prologue/bookinfo.xml
@@ -49,6 +49,8 @@
<para><trademark class='registered'>Linux</trademark> is a registered trademark of
Linus Torvalds.</para>
+ <para><trademark class='registered'>LoongArch</trademark> is a
+ registered trademark of Loongson Technology Co., Ltd.</para>
</legalnotice>
</bookinfo>