UEFI installation: ensure better agreement among paths in the example commands

This commit is contained in:
John McQuah 2022-08-09 09:54:07 -04:00
parent 836dd1db5b
commit 865ceb326c
1 changed files with 55 additions and 51 deletions

View File

@ -55,38 +55,6 @@ another option, the SYSLINUX bootloader.
Installing a new boot manager is like modifying the partition table using fdisk
or installing a new system kernel. Please create a rescue boot disk first!
!!! Installation -- UEFI booting
If your motherboard supports the UEFI boot mode, then installation of syslinux
is as simple as copying a few files to the EFI system partition (mounted at
%fn%/boot/efi%% in the example commands below) and writing a configuration that
tells syslinux where to find your kernel. First confirm that EFI variables are
visible to the currently-running kernel; if you run @@efivar -l@@ and see a list
of %fn%universally-unique-identifier-VariableName%%s, then the following
commands should be sufficient.
$ mkdir -p /boot/efi/BOOT
$ cd /boot/efi/BOOT
$ cp /usr/share/syslinux/efi64/ldlinux.e64 .
$ cp /usr/share/syslinux/efi64/syslinux.efi BOOTX64.EFI
$ cp /usr/src/linux-5.15.55/arch/x86/boot/bzImage vmlinuz-5.15.55
$ vi syslinux.cfg
-> Remember to change %fn%/boot/efi%% to the actual mount point of your EFI
system partition.
-> Observe that the EFI bootloader was given a generic name in the fourth line
above. If you had saved it in fn%/boot/efi/BOOT%% using the original filename
provided by the '''syslinux''' package, then it would have been necessary to run
@@efibootmgr@@ to inform the BIOS about this new bootloader-like object. See
[[#EFI-stub-install | "EFI Stub installation"]] for an example of using
@@efibootmgr@@ to create new boot entries.
-> The fifth command puts a copy of the kernel (renamed to show version
information) in the working directory. The final command starts the vi editor on
a buffer that will be written to %fn%syslinux.cfg%%, which must contain a line
giving the path to the kernel image. See the [[#syslinux-cfg| "SYSLINUX
configuration file template"]] for details.
!!! Installation -- Legacy (MBR) booting
If your motherboard does not support UEFI boot mode (or if you disabled it
deliberately), then installing syslinux will require you to overwrite the master
@ -116,6 +84,7 @@ BIOSes that truly have no UEFI capability.'''
$ mkdir -p $INSTALLDIR
$ cd $INSTALLDIR
$ cp /usr/share/syslinux/ldlinux.c32 .
$ cp /usr/src/linux-5.15.55/arch/x86/boot/bzImage vmlinuz-5.15.55
$ extlinux --install $INSTALLDIR
$ dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/$BINBLOB of=/dev/sda
$ vi syslinux.cfg
@ -149,11 +118,43 @@ label CRUX-3.7
@]
When giving the location of a kernel image, relative paths are interpreted in
reference to the %fn%syslinux.cfg%% file. In the example above, if
reference to the %fn%syslinux.cfg%% file. In the example above, since
@@extlinux@@ assigned %fn%/boot/efi/EFI/BOOT/%% as the preferred location for
%fn%syslinux.cfg%%, the kernel would have to be copied to
%fn%syslinux.cfg%%, we copied the kernel to
%fn%/boot/efi/EFI/BOOT/vmlinuz-5.15.55%%.
!!! Installation -- UEFI booting
If your motherboard supports the UEFI boot mode, then installation of syslinux
is as simple as copying a few files to the EFI system partition (mounted at
%fn%/boot/efi%% in the example commands below) and writing a configuration that
tells syslinux where to find your kernel. First confirm that EFI variables are
visible to the currently-running kernel; if you run @@efivar -l@@ and see a list
of %fn%universally-unique-identifier-VariableName%%s, then the following
commands should be sufficient.
$ mkdir -p /boot/efi/EFI/BOOT
$ cd /boot/efi/EFI/BOOT
$ cp /usr/share/syslinux/efi64/ldlinux.e64 .
$ cp /usr/share/syslinux/efi64/syslinux.efi BOOTX64.EFI
$ cp /usr/src/linux-5.15.55/arch/x86/boot/bzImage vmlinuz-5.15.55
$ vi syslinux.cfg
* Remember to change %fn%/boot/efi%% to the actual mount point of your EFI
system partition.
* Most UEFI implementations search the subdirectory %fn%EFI/BOOT%% of the
EFI partition for the bootloader, defaulting to a file named
%fn%BOOTX64.EFI%% in that subdirectory.
** If you choose a different mountpoint for the EFI partition, adjust the @@mkdir@@ and @@cd@@ commands accordingly (UEFI itself is completely agnostic about mountpoints specified in %fn%/etc/fstab).
** Copying the %fn%syslinux.efi%% file with its original name
would require you to run @@efibootmgr@@ and inform the BIOS about this new
bootloader-like object. See [[#EFI-stub-install | "EFI Stub installation"]]
for an example of using @@efibootmgr@@ to create new boot entries.
* The fifth command puts a copy of the kernel (renamed to show version
information) in the working directory. The final command starts the vi editor on
a buffer that will be written to %fn%syslinux.cfg%%, which must contain a line
giving the path to the kernel image. See the [[#syslinux-cfg| "SYSLINUX
configuration file template"]] for details.
[[#EFI-stub-install]]
!! EFI Stub installation notes
@ -190,27 +191,15 @@ get back into your system and fix things.
extension %fn%.efi%%.
[@
$ mkdir -p /boot/efi/BOOT
$ cd /boot/efi/BOOT
$ mkdir -p /boot/efi/EFI/BOOT
$ cd /boot/efi/EFI/BOOT
$ cp /usr/src/linux-5.15.55/arch/x86/boot/bzImage vmlinuz-5.15.55.efi
@]
* Next, create a boot entry telling the BIOS about the kernel image you just saved.
$ efibootmgr -c -d /dev/sda -L 'Linux 5.15.55' -l '\BOOT\vmlinuz-5.15.55.efi' -u 'root=/dev/sda2'
$ efibootmgr -c -d /dev/sda -L 'Linux 5.15.55' -l '\EFI\BOOT\vmlinuz-5.15.55.efi' -u 'root=/dev/sda2'
-> For maximum portability, you can also identify the root filesystem using its
partition UUID. Run @@ls -l /dev/disk/by-partuuid/@@ to discover the UUID of the
known partitions, and then modify the @@efibootmgr@@ arguments to use the
identifier of the root partition. '''Note: this option is more fragile than
specifying the root partition using its device node, because of the delay in
scanning all partitions to construct the list of their UUIDs. If you encounter
an error when booting your CRUX system this way, you will have to use the
installation media (or another rescue disk) to recreate the EFI boot entry with
device node instead, or with an additional boot option that gives the kernel more
time to enumerate the partitions.'''
$ efibootmgr -c -d /dev/sda -L 'Linux 5.15.55' -l '\BOOT\vmlinuz-5.15.55.efi' -u 'root=PARTUUID=c3259ad5-...'
* Finally, change the boot order so that the newly-created boot entry is the
first one tried. Start by finding the number assigned to the newly-created
@ -221,12 +210,27 @@ $ efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001
Boot0000* Linux 5.15.26 HD(1,GPT,d5a44413-...,0x800,0x64000)/File(\BOOT\vmlinuz-5.15.26.efi)72006f006f0074...
Boot0001* Linux 5.15.55 HD(1,GPT,d5a44413-...,0x800,0x64000)/File(\BOOT\vmlinuz-5.15.55.efi)72006f006f0074...
Boot0000* Linux 5.15.26 HD(1,GPT,d5a44413-...,0x800,0x64000)/File(\EFI\BOOT\vmlinuz-5.15.26.efi)72006f006f0074...
Boot0001* Linux 5.15.55 HD(1,GPT,d5a44413-...,0x800,0x64000)/File(\EFI\BOOT\vmlinuz-5.15.55.efi)72006f006f0074...
$ efibootmgr -o 0001,0000
@]
-> As in the UEFI installation of SYSLINUX, the subdirectory %fn%EFI/BOOT%%
of the EFI system partition is the default path where the BIOS expects to
find a bootloader. This location is more obvious in the @@efibootmgr@@
commands, since @@efibootmgr@@ is agnostic about the mountpoint of your
EFI system partition. The two most common ways to shorten what looks like an
overly-verbose path to the kernel image are:
** mount your EFI system partition somewhere else (and adjust the @@mkdir@@ and @@cd@@ commands as needed).
** save your kernel closer to the root of the EFI system partition (and change the @@efibootmgr@@ invocation as needed).
-> The flexibility afforded by all these options can be overwhelming (but
considerably less so than the decisions involved in full-disk encryption;
see the next section). Each presentation above (SYSLINUX legacy, SYSLINUX
UEFI, and EFI STUB) is meant to illustrate just one possible way of setting
up a bootloader, and you're welcome to explore variations on these
instructions to suit your preferred partitioning scheme.
[[#initramfs]]
!! Notes on Initramfs