[lfs] branch zeckma/uefi-support updated: GRUB: Address Bruce's private review.

"Git Owner" ([email protected] via lfs-book Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.book
Message-ID <177532971489.8170.3448001260832861126@rivendell.linuxfromscratch.org>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch zeckma/uefi-support
in repository lfs.

The following commit(s) were added to refs/heads/zeckma/uefi-support by this push:
     new adf89fa11 GRUB: Address Bruce's private review.
adf89fa11 is described below

commit adf89fa11d233f99dc26e1f6a934c5af7a2385a0
Author: Zeckmathederg <[email protected]>
AuthorDate: Sat Apr 4 13:11:41 2026 -0600

    GRUB: Address Bruce's private review.
---
 chapter08/grub.xml | 70 +++++++++++++++++++++++++++++++++++++++++++-----------
 chapter10/grub.xml | 50 +++++++++++++++++++++++++-------------
 2 files changed, 90 insertions(+), 30 deletions(-)

diff --git a/chapter08/grub.xml b/chapter08/grub.xml
index f0c3bfca9..5d026bed4 100644
--- a/chapter08/grub.xml
+++ b/chapter08/grub.xml
@@ -26,12 +26,13 @@
     <para>The GRUB package contains the GRand Unified Bootloader.</para>
 
     <note><para>This page is split up into multiple sections aimed to install
-    for a specific boot method (BIOS, 64-bit UEFI, and 32-bit UEFI). You may
-    skip other sections to go to the boot method you need. If in doubt, you may
-    follow all of the sections at the cost of extra build time. After you have
-    installed support for your boot method, then continue building the rest of
-    the packages in this chapter. Making your LFS system bootable with GRUB
-    will be discussed in <xref linkend="ch-bootable-grub"
+    for a specific boot method (BIOS, 64-bit UEFI, and 32-bit UEFI). GRUB
+    cannot be built with all the boot method architectures at once.</para>
+    <para>You may skip other sections to go to the boot method you need. If in
+    doubt, you may follow all of the sections at the cost of extra build time.
+    After you have installed support for your boot method, then continue
+    building the rest of the packages in this chapter. Making your LFS system
+    bootable with GRUB will be discussed in <xref linkend="ch-bootable-grub"
     role='.'/></para></note>
 
     <warning>
@@ -119,13 +120,11 @@
 
 <screen><userinput remap="pre">make clean</userinput></screen>
 
-    <!-- See https://wiki.linuxfromscratch.org/lfs/ticket/5857. Remove this at
-    next grub version -->
     <para>Fix a bug introduced in grub-2.14:</para>
 
 <screen><userinput remap="pre">sed 's/--image-base/--nonexist-linker-option/' -i configure</userinput></screen>
 
-    <para>Now build GRUB with 64-bit UEFI support:</para>
+    <para>Now configure GRUB for 64-bit UEFI support:</para>
 
 <screen><userinput remap="configure">./configure --prefix=/usr       \
             --sysconfdir=/etc   \
@@ -134,7 +133,30 @@
             --disable-efiemu    \
             --disable-werror</userinput></screen>
 
-    <para>Compile the package again:</para>
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--target=x86_64</parameter></term>
+        <listitem>
+          <para>This defines that the UEFI firmware architecture is x86_64,
+          which GRUB should target.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--with-platform=efi</parameter></term>
+        <listitem>
+          <para>This specifies that EFI is a platform GRUB should target.
+          In combination with <parameter>--target=x86_64</parameter>, GRUB will
+          have the ability to target the <literal>x86_64-efi</literal>
+          platform.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package for 64-bit UEFI support:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
@@ -155,13 +177,11 @@
 
 <screen><userinput remap="pre">make clean</userinput></screen>
 
-    <!-- See https://wiki.linuxfromscratch.org/lfs/ticket/5857. Remove this at
-    next grub version -->
     <para>Fix a bug introduced in grub-2.14:</para>
 
 <screen><userinput remap="pre">sed 's/--image-base/--nonexist-linker-option/' -i configure</userinput></screen>
 
-    <para>Now build GRUB with 32-bit UEFI support:</para>
+    <para>Now configure GRUB for 32-bit UEFI support:</para>
 
 <screen><userinput remap="configure">./configure --prefix=/usr       \
             --sysconfdir=/etc   \
@@ -170,7 +190,23 @@
             --disable-efiemu    \
             --disable-werror</userinput></screen>
 
-    <para>Compile the package again:</para>
+    <variablelist>
+      <title>The meaning of the new configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--target=i386</parameter></term>
+        <listitem>
+          <para>This defines that the UEFI firmware architecture is
+          i386/32-bit, which GRUB should target. In combination with
+          <parameter>--with-platform=efi</parameter>, GRUB will
+          have the ability to target the <literal>i386-efi</literal>
+          platform.</para>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+    <para>Compile the package for 32-bit UEFI support:</para>
 
 <screen><userinput remap="make">make</userinput></screen>
 
@@ -203,6 +239,12 @@
       </seglistitem>
     </segmentedlist>
 
+    <note><para>
+      <filename class="directory">/usr/lib/grub</filename> will have different
+      contents based on what platform(s) you have installed GRUB for. Namely,
+      there will be different GRUB modules for each platform.
+    </para></note>
+
     <variablelist>
       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
       <?dbfo list-presentation="list"?>
diff --git a/chapter10/grub.xml b/chapter10/grub.xml
index 3f3bdd07d..c18f62c6d 100644
--- a/chapter10/grub.xml
+++ b/chapter10/grub.xml
@@ -22,10 +22,10 @@
     <warning><para>Configuring GRUB incorrectly can render your system
     inoperable without an alternate boot device such as a CD-ROM or bootable
     USB drive. This section is not required to boot your LFS system.  You may
-    just want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or
-    LILO.</para></warning>
+    just want to modify your current boot loader, e.g. Grub-Legacy or
+    GRUB2.</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
@@ -73,8 +73,10 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
 
     <para>If booting the system via UEFI, GRUB works by storing the main
     GRUB image as a PE-COFF executable file at a standard location in the
-    EFI System Partition. The EFI firmware loads the file at the standard
-    location and executes it.</para>
+    EFI System Partition: <filename>EFI/BOOT/BOOTX64.EFI</filename> (or
+    <filename>EFI/BOOT/BOOTIA32.EFI</filename> for
+    <literal>i386-efi</literal>). The UEFI firmware loads it from the
+    standard location and executes it, launching GRUB.</para>
 
     <para>Many GRUB functions (including booting the Linux kernel) are
     not included in the main GRUB image. Instead, they are stored in a file
@@ -87,21 +89,36 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
     and load other modules.</para>
 
     <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
-    (suggested size is 200 MB) partition just for boot information. That way
-    for each build, whether it's LFS or a commercial distro, it can access the
-    same boot files and can access can any booted system. If you choose to do
-    this, you will need to mount the separate partition, move all files in the
-    current <filename class="directory">/boot</filename> directory (e.g. the
-    Linux kernel you just built in the previous section) to the new partition.
+    affects the configuration. One recommendation is to have a separate small
+    (suggested size is 200 MB) partition just for boot information. In doing
+    so, not just LFS, but any Linux distribution, can access the same boot
+    files, and in turn any booted system. If you choose to do this, you will
+    need to mount the separate partition, move all files in the current
+    <filename class="directory">/boot</filename> directory (e.g. the Linux
+    kernel you just built in the previous section) to the new partition.
     You will then need to unmount the partition and remount it as <filename
-    class="directory">/boot</filename>.  If you do this, be sure to update
+    class="directory">/boot</filename>. If you do this, be sure to update
     <filename>/etc/fstab</filename>.</para>
 
+    <note>
+      <para><filename class="directory">/boot</filename> can reside on the
+      host. With this configuration, you should bind-mount it so that LFS can
+      access the directory.</para>
+      <para>Outside the chroot, you should bind <filename
+      class="directory">/boot</filename> as such:</para>
+<screen role="nodump"><userinput>mount -v --bind /boot $LFS/boot</userinput></screen>
+      <para>Now <filename class="directory">/boot</filename> from the host
+      should be accessible within the LFS chroot.</para>
+    </note>
+
     <para>Leaving <filename class="directory">/boot</filename> on
     the current LFS partition will also work, but configuration
     for multiple systems is more difficult.</para>
 
+    <para>For examples and more information on boot partition layouts, looking
+    at <xref linkend="ch-partitioning-creatingpartition"/> may be
+    informative.</para>
+
     <para>Using the above information, determine the appropriate
     designator for the root partition (or boot partition, if a separate
     one is used). For the following example, it is assumed that the root
@@ -165,7 +182,7 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
         <filename>/boot/efi/EFI/BOOT/BOOTX64.EFI</filename> file.
         If it already exists, it's likely that it's the entry of another boot
         loader (for example the GRUB installation from the host distro, or the
-        Windows Boot Manager). Backup the file so it can be restored later,
+        Windows Boot Manager). Backup the file so it can be restored later
         or loaded as a secondary boot loader by the new GRUB installation
         from LFS.</para>
       </warning>
@@ -209,7 +226,8 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
           First install the package, then mount the EFI variable file system if
           it isn't already mounted:
         </para>
-<screen role="nodump"><userinput>mountpoint /sys/firmware/efi/efivars || mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars</userinput></screen>
+<screen role="nodump"><userinput>mountpoint /sys/firmware/efi/efivars ||
+  mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars</userinput></screen>
         <para>
           Now create a boot entry for the EFI:
         </para>
@@ -227,7 +245,7 @@ xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></
         <para>
           Now unmount the EFI variable file system<phrase revision='sysv'>,
           which should no longer be needed for the boot process, as the file
-          system is only used for EFI manipulation</phrase>:
+          system is only used for EFI variable manipulation</phrase>:
         </para>
 <screen role="nodump"><userinput>umount -v /sys/firmware/efi/efivars</userinput></screen>
       </note>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-book
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.