diff options
30 files changed, 223 insertions, 277 deletions
diff --git a/chapter02/creatingpartition.xml b/chapter02/creatingpartition.xml index 35279cb75..3f165980f 100644 --- a/chapter02/creatingpartition.xml +++ b/chapter02/creatingpartition.xml @@ -104,24 +104,6 @@ system.</para> </sect3> <sect3> - <title>The Grub Bios Partition</title> - - <para>If the <emphasis>boot disk</emphasis> has been partitioned with a - GUID Partition Table (GPT), then a small, typically 1 MB, partition must be - created if it does not already exist. This partition is not formatted, but - must be available for GRUB to use during installation of the boot - loader. This partition will normally be labeled 'BIOS Boot' if using - <command>fdisk</command> or have a code of <emphasis>EF02</emphasis> if - using the <command>gdisk</command> command.</para> - - <note><para>The Grub Bios partition must be on the drive that the BIOS - uses to boot the system. This is not necessarily the drive that holds - the LFS root partition. The disks on a system may use different - partition table types. The necessity of the Grub Bios partition depends - only on the partition table type of the boot disk.</para></note> - </sect3> - - <sect3> <title>Convenience Partitions</title> <para>There are several other partitions that are not required, but should diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index 2db1f756f..999d50ba5 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,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..e67c2d091 100644 --- a/chapter04/creatingminlayout.xml +++ b/chapter04/creatingminlayout.xml @@ -25,11 +25,7 @@ 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..3403c47aa 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -62,15 +62,11 @@ 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>On ARM64 hosts, 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 -e '/lp64=/s/lib64/lib/' \ + -i.orig gcc/config/aarch64/t-aarch64-linux</userinput></screen> <para>The GCC documentation recommends building GCC in a dedicated build directory:</para> @@ -159,8 +155,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 ARM64, LFS does not support a multilib configuration.</para> </listitem> </varlistentry> diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index da354551c..e1561b096 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -43,27 +43,6 @@ <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 - 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> - - <note> - <para> - The above command is correct. The <command>ln</command> command has - several syntactic versions, so be sure to check - <command>info coreutils ln</command> and <filename>ln(1)</filename> - before reporting what may appear to be an error. - </para> - </note> - <para>Some of the Glibc programs use the non-FHS-compliant <filename class="directory">/var/db</filename> directory to store their runtime data. Apply the following patch to make such programs store their @@ -210,10 +189,10 @@ 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: /lib/ld-linux-aarch64.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>Note that for big-endian machines, the interpreter name will be + <filename>/lib/ld-linux-aarch64_be.so.1</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 diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index ae88a41f0..770f6b187 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -57,15 +57,11 @@ 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>On ARM64 hosts, set the default directory name for + 64-bit libraries to <quote>lib</quote>:</para> + +<screen><userinput remap="pre">sed -e '/lp64=/s/lib64/lib/' \ + -i.orig gcc/config/aarch64/t-aarch64-linux</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/chapter07/changingowner.xml b/chapter07/changingowner.xml index b412bb278..319c10ec1 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,var,etc,bin,sbin,tools}</userinput></screen> </sect1> diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml index 9e93e55f0..c4a25492c 100644 --- a/chapter08/binutils.xml +++ b/chapter08/binutils.xml @@ -109,8 +109,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, ARM64 machines would expand that to <filename + class="directory">/usr/aarch64-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 @@ -135,11 +135,7 @@ 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>Three tests in the gprofng suite are known to fail.</para> <para>Install the package:</para> diff --git a/chapter08/expect.xml b/chapter08/expect.xml index 7b6dac354..39b6517a3 100644 --- a/chapter08/expect.xml +++ b/chapter08/expect.xml @@ -48,6 +48,12 @@ <sect2 role="installation"> <title>Installation of Expect</title> + <para>Update two config scripts to allow building this package for + AArch64:</para> + +<screen><userinput remap="pre">tar -C tclconfig -xf ../autoconf-&autoconf-version;.tar.xz --strip-components=2 \ + autoconf-&autoconf-version;/build-aux/config.{guess,sub}</userinput></screen> + <para>Prepare Expect for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/usr \ diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index 693d6e975..f402f8a02 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -54,15 +54,11 @@ <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>On ARM64 hosts, 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 -e '/lp64=/s/lib64/lib/' \ + -i.orig gcc/config/aarch64/t-aarch64-linux</userinput></screen> <para>The GCC documentation recommends building GCC in a dedicated build directory:</para> @@ -172,17 +168,17 @@ 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 --> + <para> + <!-- https://gcc.gnu.org/PR107915 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> + <filename>contracts-tmpl-spec2.C</filename> are known to fail. + <!-- https://gcc.gnu.org/PR111224 --> + Some C++ module tests named <filename>xtreme-*</filename> are known to + fail. + </para> + + <!-- Need further investigation --> + <para>Many gcc and g++ tests related to hwasan are known to fail.</para> <para> With Glibc-2.38, the analyzer tests named @@ -252,7 +248,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: /lib/ld-linux-aarch64.so.1]</computeroutput></screen> <para>Now make sure that we're set up to use the correct start files:</para> @@ -260,9 +256,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/aarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/Scrt1.o succeeded +/usr/lib/gcc/aarch64-unknown-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded +/usr/lib/gcc/aarch64-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 +275,9 @@ readelf -l a.out | grep ': /lib'</userinput></screen> <para>This command should return the following output:</para> <screen><computeroutput>#include <...> search starts here: - /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include + /usr/lib/gcc/aarch64-unknown-linux-gnu/&gcc-version;/include /usr/local/include - /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed + /usr/lib/gcc/aarch64-unknown-linux-gnu/&gcc-version;/include-fixed /usr/include</computeroutput></screen> <para>Again, the directory named after your target triplet may be @@ -294,15 +290,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/aarch64-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/aarch64-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 +310,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 +326,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-aarch64.so.1 at /usr/lib/ld-linux-aarch64.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/glibc.xml b/chapter08/glibc.xml index c00d56d30..06cda8a71 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -458,7 +458,7 @@ unset ZONEINFO</userinput></screen> </indexterm> <para>By default, the dynamic loader (<filename - class="libraryfile">/lib/ld-linux.so.2</filename>) searches through + class="libraryfile">/lib/ld-linux-aarch64.so.1</filename>) searches through <filename class="directory">/usr/lib</filename> for dynamic libraries that are needed by programs as they are run. However, if there are libraries in directories other than @@ -506,11 +506,11 @@ mkdir -pv /etc/ld.so.conf.d</userinput></screen> <seglistitem> <seg>gencat, getconf, getent, iconv, iconvconfig, ldconfig, ldd, lddlibc4, - ld.so (symlink to ld-linux-x86-64.so.2 or ld-linux.so.2), + ld.so (symlink to ld-linux-aarch64[_be].so.1), locale, localedef, makedb, mtrace, pcprofiledump, pldd, sln, sotruss, sprof, tzselect, xtrace, zdump, and zic</seg> - <seg>ld-linux-x86-64.so.2, ld-linux.so.2, + <seg>ld-linux-aarch64[_be].so.1, libBrokenLocale.{a,so}, libanl.{a,so}, libc.{a,so}, libc_nonshared.a, libc_malloc_debug.so, libdl.{a,so.2}, libg.a, libm.{a,so}, diff --git a/chapter08/gmp.xml b/chapter08/gmp.xml index c2fd316f8..c178d2b13 100644 --- a/chapter08/gmp.xml +++ b/chapter08/gmp.xml @@ -42,15 +42,6 @@ <title>Installation of GMP</title> <note> - <para>If you are building for 32-bit x86, but you have a CPU which is - capable of running 64-bit code <emphasis>and</emphasis> you have specified - <envar>CFLAGS</envar> in the environment, the configure script will - attempt to configure for 64-bits and fail. - Avoid this by invoking the configure command below with -<screen role="nodump"><userinput><parameter>ABI=32</parameter> ./configure ...</userinput></screen></para> - </note> - - <note> <para>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 diff --git a/chapter08/grub.xml b/chapter08/grub.xml index a89963189..8d0661b69 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -42,11 +42,22 @@ <note> <para> + On ARM64 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 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>. + <ulink url="&blfs-book;postlfs/grub-efi.html">the BLFS page</ulink> + (with <parameter>--target=x86_64</parameter> removed). </para> </note> @@ -67,6 +78,12 @@ <screen><userinput remap='pre'>echo <literal>depends bli part_gpt</literal> > grub-core/extra_deps.lst</userinput></screen> + <!--https://git.savannah.gnu.org/cgit/grub.git/commit/?id=69edb312 --> + <para>Apply an upstream change so GRUB will be capable to load + compressed kernel image on an ARM64 system:</para> + +<screen><userinput remap='pre'>sed '/ARMXX_MAGIC/,+2d' -i grub-core/loader/arm64/linux.c</userinput></screen> + <para>Prepare GRUB for compilation:</para> <screen><userinput remap="configure">./configure --prefix=/usr \ diff --git a/chapter08/kbd.xml b/chapter08/kbd.xml index 28685015a..eec5d4abe 100644 --- a/chapter08/kbd.xml +++ b/chapter08/kbd.xml @@ -45,6 +45,14 @@ across the keymaps in the Kbd package. The following patch fixes this issue for i386 keymaps:</para> + <note> + <para> + Don't skip the patch just because it mentions "i386". The keymaps + for the keyboards most common on the market (qwerty or dvorak) are + in "i386" catagory. + </para> + </note> + <screen><userinput remap="pre">patch -Np1 -i ../&kbd-backspace-patch;</userinput></screen> <para>After patching, the backspace key generates the character with code 127, diff --git a/chapter08/libcap.xml b/chapter08/libcap.xml index 367e05c3f..66ee4deca 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 ARM64.</para> </listitem> </varlistentry> </variablelist> diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml index 4c6d2830f..a6f7b88f8 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/AArch64-Options.html'> + the AArch64 options in the GCC manual</ulink>.</para> </listitem> </varlistentry> </variablelist> diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml index b7b983d73..83f7545fd 100644 --- a/chapter08/stripping.xml +++ b/chapter08/stripping.xml @@ -49,8 +49,9 @@ (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 is ld-linux-aarch64.so.1 on + little-endian systems and ld-linux-aarch64_be.so.1 on big-endian 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/util-linux.xml b/chapter08/util-linux.xml index dc061bccf..8d4514094 100644 --- a/chapter08/util-linux.xml +++ b/chapter08/util-linux.xml @@ -138,7 +138,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 +147,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 +530,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> @@ -1290,16 +1280,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..48db73bb0 100644 --- a/chapter10/grub.xml +++ b/chapter10/grub.xml @@ -18,12 +18,23 @@ <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=arm64-efi</parameter> for the ARM64 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 +47,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 +89,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 +138,56 @@ 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 class="directory">/boot/efi/EFI/BOOT/BOOTAA64.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>BOOTAA64.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/BOOTAA64.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\BOOTAA64.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. For some UEFI + firmwares, <option>-e 3</option> option may be needed for the + <command>efibootmgr -c</command> command. + </para> </note> <!-- This does not seem to be true any more @@ -147,6 +217,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 5bbfff11a..7589e3c39 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> @@ -273,6 +256,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> Enable legacy fbdev support for your modesetting driver @@ -288,18 +280,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 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 @@ -354,9 +334,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 an ARM64 architecture 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/arm64/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 ---> - H<emphasis role='blue'>i</emphasis>gh Memory Support ---> - (X) <emphasis role='blue'>6</emphasis>4GB [HIGHMEM64G]</screen> diff --git a/chapter10/kernel/kernel-config.py b/chapter10/kernel/kernel-config.py index eac2b6c4d..349372945 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': 'arm64' } main_dep = {} def expand_var(s): diff --git a/chapter10/kernel/systemd.xml b/chapter10/kernel/systemd.xml index c41b26673..88d04a67a 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) ---> [EXPERT] -<emphasis role='blue'>P</emphasis>rocessor type and features ---> - [*] <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 Features ---> + [*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel image [RELOCATABLE] + [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image [RANDOMIZE_BASE] <emphasis role='blue'>G</emphasis>eneral architecture-dependent options ---> [*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR] diff --git a/chapter10/kernel/sysv.xml b/chapter10/kernel/sysv.xml index c61208c67..64da189b8 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) ---> [EXPERT] -<emphasis role='blue'>P</emphasis>rocessor type and features ---> - [*] <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 Features ---> + [*] <emphasis role='blue'>B</emphasis>uild a relocatable kernel image [RELOCATABLE] + [*] <emphasis role='blue'>R</emphasis>andomize the address of the kernel image [RANDOMIZE_BASE] <emphasis role='blue'>G</emphasis>eneral architecture-dependent options ---> [*] <emphasis role='blue'>S</emphasis>tack Protector buffer overflow detection [STACKPROTECTOR] 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 ---> - [*] <emphasis role='blue'>S</emphasis>upport x2apic [X86_X2APIC] - -<emphasis role='blue'>D</emphasis>evice Drivers ---> - [*] <emphasis role='blue'>P</emphasis>CI support ---> [PCI] - [*] M<emphasis role='blue'>e</emphasis>ssage Signaled Interrupts (MSI and MSI-X) [PCI_MSI] - [*] <emphasis role='blue'>I</emphasis>OMMU Hardware Support ---> [IOMMU_SUPPORT] - [*] <emphasis role='blue'>S</emphasis>upport for Interrupt Remapping [IRQ_REMAP]</screen> diff --git a/git-version.sh b/git-version.sh index 5d8d32e5d..0e5d94da3 100755 --- a/git-version.sh +++ b/git-version.sh @@ -52,7 +52,7 @@ esac full_date="$month $day$suffix, $year" sha="$(git describe --abbrev=1)" -rev=$(echo "$sha" | sed 's/-g[^-]*$//') +rev=arm64-$(echo "$sha" | sed 's/-g[^-]*$//') version="$rev" versiond="$rev-systemd" diff --git a/prologue/architecture.xml b/prologue/architecture.xml index d416780e4..915fad34d 100644 --- a/prologue/architecture.xml +++ b/prologue/architecture.xml @@ -10,41 +10,25 @@ <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 -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> - -<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 -only. Building a <quote>multi-lib</quote> system requires compiling many +<para>The target architectures of this LFS edition are ARM64 (sometimes +called AArch64) CPUs. On the other hand, the instructions in this book may +work on 32-bit ARM CPUs with some modifications. To build a system that +utilizes one of these alternative 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 other distribution that +targets the architecture that you have.</para> + +<para>The build results from this LFS edition is considered a +<quote>pure</quote> 64-bit system. That is, it supports 64-bit executables +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. 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 +base Linux system. Some 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/standards.xml b/prologue/standards.xml index 6ab757a07..538d0864d 100644 --- a/prologue/standards.xml +++ b/prologue/standards.xml @@ -35,8 +35,8 @@ Runtime Languages, and Imaging. Some parts of Core and Desktop specifications are architecture specific. There are also two trial specifications: Gtk3 and Graphics. LFS attempts to conform to the LSB - specifications for the IA32 (32-bit x86) or AMD64 (x86_64) - architectures discussed in the previous section.</para> + generic specifications. The architecture specific part of LSB does + not exist for ARM64.</para> <note><para>Many people do not agree with these requirements. The main purpose of the LSB is to ensure that proprietary software |