Changeset 6db606f


Ignore:
Timestamp:
08/28/2022 02:19:14 PM (20 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
11.2, 11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/llvm18, xry111/soup3, xry111/xf86-video-removal
Children:
1977aef
Parents:
6851ade
Message:

grub-efi: add minimal configuration with --removable

It's needed for e.g. setting the boot process on a 32-bit LFS with
64-bit UEFI firmware.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • postlfs/filesystems/uefi-bootloaders/grub-setup.xml

    r6851ade r6db606f  
    242242
    243243  <sect2>
     244    <title>Minimal Boot Configuration with GRUB and EFI</title>
     245
     246    <para>
     247      On UEFI based systems, GRUB works by installing an EFI application
     248      (a special kind of executable) into the ESP.  The EFI firmware will
     249      search boot loaders in EFI applications from boot entries recorded
     250      in EFI variables, and additionally a hardcoded path
     251      <filename>EFI/BOOT/BOOTX64.EFI</filename>.  Normally, a boot loader
     252      should be installed into a custom path and the path should be recorded
     253      into the EFI variables.  The use of the hardcoded path should be
     254      avoided as much as possible.  However, in some cases we have to use
     255      the hardcoded path:
     256    </para>
     257
     258    <itemizedlist>
     259      <listitem>
     260        <para>
     261          The system is not booted with EFI yet, causing EFI variables
     262          inaccessible.
     263        </para>
     264      </listitem>
     265      <listitem>
     266        <para>
     267          The EFI firmware is 64-bit but the LFS system is 32-bit, causing
     268          EFI variables inaccessible because the kernel cannot invoke EFI
     269          runtime services with a different virtual address length.
     270        </para>
     271      </listitem>
     272      <listitem>
     273        <para>
     274          LFS is built for a Live USB, so we cannot rely on EFI variables
     275          which is stored in NVRAM or EEPROM on the local machine.
     276        </para>
     277      </listitem>
     278      <listitem>
     279        <para>
     280          You are unable or unwilling to install
     281          <application>efibootmgr</application> for manipulating boot
     282          entries in EFI variables.
     283        </para>
     284      </listitem>
     285    </itemizedlist>
     286
     287    <para>
     288      In these cases, following this section to install GRUB EFI
     289      application into the hardcoded path and make a minimal boot
     290      configuration. Otherwise it's better to skip this section and read the
     291      remaining sections to set up the boot configuration in a normal way.
     292    </para>
     293
     294    <para>
     295      To install GRUB with the EFI application installed into the hardcoded
     296      path <filename>EFI/BOOT/BOOTX64.EFI</filename>, first ensure the boot
     297      partition mounted at <filename class="directory">/boot</filename>
     298      and the ESP mounted at
     299      <filename class="directory">/boot/efi</filename>.  Then as the &root;
     300      user, run the command:
     301    </para>
     302
     303    <note>
     304      <para>
     305        The command will overwrite
     306        <filename>/boot/efi/EFI/BOOT/BOOTX64.EFI</filename>.  It may break a
     307        bootloader already installed there.  Back it up if you are not sure.
     308      </para>
     309    </note>
     310
     311    <screen role="nodump"><userinput>grub-install --target=x86_64-efi --removable</userinput></screen>
     312
     313    <para>
     314      The command would install GRUB EFI application into the hardcoded path
     315      <filename>/boot/efi/EFI/BOOT/BOOTX64.EFI</filename>, so the EFI
     316      firmware can find and load it.  The remaining GRUB files are installed
     317      into <filename class="directory">/boot/grub</filename> directory and
     318      will be loaded by <filename>BOOTX64.EFI</filename> during system boot.
     319    </para>
     320
     321    <note>
     322      <para>
     323        The EFI firmware usually prefers the EFI applications with the path
     324        recorded in boot entries stored in EFI variables, to the EFI
     325        application at the hardcoded path.  So you may need to invoke the
     326        boot selection menu or firmware setting interface to select the
     327        newly installed GRUB manually on the next boot.  Read the manual of
     328        your motherboard or laptop to figure out how.
     329      </para>
     330    </note>
     331
     332    <para>
     333      If you've followed this section and set up a minimal boot
     334      configuration, now skip until
     335      <quote>Creating the GRUB Configuration File</quote>.
     336    </para>
     337  </sect2>
     338
     339  <sect2>
    244340    <title>Mount the EFI Variable File System</title>
    245341
     
    278374        <filename class="directory">/sys/firmware/efi</filename> will be
    279375        missing. In this case you should boot the system in UEFI mode with
    280         the emergency boot disk created as above.
     376        the emergency boot disk or minimal boot configuration created as
     377        above, then mount
     378        <systemitem class="filesystem">efivarfs</systemitem> and continue.
    281379      </para>
    282380    </warning>
Note: See TracChangeset for help on using the changeset viewer.