Changeset c84ec38

08/26/2022 12:31:34 PM (7 months ago)
Xi Ruoyao <xry111@…>
Xi Ruoyao <xry111@…> (08/26/2022 11:13:22 AM)
Xi Ruoyao <xry111@…> (08/26/2022 12:31:34 PM)

arm64: grub cfg: adapt for minimal UEFI boot

1 edited


  • chapter10/grub.xml

    rcfc0780 rc84ec38  
    1919  <note>
    2020    <para>
    21       If your system has UEFI support and you wish to boot LFS with UEFI,
    22       you should skip this page, and config GRUB with UEFI support
     21      This section assume your system has UEFI support and you wish to boot
     22      LFS with UEFI and GRUB built following the instructions in Chapter 8.
     23    </para>
     24    <para>
     25      If you've installed GRUB for UEFI with optional dependencies following
     26      BLFS, you should skip this page, and config GRUB with UEFI support
    2327      using the instructions provided in
    2428      <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.
     29    </para>
     30    <para>
     31      If your system does not support UEFI or you don't want to use it,
     32      you'll need to figure out how to configure the booting process of
     33      the system on your own.
    2534    </para>
    2635  </note>
    3544    LILO.</para></warning>
    37     <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
     46    <para>Ensure that an emergency boot disk is ready to <quote>rescue</quote>
    3847    the computer if the computer becomes unusable (un-bootable).  If you do not
    39     already have a boot device, you can create one.  In order for the procedure
    40     below to work, you need to jump ahead to BLFS and install
    41     <userinput>xorriso</userinput> from the <ulink
    42     url="&blfs-book;multimedia/libisoburn.html">
    43     libisoburn</ulink> package.</para>
    45 <screen role="nodump"><userinput>cd /tmp
    46 grub-mkrescue --output=grub-img.iso
    47 xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></screen>
     48    already have a boot device, you can create one.  To create a emergency
     49    boot device for UEFI, consult section <quote>Create an Emergency Boot
     50    Disk</quote> in
     51        <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.</para>
     53  </sect2>
     55  <sect2>
     56    <title>Turn off Secure Boot</title>
     58    <para>LFS does not have the essential packages to support Secure Boot.
     59    To set up the boot process following the instructions in this section,
     60    Secure Boot must be turned off from the configuration interface of the
     61    firmware. Read the documentation provided by the manufacturer of your
     62    system to find out how.</para>
    4963  </sect2>
    7286    <title>Setting Up the Configuration</title>
    74     <para>GRUB works by writing data to the first physical track of the
    75     hard disk.  This area is not part of any file system.  The programs
    76     there access GRUB modules in the boot partition.  The default location
    77     is /boot/grub/.</para>
     88    <para>GRUB works by creating an EFI executable in the EFI System
     89    Partition (ESP).  You can find the ESP with:</para>
     91<screen role="nodump"><userinput>fdisk -l | grep 'EFI System'</userinput></screen>
     93    <para>If no ESP exists on your hard drive (for example, you are building
     94    LFS on a fresh new system with a Live CD as the host distro), read
     95    <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>
     96    for the instruction to create an ESP on your hard drive.</para>
     98    <para>If the ESP is not mounted at
     99    <filename class="directory">/boot/efi</filename> (in the chroot),
     100    mount it now:</para>
     102<screen role="nodump"><userinput>mount /boot/efi</userinput></screen>
     104    <note>
     105      <para>The path to the device node is intentionally omitted in the
     106      command.  We expect the entry for mounting the ESP to
     107      <filename class="directory">/boot/efi</filename> is already in
     108      <filename>/etc/fstab</filename>.  Add the entry before running the
     109      command if you forgot to create an entry for the ESP in
     110      <xref linkend="ch-bootable-fstab"/>.</para>
     111    </note>
    79113    <para>The location of the boot partition is a choice of the user that
    100134    <para>Install the GRUB files into <filename
    101     class="directory">/boot/grub</filename> and set up the boot track:</para>
     135    class="directory">/boot/grub</filename> and the GRUB EFI executable into
     136    <filename class="directory">/boot/efi/EFI/BOOTAA64.EFI</filename>:</para>
    103138    <warning>
    104       <para>The following command will overwrite the current boot loader. Do not
    105       run the command if this is not desired, for example, if using a third party
    106       boot manager to manage the Master Boot Record (MBR).</para>
     139      <para>The following command will overwrite
     140      <filename>BOOTAA64.EFI</filename>. Do not run the command if this is
     141      not desired, for example, if it contains a third party boot manager.
     142      You can backup it with <command>cp</command> as it's a regular
     143      file.</para>
    107144    </warning>
    109 <screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
     146<screen role="nodump"><userinput>grub-install --removable</userinput></screen>
    111148    <note>
    112       <para>If the system has been booted using UEFI,
    113       <command>grub-install</command> will try to install files for the
    114       <emphasis>x86_64-efi</emphasis> target, but those files
    115       have not been installed in <xref linkend="chapter-building-system"/>.
    116       If this is the case, add <option>--target i386-pc</option> to the
    117       command above.</para>
     149      <para>
     150        <parameter>--removable</parameter> may seem strange here.  The UEFI
     151        firmware searches EFI executables for boot loaders in a hardcoded
     152        path, <filename>EFI/BOOTAA64.EFI</filename> in the ESP, and other
     153        boot loader paths listed in the EFI variables.  We've not installed
     154        the utilities for manipulating EFI variables so we need to install
     155        the EFI executable into the hardcoded path.  The hardcoded path is
     156        usually used by removable devices (for example, USB thumb devices)
     157        so the <command>grub-install</command> option for this purpose is
     158        named <parameter>--removable</parameter>.
     159      </para>
     160      <para>
     161        UEFI implementation usually prefers the boot loaders with paths
     162        recorded in an EFI variable, to the boot loader with the hardcoded
     163        search path.  You may need to invoke the boot device selection menu
     164        or setting interface of your EFI firmware on next boot to explicitly
     165        select the bootloader.
     166      </para>
     167      <para>
     168        Some UEFI implementation may completely skip the hardcoded path if
     169        there are other boot loaders in the same hard drive with paths
     170        recorded in an EFI variable.  Then you need to create an EFI
     171        variable for the newly installed boot loader.  Install
     172        <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
     173        then run the following commands:
     174<screen role="nodump"><userinput>mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
     175efibootmgr -c -L LFS -l \EFI\BOOT\BOOTAA64.EFI -d /dev/sda</userinput></screen>
     176        Replace <filename>/dev/sda</filename> with the device node of the
     177        hard drive where you are installing GRUB into.
     178      </para>
    118179    </note>
Note: See TracChangeset for help on using the changeset viewer.