Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter10/grub.xml

    r5353a19 r8f641ee  
    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
    24       <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.
     28      <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>,
     29      but replace <parameter>--target=x86_64-efi</parameter> with
     30      <parameter>--target=arm64-efi</parameter> for the ARM64 system.
     31    </para>
     32    <para>
     33      If your system does not support UEFI or you don't want to use it,
     34      you'll need to figure out how to configure the booting process of
     35      the system on your own.
    2536    </para>
    2637  </note>
     
    3546    LILO.</para></warning>
    3647
    37     <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
     48    <para>Ensure that an emergency boot disk is ready to <quote>rescue</quote>
    3849    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>
    44 
    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 
     50    already have a boot device, you can create one.  To create a emergency
     51    boot device for UEFI, consult section <quote>Create an Emergency Boot
     52    Disk</quote> in
     53        <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.</para>
     54
     55  </sect2>
     56
     57  <sect2>
     58    <title>Turn off Secure Boot</title>
     59
     60    <para>LFS does not have the essential packages to support Secure Boot.
     61    To set up the boot process following the instructions in this section,
     62    Secure Boot must be turned off from the configuration interface of the
     63    firmware. Read the documentation provided by the manufacturer of your
     64    system to find out how.</para>
    4965  </sect2>
    5066
     
    7288    <title>Setting Up the Configuration</title>
    7389
    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>
     90    <para>GRUB works by creating an EFI executable in the EFI System
     91    Partition (ESP).  You can find the ESP with:</para>
     92
     93<screen role="nodump"><userinput>fdisk -l | grep 'EFI System'</userinput></screen>
     94
     95    <para>If no ESP exists on your hard drive (for example, you are building
     96    LFS on a fresh new system with a Live CD as the host distro), read
     97    <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>
     98    for the instruction to create an ESP on your hard drive.</para>
     99
     100    <para>If the ESP is not mounted at
     101    <filename class="directory">/boot/efi</filename> (in the chroot),
     102    mount it now:</para>
     103
     104<screen role="nodump"><userinput>mkdir -pv /boot/efi
     105mount /boot/efi</userinput></screen>
     106
     107    <note>
     108      <para>The path to the device node is intentionally omitted in the
     109      command.  We expect the entry for mounting the ESP to
     110      <filename class="directory">/boot/efi</filename> is already in
     111      <filename>/etc/fstab</filename>.  Add the entry before running the
     112      command if you forgot to create an entry for the ESP in
     113      <xref linkend="ch-bootable-fstab"/>.</para>
     114    </note>
    78115
    79116    <para>The location of the boot partition is a choice of the user that
     
    99136
    100137    <para>Install the GRUB files into <filename
    101     class="directory">/boot/grub</filename> and set up the boot track:</para>
     138    class="directory">/boot/grub</filename> and the GRUB EFI executable into
     139    <filename class="directory">/boot/efi/EFI/BOOTAA64.EFI</filename>:</para>
    102140
    103141    <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>
     142      <para>The following command will overwrite
     143      <filename>BOOTAA64.EFI</filename>. Do not run the command if this is
     144      not desired, for example, if it contains a third party boot manager.
     145      You can backup it with <command>cp</command> as it's a regular
     146      file.</para>
    107147    </warning>
    108148
    109 <screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
     149<screen role="nodump"><userinput>grub-install --removable</userinput></screen>
    110150
    111151    <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>
     152      <para>
     153        <parameter>--removable</parameter> may seem strange here.  The UEFI
     154        firmware searches EFI executables for boot loaders in a hardcoded
     155        path, <filename>EFI/BOOTAA64.EFI</filename> in the ESP, and other
     156        boot loader paths listed in the EFI variables.  We've not installed
     157        the utilities for manipulating EFI variables so we need to install
     158        the EFI executable into the hardcoded path.  The hardcoded path is
     159        usually used by removable devices (for example, USB thumb devices)
     160        so the <command>grub-install</command> option for this purpose is
     161        named <parameter>--removable</parameter>.
     162      </para>
     163      <para>
     164        UEFI implementation usually prefers the boot loaders with paths
     165        recorded in an EFI variable, to the boot loader with the hardcoded
     166        search path.  You may need to invoke the boot device selection menu
     167        or setting interface of your EFI firmware on next boot to explicitly
     168        select the bootloader.
     169      </para>
     170      <para>
     171        Some UEFI implementation may completely skip the hardcoded path if
     172        there are other boot loaders in the same hard drive with paths
     173        recorded in an EFI variable.  Then you need to create an EFI
     174        variable for the newly installed boot loader.  Install
     175        <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
     176        then run the following commands:
     177
     178<screen role="nodump"><userinput>mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
     179efibootmgr -B -L LFS || true
     180efibootmgr -c -L LFS -l '\EFI\BOOT\BOOTAA64.EFI' -d /dev/sda
     181umount /sys/firmware/efi/efivars</userinput></screen>
     182
     183        Replace <filename>/dev/sda</filename> with the device node of the
     184        hard drive where you are installing GRUB into.  For some UEFI
     185        firmwares, <option>-e 3</option> option may be needed for the
     186        <command>efibootmgr -c</command> command.
     187      </para>
    118188    </note>
    119189
Note: See TracChangeset for help on using the changeset viewer.