Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter10/grub.xml

    rc7f74cd r53415749  
    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 configure 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 configure 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
     
    100137
    101138    <para>Install the GRUB files into <filename
    102     class="directory">/boot/grub</filename> and set up the boot track:</para>
     139    class="directory">/boot/grub</filename> and the GRUB EFI executable into
     140        <filename class="directory">/boot/efi/EFI/BOOT/BOOTAA64.EFI</filename>:</para>
    103141
    104142    <warning>
    105       <para>The following command will overwrite the current boot loader. Do not
    106       run the command if this is not desired, for example, if using a third party
    107       boot manager to manage the Master Boot Record (MBR).</para>
     143      <para>The following command will overwrite
     144      <filename>BOOTAA64.EFI</filename>. Do not run the command if this is
     145      not desired, for example, if it contains a third party boot manager.
     146      You can backup it with <command>cp</command> as it's a regular
     147      file.</para>
    108148    </warning>
    109149
    110 <screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
     150<screen role="nodump"><userinput>grub-install --removable</userinput></screen>
    111151
    112152    <note>
    113       <para>If the system has been booted using UEFI,
    114       <command>grub-install</command> will try to install files for the
    115       <emphasis>x86_64-efi</emphasis> target, but those files
    116       have not been installed in <xref linkend="chapter-building-system"/>.
    117       If this is the case, add <option>--target i386-pc</option> to the
    118       command above.</para>
     153      <para>
     154        <parameter>--removable</parameter> may seem strange here.  The UEFI
     155        firmware searches EFI executables for boot loaders in a hardcoded
     156        path, <filename>EFI/BOOT/BOOTAA64.EFI</filename> in the ESP, and other
     157        boot loader paths listed in the EFI variables.  We've not installed
     158        the utilities for manipulating EFI variables so we need to install
     159        the EFI executable into the hardcoded path.  The hardcoded path is
     160        usually used by removable devices (for example, USB thumb devices)
     161        so the <command>grub-install</command> option for this purpose is
     162        named <parameter>--removable</parameter>.
     163      </para>
     164      <para>
     165        UEFI implementation usually prefers the boot loaders with paths
     166        recorded in an EFI variable, to the boot loader with the hardcoded
     167        search path.  You may need to invoke the boot device selection menu
     168        or setting interface of your EFI firmware on next boot to explicitly
     169        select the bootloader.
     170      </para>
     171      <para>
     172        Some UEFI implementation may completely skip the hardcoded path if
     173        there are other boot loaders in the same hard drive with paths
     174        recorded in an EFI variable.  Then you need to create an EFI
     175        variable for the newly installed boot loader.  Install
     176        <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
     177        then run the following commands:
     178
     179<screen role="nodump"><userinput>mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
     180efibootmgr -B -L LFS || true
     181efibootmgr -c -L LFS -l '\EFI\BOOT\BOOTAA64.EFI' -d /dev/sda
     182umount /sys/firmware/efi/efivars</userinput></screen>
     183
     184        Replace <filename>/dev/sda</filename> with the device node of the
     185        hard drive where you are installing GRUB into.  For some UEFI
     186        firmwares, <option>-e 3</option> option may be needed for the
     187        <command>efibootmgr -c</command> command.
     188      </para>
    119189    </note>
    120190
     
    144214insmod ext2
    145215set root=(hd0,2)
     216
     217insmod all_video
    146218
    147219menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" {
Note: See TracChangeset for help on using the changeset viewer.