Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter10/grub.xml

    rc7f74cd rc423f883  
    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=loongarch64-efi</parameter> for the 64-bit
     31      LoongArch system.
     32    </para>
     33    <para>
     34      If your system does not support UEFI or you don't want to use it,
     35      you'll need to figure out how to configure the booting process of
     36      the system on your own.
    2537    </para>
    2638  </note>
     
    3547    LILO.</para></warning>
    3648
    37     <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
     49    <para>Ensure that an emergency boot disk is ready to <quote>rescue</quote>
    3850    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 
     51    already have a boot device, you can create one.  To create a emergency
     52    boot device for UEFI, consult section <quote>Create an Emergency Boot
     53    Disk</quote> in
     54        <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.</para>
     55
     56  </sect2>
     57
     58  <sect2>
     59    <title>Turn off Secure Boot</title>
     60
     61    <para>LFS does not have the essential packages to support Secure Boot.
     62    To set up the boot process following the instructions in this section,
     63    Secure Boot must be turned off from the configuration interface of the
     64    firmware. Read the documentation provided by the manufacturer of your
     65    system to find out how.</para>
    4966  </sect2>
    5067
     
    7289    <title>Setting Up the Configuration</title>
    7390
    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>
     91    <para>GRUB works by creating an EFI executable in the EFI System
     92    Partition (ESP).  You can find the ESP with:</para>
     93
     94<screen role="nodump"><userinput>fdisk -l | grep 'EFI System'</userinput></screen>
     95
     96    <para>If no ESP exists on your hard drive (for example, you are building
     97    LFS on a fresh new system with a Live CD as the host distro), read
     98    <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>
     99    for the instruction to create an ESP on your hard drive.</para>
     100
     101    <para>If the ESP is not mounted at
     102    <filename class="directory">/boot/efi</filename> (in the chroot),
     103    mount it now:</para>
     104
     105<screen role="nodump"><userinput>mkdir -pv /boot/efi
     106mount /boot/efi</userinput></screen>
     107
     108    <note>
     109      <para>The path to the device node is intentionally omitted in the
     110      command.  We expect the entry for mounting the ESP to
     111      <filename class="directory">/boot/efi</filename> is already in
     112      <filename>/etc/fstab</filename>.  Add the entry before running the
     113      command if you forgot to create an entry for the ESP in
     114      <xref linkend="ch-bootable-fstab"/>.</para>
     115    </note>
    78116
    79117    <para>The location of the boot partition is a choice of the user that
     
    100138
    101139    <para>Install the GRUB files into <filename
    102     class="directory">/boot/grub</filename> and set up the boot track:</para>
     140    class="directory">/boot/grub</filename> and the GRUB EFI executable into
     141    <filename>/boot/efi/EFI/BOOT/BOOTLOONGARCH64.EFI</filename>:</para>
    103142
    104143    <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>
     144      <para>The following command will overwrite
     145      <filename>BOOTLOONGARCH64.EFI</filename>. Do not run the command if
     146      this is not desired, for example, if it contains a third party boot
     147      manager.  You can backup it with <command>cp</command> as it's a
     148      regular file.</para>
    108149    </warning>
    109150
    110 <screen role="nodump"><userinput>grub-install /dev/sda</userinput></screen>
     151<screen role="nodump"><userinput>grub-install --removable</userinput></screen>
    111152
    112153    <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>
     154      <para>
     155        <parameter>--removable</parameter> may seem strange here.  The UEFI
     156        firmware searches EFI executables for boot loaders in a hardcoded
     157        path, <filename>EFI/BOOT/BOOTLOONGARCH64.EFI</filename> in the ESP, and other
     158        boot loader paths listed in the EFI variables.  We've not installed
     159        the utilities for manipulating EFI variables so we need to install
     160        the EFI executable into the hardcoded path.  The hardcoded path is
     161        usually used by removable devices (for example, USB thumb devices)
     162        so the <command>grub-install</command> option for this purpose is
     163        named <parameter>--removable</parameter>.
     164      </para>
     165      <para>
     166        UEFI implementation usually prefers the boot loaders with paths
     167        recorded in an EFI variable, to the boot loader with the hardcoded
     168        search path.  You may need to invoke the boot device selection menu
     169        or setting interface of your EFI firmware on next boot to explicitly
     170        select the bootloader.
     171      </para>
     172      <para>
     173        Some UEFI implementation may completely skip the hardcoded path if
     174        there are other boot loaders in the same hard drive with paths
     175        recorded in an EFI variable.  Then you need to create an EFI
     176        variable for the newly installed boot loader.  Install
     177        <ulink url="&blfs-book;postlfs/efibootmgr.html">efibootmgr</ulink>,
     178        then run the following commands:
     179
     180<screen role="nodump"><userinput>mount -v -t efivarfs efivarfs /sys/firmware/efi/efivars
     181efibootmgr -B -L LFS || true
     182efibootmgr -c -L LFS -l '\EFI\BOOT\BOOTLOONGARCH64.EFI' -d /dev/sda
     183umount /sys/firmware/efi/efivars</userinput></screen>
     184
     185        Replace <filename>/dev/sda</filename> with the device node of the
     186        hard drive where you are installing GRUB into.
     187      </para>
    119188    </note>
    120189
     
    144213insmod ext2
    145214set root=(hd0,2)
     215
     216insmod all_video
    146217
    147218menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" {
Note: See TracChangeset for help on using the changeset viewer.