Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter10/grub.xml

    r9d21a41 r360fdfca  
    1919  <note>
    2020    <para>
    21       This section assume your system has UEFI support and you wish to boot
    22       LFS with UEFI.
    23       If your system does not support UEFI or you don't want to use it,
    24       you'll need to figure out how to configure the booting process of
    25       the system on your own.
     21      If your system has UEFI support and you wish to boot LFS with UEFI,
     22      you should skip the instructions in this page but still learn the
     23      syntax of <filename>grub.cfg</filename> and the method to specify
     24      a partition in the file from this page, and configure GRUB with UEFI
     25      support using the instructions provided in
     26      <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.
    2627    </para>
    2728  </note>
     
    3637    LILO.</para></warning>
    3738
    38     <para>Ensure that an emergency boot disk is ready to <quote>rescue</quote>
     39    <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
    3940    the computer if the computer becomes unusable (un-bootable).  If you do not
    40     already have a boot device, you can create one.  To create a emergency
    41     boot device for UEFI, consult section <quote>Create an Emergency Boot
    42     Disk</quote> in
    43         <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.</para>
    44 
    45   </sect2>
    46 
    47   <sect2>
    48     <title>Turn off Secure Boot</title>
    49 
    50     <para>LFS does not have the essential packages to support Secure Boot.
    51     To set up the boot process following the instructions in this section,
    52     Secure Boot must be turned off from the configuration interface of the
    53     firmware. Read the documentation provided by the manufacturer of your
    54     system to find out how.</para>
     41    already have a boot device, you can create one.  In order for the procedure
     42    below to work, you need to jump ahead to BLFS and install
     43    <userinput>xorriso</userinput> from the <ulink
     44    url="&blfs-book;multimedia/libisoburn.html">
     45    libisoburn</ulink> package.</para>
     46
     47<screen role="nodump"><userinput>cd /tmp
     48grub-mkrescue --output=grub-img.iso
     49xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></screen>
     50
    5551  </sect2>
    5652
     
    7874    <title>Setting Up the Configuration</title>
    7975
    80     <para>GRUB works by creating an EFI executable in the EFI System
    81     Partition (ESP).  You can find the ESP with:</para>
    82 
    83 <screen role="nodump"><userinput>fdisk -l | grep 'EFI System'</userinput></screen>
    84 
    85     <para>If no ESP exists on your hard drive (for example, you are building
    86     LFS on a fresh new system with a Live CD as the host distro), read
    87     <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>
    88     for the instruction to create an ESP on your hard drive.</para>
    89 
    90     <para>If the ESP is not mounted at
    91     <filename class="directory">/boot/efi</filename> (in the chroot),
    92     mount it now:</para>
    93 
    94 <screen role="nodump"><userinput>mkdir -pv /boot/efi
    95 mount /boot/efi</userinput></screen>
    96 
    97     <note>
    98       <para>The path to the device node is intentionally omitted in the
    99       command.  We expect the entry for mounting the ESP to
    100       <filename class="directory">/boot/efi</filename> is already in
    101       <filename>/etc/fstab</filename>.  Add the entry before running the
    102       command if you forgot to create an entry for the ESP in
    103       <xref linkend="ch-bootable-fstab"/>.</para>
    104     </note>
     76    <para>GRUB works by writing data to the first physical track of the
     77    hard disk.  This area is not part of any file system.  The programs
     78    there access GRUB modules in the boot partition.  The default location
     79    is /boot/grub/.</para>
    10580
    10681    <para>The location of the boot partition is a choice of the user that
     
    127102
    128103    <para>Install the GRUB files into <filename
    129     class="directory">/boot/grub</filename> and the GRUB EFI executable into
    130     <filename>/boot/efi/EFI/BOOT/BOOTLOONGARCH64.EFI</filename>:</para>
     104    class="directory">/boot/grub</filename> and set up the boot track:</para>
    131105
    132106    <warning>
    133       <para>The following command will overwrite
    134       <filename>BOOTLOONGARCH64.EFI</filename>. Do not run the command if
    135       this is not desired, for example, if it contains a third party boot
    136       manager.  You can backup it with <command>cp</command> as it's a
    137       regular file.</para>
     107      <para>The following command will overwrite the current boot loader. Do not
     108      run the command if this is not desired, for example, if using a third party
     109      boot manager to manage the Master Boot Record (MBR).</para>
    138110    </warning>
    139111
    140 <screen role="nodump"><userinput>grub-install --removable</userinput></screen>
     112<screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
    141113
    142114    <note>
    143       <para>
    144         <parameter>--removable</parameter> may seem strange here.  The UEFI
    145         firmware searches EFI executables for boot loaders in a hardcoded
    146         path, <filename>EFI/BOOT/BOOTLOONGARCH64.EFI</filename> in the ESP, and other
    147         boot loader paths listed in the EFI variables.  We've not installed
    148         the utilities for manipulating EFI variables so we need to install
    149         the EFI executable into the hardcoded path.  The hardcoded path is
    150         usually used by removable devices (for example, USB thumb devices)
    151         so the <command>grub-install</command> option for this purpose is
    152         named <parameter>--removable</parameter>.
    153       </para>
    154       <para>
    155         UEFI implementation usually prefers the boot loaders with paths
    156         recorded in an EFI variable, to the boot loader with the hardcoded
    157         search path.  You may need to invoke the boot device selection menu
    158         or setting interface of your EFI firmware on next boot to explicitly
    159         select the bootloader.
    160       </para>
    161       <para>
    162         Some UEFI implementation may completely skip the hardcoded path if
    163         there are other boot loaders in the same hard drive with paths
    164         recorded in an EFI variable.  Then you need to create an EFI
    165         variable for the newly installed boot loader.  Install
    166         <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
    167         and follow
    168         <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS
    169         instruction</ulink> to run the <command>grub-install</command>
    170         command without the <parameter>--removable</parameter> option then.
    171       </para>
     115      <para>If the system has been booted using UEFI,
     116      <command>grub-install</command> will try to install files for the
     117      <emphasis>x86_64-efi</emphasis> target, but those files
     118      have not been installed in <xref linkend="chapter-building-system"/>.
     119      If this is the case, add <option>--target i386-pc</option> to the
     120      command above.</para>
    172121    </note>
    173122
     
    187136insmod ext2
    188137set root=(hd0,2)
    189 
    190 insmod efi_gop
    191138
    192139menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" {
     
    206153      into the main <application>GRUB</application> image (installed into
    207154      the MBR or the GRUB BIOS partition) to access the other modules
    208       (in <filename class='directory'>/boot/grub/loongarch64-efi</filename>) without
     155      (in <filename class='directory'>/boot/grub/i386-pc</filename>) without
    209156      a chicken-or-egg issue, so with a typical configuration these two
    210157      modules are already embedded and those two <command>insmod</command>
Note: See TracChangeset for help on using the changeset viewer.