Difference between revisions of "UEFI Bootloaders"
(→Using rEFInd) |
(Change package name gummiboot-efi -> gummiboot) |
||
(20 intermediate revisions by 6 users not shown) | |||
Line 18: | Line 18: | ||
!Boot File Source!!UEFI Destination | !Boot File Source!!UEFI Destination | ||
|- | |- | ||
− | | /boot/vmlinuz-linux || /boot/efi/EFI/arch/vmlinuz- | + | | /boot/vmlinuz-linux || /boot/efi/EFI/arch/vmlinuz-arch.efi |
|- | |- | ||
− | | /boot/initramfs-linux.img || /boot/efi/EFI/arch/initramfs- | + | | /boot/initramfs-linux.img || /boot/efi/EFI/arch/initramfs-arch.img |
|- | |- | ||
− | | /boot/initramfs-linux-fallback.img || /boot/efi/EFI/initramfs-arch-fallback.img | + | | /boot/initramfs-linux-fallback.img || /boot/efi/EFI/arch/initramfs-arch-fallback.img |
|} | |} | ||
=== Sync EFISTUB Kernel === | === Sync EFISTUB Kernel === | ||
{{Warning|The EFISTUB Kernel must be updated each time the kernel is updated (follow step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB]. Failure to do so will result in failure to boot. Alternatively one can automatically update the EFISTUB kernel using one of the following methods:}} | {{Warning|The EFISTUB Kernel must be updated each time the kernel is updated (follow step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB]. Failure to do so will result in failure to boot. Alternatively one can automatically update the EFISTUB kernel using one of the following methods:}} | ||
+ | |||
+ | {{Note| As of [https://www.archlinux.org/packages/extra/any/refind-efi/ refind-efi 0.6.5], refind now automatically detects kernels in {{ic|/boot}}. They do not have to be renamed to have a {{ic|.efi}} extension either. Hence, the following sync scripts aren't needed if using [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Using_rEFInd refind].}} | ||
==== Systemd ==== | ==== Systemd ==== | ||
[[Systemd]] features event triggered tasks. In this particular case, the ability to detect a change in path is used to sync the EFISTUB kernel and initramfs files when they are updated in {{ic|boot}}. | [[Systemd]] features event triggered tasks. In this particular case, the ability to detect a change in path is used to sync the EFISTUB kernel and initramfs files when they are updated in {{ic|boot}}. | ||
− | {{Tip|Save the following script as {{ic|/ | + | |
+ | {{Warning|Since mkinitcpio takes time to build the kernel stub and the initramfs. It is possible for the following systemd services to copy older kernel stubs and initramfs instead of the new ones. To reduce the chance of this error, it is better to bind the efistub copying service to check if the initramfs-linux-fallback.img was changed (since it is the last thing built by mkinitcpio).}} | ||
+ | {{Tip|Save the following script as {{ic|/usr/lib/systemd/system/efistub-update.path}}}} | ||
{{bc|<nowiki> | {{bc|<nowiki> | ||
[Unit] | [Unit] | ||
Line 37: | Line 41: | ||
[Path] | [Path] | ||
− | |||
− | |||
PathChanged=/boot/initramfs-linux-fallback.img | PathChanged=/boot/initramfs-linux-fallback.img | ||
Line 45: | Line 47: | ||
</nowiki>}} | </nowiki>}} | ||
− | {{Tip|Save the following script as {{ic|/ | + | {{Tip|Save the following script as {{ic|/usr/lib/systemd/system/efistub-update.service}}}} |
{{bc|<nowiki> | {{bc|<nowiki> | ||
[Unit] | [Unit] | ||
Line 55: | Line 57: | ||
ExecStart=/bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img | ExecStart=/bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img | ||
ExecStart=/bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img | ExecStart=/bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img | ||
− | |||
− | |||
− | |||
</nowiki>}} | </nowiki>}} | ||
Line 63: | Line 62: | ||
{{bc|<nowiki> | {{bc|<nowiki> | ||
# systemctl enable efistub-update.path | # systemctl enable efistub-update.path | ||
− | |||
</nowiki>}}}} | </nowiki>}}}} | ||
Line 91: | Line 89: | ||
Mkinitcpio can generate a hook that does not need a system level daemon to function. It spawns a background process which waits for the generation of {{ic|vm-linuz}}, {{ic|initramfs-linux.img}}, and {{ic|initramfs-linux-fallback.img}}; then follows step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB] | Mkinitcpio can generate a hook that does not need a system level daemon to function. It spawns a background process which waits for the generation of {{ic|vm-linuz}}, {{ic|initramfs-linux.img}}, and {{ic|initramfs-linux-fallback.img}}; then follows step 4 in [https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Setting_up_EFISTUB Setting up EFISTUB] | ||
− | {{Tip|Save the following script as {{ic|/usr/lib/ | + | {{Tip|Save the following script as {{ic|/usr/lib/initcpio/install/efistub-update}}}} |
{{bc|<nowiki> | {{bc|<nowiki> | ||
− | #! | + | #!/bin/sh |
build() { | build() { | ||
− | + | /root/watch.sh & | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
help() { | help() { | ||
− | + | cat <<HELPEOF | |
− | This hook | + | This hook waits for mkinitcpio to finish and copies the finished ramdisk and kernel to the ESP |
HELPEOF | HELPEOF | ||
} | } | ||
− | |||
− | |||
</nowiki>}} | </nowiki>}} | ||
− | {{Tip|Save the following script as {{ic|/root/watch.sh}}}} | + | {{Tip|Save the following script as {{ic|/root/watch.sh}} and make it executable}} |
{{bc|<nowiki> | {{bc|<nowiki> | ||
− | #!/bin/ | + | #!/bin/sh |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
while [[ -d "/proc/$PPID" ]]; do | while [[ -d "/proc/$PPID" ]]; do | ||
− | + | sleep 1 | |
done | done | ||
− | cp | + | /bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi |
− | cp | + | /bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img |
− | echo "Synced | + | /bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img |
+ | |||
+ | echo "Synced kernel with ESP" | ||
</nowiki>}} | </nowiki>}} | ||
Line 154: | Line 136: | ||
{| border="1" | {| border="1" | ||
!rEFInd File Source!!UEFI Destination | !rEFInd File Source!!UEFI Destination | ||
+ | |- | ||
+ | | /usr/lib/refind/refind_<arch>.efi || /boot/efi/EFI/refind/refind_<arch>.efi | ||
|- | |- | ||
| /usr/lib/refind/config/refind.conf || /boot/efi/EFI/refind/refind.conf | | /usr/lib/refind/config/refind.conf || /boot/efi/EFI/refind/refind.conf | ||
|- | |- | ||
| /usr/share/refind/icons || /boot/efi/EFI/refind/icons | | /usr/share/refind/icons || /boot/efi/EFI/refind/icons | ||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
{{Tip|Refind's configuration file is located in {{ic|/boot/efi/EFI/refind/refind.conf}}. The file is well commented.}} | {{Tip|Refind's configuration file is located in {{ic|/boot/efi/EFI/refind/refind.conf}}. The file is well commented.}} | ||
+ | |||
+ | {{Note|As of {{Pkg|refind-efi}} 0.6.5-1, refind can auto-detect kernels in {{ic|/boot}}, if there are UEFI drivers for the filesystem used by /boot partition (or / partition if no separate /boot is used) in the ESP, and are loaded by rEFInd. To enable rEFInd to detect and load the drivers and /boot kernels you must enable the appropriate options in {{ic|refind.conf}} (mainly mention the PATH for the drivers location in the ESP) and also copy your {{ic|refind_linux.conf}} to {{ic|/boot/refind_linux.conf}} .}} | ||
{{Tip|Pass kernel specific commands by copying {{ic|/usr/lib/refind/config/refind_linux.conf}} to {{ic|/boot/efi/EFI/arch/refind_linux.conf}}. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUIID with your root's PARTUIID}} | {{Tip|Pass kernel specific commands by copying {{ic|/usr/lib/refind/config/refind_linux.conf}} to {{ic|/boot/efi/EFI/arch/refind_linux.conf}}. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUIID with your root's PARTUIID}} | ||
Line 177: | Line 159: | ||
{{bc|<nowiki> | {{bc|<nowiki> | ||
# modprobe efivars | # modprobe efivars | ||
− | # efibootmgr -c -g -d /dev/sdX -p Y -w -L "rEFInd" -l '\EFI\refind\ | + | # efibootmgr -c -g -d /dev/sdX -p Y -w -L "rEFInd" -l '\EFI\refind\refind_<arch>.efi' |
</nowiki>}}}} | </nowiki>}}}} | ||
Line 238: | Line 220: | ||
{{bc|<nowiki> | {{bc|<nowiki> | ||
[Unit] | [Unit] | ||
− | Description=Update | + | Description=Update rEFInd bootloader files |
[Path] | [Path] | ||
− | PathChanged=/usr/lib/refind | + | PathChanged=/usr/lib/refind/refind_<arch>.efi |
Unit=refind_update.service | Unit=refind_update.service | ||
Line 251: | Line 233: | ||
{{bc|<nowiki> | {{bc|<nowiki> | ||
[Unit] | [Unit] | ||
− | Description=Update | + | Description=Update rEFInd directories, binaries, and nvram |
[Service] | [Service] | ||
Type=oneshot | Type=oneshot | ||
− | ExecStart=/usr/lib/systemd/scripts/refind_name_patchv2 | + | ExecStart=/bin/bash /usr/lib/systemd/scripts/refind_name_patchv2 |
RemainAfterExit=no | RemainAfterExit=no | ||
− | |||
− | |||
− | |||
</nowiki>}} | </nowiki>}} | ||
− | {{Tip|Enable the systemd | + | {{Tip|Enable the systemd path unit by running : |
{{bc|<nowiki> | {{bc|<nowiki> | ||
# systemctl enable refind_update.path; | # systemctl enable refind_update.path; | ||
− | |||
</nowiki>}}}} | </nowiki>}}}} | ||
Line 280: | Line 258: | ||
==== Using gummiboot ==== | ==== Using gummiboot ==== | ||
− | [[Gummiboot]] is a UEFI Boot Manager which provides a nice menu for EFISTUB Kernels. It is a new program and relatively untested compared to rEFInd . It is available in [extra] as {{Pkg|gummiboot | + | [[Gummiboot]] is a UEFI Boot Manager which provides a nice menu for EFISTUB Kernels. It is a new program and relatively untested compared to rEFInd . It is available in [extra] as {{Pkg|gummiboot}}. See http://freedesktop.org/wiki/Software/gummiboot for more info. |
==== Using UEFI Shell ==== | ==== Using UEFI Shell ==== | ||
Line 333: | Line 311: | ||
# echo "root=UUID=$(blkid /dev/sda1 -o value -s UUID) ro rootfstype=ext4 add_efi_memmap initrd=\\EFI\\arch\\initramfs-arch.img" | iconv -f ascii -t ucs2 | efibootmgr -c -g -d /dev/sda -p 1 -L "Arch Linux" -l '\EFI\arch\vmlinuz-arch.efi' -@ - | # echo "root=UUID=$(blkid /dev/sda1 -o value -s UUID) ro rootfstype=ext4 add_efi_memmap initrd=\\EFI\\arch\\initramfs-arch.img" | iconv -f ascii -t ucs2 | efibootmgr -c -g -d /dev/sda -p 1 -L "Arch Linux" -l '\EFI\arch\vmlinuz-arch.efi' -@ - | ||
+ | It is a good idea to run | ||
+ | |||
+ | # efibootmgr -v | ||
+ | |||
+ | to verify that the resulting entry is correct. You should also consider reordering the boot options ({{ic|efibootmgr -o}}) to place the Arch entry last, which will make the system easier to recover if it fails. | ||
+ | {{Note|On at least one system, the {{ic|\\a}} in the initrd path was still interpreted as an escape character. If you get a "Failed to open initrd file" error or suspect that might be the case, try putting a triple backslash before the a in arch}} | ||
{{Note|The trailing hyphen after {{ic|--append-binary-args}} or {{ic|-@}} is required to instruct efibootmgr to read the parameters from STDIN (standard input). The code should be {{ic|--append-binary-args -}} or {{ic|-@ -}} .}} | {{Note|The trailing hyphen after {{ic|--append-binary-args}} or {{ic|-@}} is required to instruct efibootmgr to read the parameters from STDIN (standard input). The code should be {{ic|--append-binary-args -}} or {{ic|-@ -}} .}} | ||
Revision as of 08:31, 7 March 2013
zh-CN:UEFI Bootloaders This page contains info about various UEFI Bootloaders capable of booting Linux kernel. It is recommended to read the UEFI and GPT pages before reading this page. The following bootloaders (listed in decreasing order of stability) are explained here:
Contents
Linux Kernel EFISTUB
Linux (Kernel >= 3.3) supports EFISTUB (EFI BOOT STUB)
booting. It is enabled by by default on Arch Linux kernels or can be activated by setting CONFIG_EFI_STUB=y
in the Kernel configuration (see The EFI Boot Stub for more information).
A single EFISTUB kernel is not capable of launching other kernels, hence each EFISTUB Kernel + Initramfs pair requires a separate boot menu entry. It is recommended to use a UEFI Boot Manager to manage multiple kernels.
Setting up EFISTUB
- Create a FAT32 UEFI System Partition
- Mount the UEFI System Partition at
/boot/efi
with# mount <UEFI Partition /boot/efi
- Create
/boot/efi/EFI/arch/
directory with# mkdir /boot/efi/EFI/arch/
- Copy the following files from source to destination
Boot File Source | UEFI Destination |
---|---|
/boot/vmlinuz-linux | /boot/efi/EFI/arch/vmlinuz-arch.efi |
/boot/initramfs-linux.img | /boot/efi/EFI/arch/initramfs-arch.img |
/boot/initramfs-linux-fallback.img | /boot/efi/EFI/arch/initramfs-arch-fallback.img |
Sync EFISTUB Kernel
/boot
. They do not have to be renamed to have a .efi
extension either. Hence, the following sync scripts aren't needed if using refind.Systemd
Systemd features event triggered tasks. In this particular case, the ability to detect a change in path is used to sync the EFISTUB kernel and initramfs files when they are updated in boot
.
/usr/lib/systemd/system/efistub-update.path
[Unit] Description=Copy EFISTUB Kernel to UEFISYS Partition [Path] PathChanged=/boot/initramfs-linux-fallback.img [Install] WantedBy=multi-user.target
/usr/lib/systemd/system/efistub-update.service
[Unit] Description=Copy EFISTUB Kernel to UEFISYS Partition [Service] Type=oneshot ExecStart=/bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi ExecStart=/bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img ExecStart=/bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img
# systemctl enable efistub-update.path
Incron
incron can run a script to sync the EFISTUB Kernel after updates
/usr/local/bin/efistub-update.sh
#!/bin/sh /bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi /bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img /bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img
/etc/incron.d/efistub-update.conf
/boot/initramfs-linux-fallback.img
is the file to watch. The second parameter IN_CLOSE_WRITE
is the action to watch for. The third parameter /usr/local/bin/efistub-update.sh
is the script to execute./boot/initramfs-linux-fallback.img IN_CLOSE_WRITE /usr/local/bin/efistub-update.sh
# systemctl enable incrond.service
Mkinitcpio hook
Mkinitcpio can generate a hook that does not need a system level daemon to function. It spawns a background process which waits for the generation of vm-linuz
, initramfs-linux.img
, and initramfs-linux-fallback.img
; then follows step 4 in Setting up EFISTUB
/usr/lib/initcpio/install/efistub-update
#!/bin/sh build() { /root/watch.sh & } help() { cat <<HELPEOF This hook waits for mkinitcpio to finish and copies the finished ramdisk and kernel to the ESP HELPEOF }
/root/watch.sh
and make it executable#!/bin/sh while [[ -d "/proc/$PPID" ]]; do sleep 1 done /bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-arch.efi /bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-arch.img /bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-arch-fallback.img echo "Synced kernel with ESP"
efistub-update
to the list of hooks in /etc/mkinitcpio.conf
Booting EFISTUB
\
instead of /
and should be relative to the UEFI System Partition's root. For example, if the initramfs is located in /boot/efi/EFI/arch/initramfs-linux.img
, the corresponding UEFI formatted line would be \EFI\arch\initramfs-linux.img
. Failure to convert the options will lead to a system hang without any error message from the firmware or kernel.One can boot the EFISTUB kernel using one of the following ways :
Using rEFInd
rEFInd is a fork of rEFIt Boot Manager (used in Intel Macs) by Rod Smith (author of GPT-fdisk). rEFInd fixes many issues in rEFIt with respect to non-Mac UEFI booting and also has support for booting EFISTUB kernels and contains some features specific to them. More info about rEFInd support for EFISTUB is at The rEFInd Boot Manager: Methods of Booting Linux.
- Install refind-efi package with
# pacman -S refind-efi
- Copy the following files from their source directory to their destination
$ uname -m
to get the architecture. Replace <arch> with "ia32" for 32 bit systems, and <arch> with "x64" for 64 bit systems.rEFInd File Source | UEFI Destination |
---|---|
/usr/lib/refind/refind_<arch>.efi | /boot/efi/EFI/refind/refind_<arch>.efi |
/usr/lib/refind/config/refind.conf | /boot/efi/EFI/refind/refind.conf |
/usr/share/refind/icons | /boot/efi/EFI/refind/icons |
/boot/efi/EFI/refind/refind.conf
. The file is well commented./boot
, if there are UEFI drivers for the filesystem used by /boot partition (or / partition if no separate /boot is used) in the ESP, and are loaded by rEFInd. To enable rEFInd to detect and load the drivers and /boot kernels you must enable the appropriate options in refind.conf
(mainly mention the PATH for the drivers location in the ESP) and also copy your refind_linux.conf
to /boot/refind_linux.conf
./usr/lib/refind/config/refind_linux.conf
to /boot/efi/EFI/arch/refind_linux.conf
. This file should be located in the same directory as the EFISTUB kernel. Edit the configuration file to be similar to the template below. Replace the string after PARTUIID with your root's PARTUIID$ ls -l /dev/disk/by-partuuid/
$esp/EFI/arch/refind_linux.conf
"Boot with defaults" "root=PARTUUID=3518bb68-d01e-45c9-b973-0b5d918aae96 ro rootfstype=ext4 add_efi_memmap systemd.unit=graphical.target" "Boot to Terminal" "root=PARTUUID=3518bb68-d01e-45c9-b973-0b5d918aae96 ro rootfstype=ext4 add_efi_memmap systemd.unit=multi-user.target"
refind_linux.conf
is displayed as a submenu by rEFInd. Access the submenu with "+" or "insert" keys.# modprobe efivars # efibootmgr -c -g -d /dev/sdX -p Y -w -L "rEFInd" -l '\EFI\refind\refind_<arch>.efi'
Systemd Automation
/usr/lib/systemd/scripts/refind_name_patchv2
#!/bin/bash ## COPYRIGHT 2013 : MARK E. LEE (BLUERIDER) : mlee24@binghamton.edu; mark@markelee.com ## LOG ## 1/17/2013 : Version 2 of refind_name_patch is released ## : Supports long subdirectory location for refind ## : Updates nvram when needed ## : 10% speed boost function main () { ## main insertion function declare -r refind_dir="/boot/efi/EFI/refind"; ## set the refind directory declare -r arch=$(uname -m | awk -F'_' '{if ($1 == "x86"){print $2}}') && ## get bit architecture update-efi-dir; ## updates or creates the refind directory update-efi-nvram; ## updates nvram if needed } function update-efi-dir () { ## setup the refind directory if [ ! -d $refind_dir ]; then ## check if refind directory exists echo "Couldn't find $refind_dir"; mkdir $refind_dir && ## make the refind directory if needed echo "Made $refind_dir"; fi; if [ "$arch" ]; then ## check if anything was stored in $arch cp -r /usr/{share/refind/*,lib/refind/*$arch*} $refind_dir/ && ## update bin and dirs echo "Updated binaries and directory files for refind at $refind_dir"; else echo "Failed to detect an x86 architecture"; exit; fi; } function update-efi-nvram () { ## update the nvram with efibootmgr declare -r ref_bin=${refind_dir/\/boot\/efi}/$(ls /usr/lib | grep $arch*.efi); ## get path of refind binary (without /boot/efi) declare -r ref_bin_escape=${ref_bin//\//\\\\}; ## insert escape characters into $ref_bin modprobe efivars && ## grab the efi variables for efibootmgr efibootmgr -v | grep $ref_bin_escape && ( ## check if boot entry is in nvram echo "Found boot entry, no need to update nvram"; ) || ( ## if boot entry is not in nvram; add it declare -r esp=$(mount -l | awk '/ESP/ {print $1}') && ## get ESP partition efibootmgr -c -g -d ${esp:0:8} -p ${esp:8} -w -L "rEFInd" -l $ref_bin_escape && ## update nvram echo " Updated nvram with entry rEFInd to boot $ref_bin Did not copy configuration files, please move refind.conf to $refind_dir/"; ) } main; ## run the main insertion function
/usr/lib/systemd/system/refind_update.path
[Unit] Description=Update rEFInd bootloader files [Path] PathChanged=/usr/lib/refind/refind_<arch>.efi Unit=refind_update.service [Install] WantedBy=multi-user.target
/usr/lib/systemd/system/refind_update.service
[Unit] Description=Update rEFInd directories, binaries, and nvram [Service] Type=oneshot ExecStart=/bin/bash /usr/lib/systemd/scripts/refind_name_patchv2 RemainAfterExit=no
# systemctl enable refind_update.path;
Apple Macs
In case of Apple Macs, try mactel-bootAUR for an experimental "bless" utility for Linux. If that does not work, use "bless" form within OSX to set rEFInd as default bootloader. Assuming UEFISYS partition is mounted at /mnt/efi
within OSX, do
$ sudo bless --setBoot --folder /mnt/efi/EFI/refind --file /mnt/efi/EFI/refind/refind_x64.efi
VirtualBox
In case of VirtualBox, see VirtualBox#Using_Arch_under_Virtualbox_EFI_mode.
Using gummiboot
Gummiboot is a UEFI Boot Manager which provides a nice menu for EFISTUB Kernels. It is a new program and relatively untested compared to rEFInd . It is available in [extra] as gummiboot. See http://freedesktop.org/wiki/Software/gummiboot for more info.
Using UEFI Shell
It is possible to launch EFISTUB kernel form UEFI Shell as if it is a normal UEFI application. In this case the kernel parameters are passed as normal parameters to the launched EFISTUB kernel file.
> fs0: > cd \EFI\arch > vmlinuz-arch.efi root=PARTUUID=3518bb68-d01e-45c9-b973-0b5d918aae96 ro rootfstype=ext4 add_efi_memmap initrd=\EFI\arch\initramfs-arch.img
You can also write a simple archlinux.nsh
file with your boot parameters and put it in your UEFI System Partition, then run it with:
fs0: archlinux
Example Script:
echo -on \EFI\arch\vmlinuz-arch.efi root=PARTUUID=3518bb68-d01e-45c9-b973-0b5d918aae96 ro rootfstype=ext4 add_efi_memmap initrd=\EFI\arch\initramfs-arch.img
This way you can specify UUID's without needing to remember the name or type out 20-30 characters.
Using efibootmgr entry
efibootmgr -v
command) and therefore the kernel fails to boot.It is possible to directly embed the kernel parameters within the boot entry created by efibootmgr. This means that in your BIOS/UEFI you will be able to select Arch Linux directly in the default boot order, and on startup it will boot into Arch directly without any kind of boot selection GUI.
Do (as root):
Install efibootmgr if you haven't already.
# pacman -S --needed efibootmgr
Determine the UUID or PARTUUID of your boot device (ie. the partition for /
, not the EFI boot partition)
# blkid
Load the EFI module.
# modprobe efivars
Finally, add the efistub. WARNING: Make sure you replace the following before running this command:
- 3518bb68-d01e-45c9-b973-0b5d918aae96 -- with the UUID of your
/
partition. (This is not PARTUUID!) - ext4 -- if you use a different file system.
- /dev/sda -- the drive that contains the EFI boot partition.
- -p 1 -- the partition number of the EFI boot partition.
# echo 'root=UUID=3518bb68-d01e-45c9-b973-0b5d918aae96 ro rootfstype=ext4 add_efi_memmap initrd=\EFI\arch\initramfs-arch.img' | iconv -f ascii -t ucs2 | efibootmgr -c -g -d /dev/sda -p 1 -L "Arch Linux" -l '\EFI\arch\vmlinuz-arch.efi' -@ -
or you can just run the following line (remember to replace /dev/sda1):
# echo "root=UUID=$(blkid /dev/sda1 -o value -s UUID) ro rootfstype=ext4 add_efi_memmap initrd=\\EFI\\arch\\initramfs-arch.img" | iconv -f ascii -t ucs2 | efibootmgr -c -g -d /dev/sda -p 1 -L "Arch Linux" -l '\EFI\arch\vmlinuz-arch.efi' -@ -
It is a good idea to run
# efibootmgr -v
to verify that the resulting entry is correct. You should also consider reordering the boot options (efibootmgr -o
) to place the Arch entry last, which will make the system easier to recover if it fails.
\\a
in the initrd path was still interpreted as an escape character. If you get a "Failed to open initrd file" error or suspect that might be the case, try putting a triple backslash before the a in arch--append-binary-args
or -@
is required to instruct efibootmgr to read the parameters from STDIN (standard input). The code should be --append-binary-args -
or -@ -
.More info about efibootmgr at UEFI#efibootmgr. Forum post https://bbs.archlinux.org/viewtopic.php?pid=1090040#p1090040 .
GRUB 2.x
GRUB 2.x contains its own filesystem drivers and does not rely on the firmware to access the files. It can directly read files from /boot
and does not require the kernel and initramfs files to be in the UEFISYS partition. Detailed information at GRUB#UEFI_systems_2. For bzr development version try AUR package - grub-efi-x86_64-bzrAUR.
SYSLINUX
Install syslinux-efi-gitAUR AUR package and copy /usr/lib/syslinux/efi64/*
to $esp/EFI/syslinux/
($esp
is the mountpoint of UEFISYS partition) (efi64
is for x86_64 UEFI firmwares, replace with efi32
for i386 UEFI firmwares), and then create a boot entry using efibootmgr in the firmware boot manager.
ELILO
ELILO is the UEFI version of LILO Boot Loader. It was originally created for Intel Itanium systems which supported only EFI (precursor to UEFI). It is the oldest UEFI bootloader for Linux. It is still in development but happens at a very slow pace. Upstream provided compiled binaries are available at http://sourceforge.net/projects/elilo/ . Elilo config file elilo.conf
is similar to LILO's config file. AUR package - elilo-efi-x86_64AUR (only for x86_64 UEFI).
EFILINUX
EFILINUX is a reference implementation of a UEFI Linux bootloader and precursor to Kenrel EFISTUB support. It is considered to be a alpha quality software (as on 16-MAY-2012). Upstream sources are at https://github.com/mfleming/efilinux . and the usage instructions are at http://thread.gmane.org/gmane.linux.kernel/1172645 and http://article.gmane.org/gmane.linux.kernel/1175060 . AUR packages - efilinux-efi and efilinux-efi-x86_64-gitAUR (only for x86_64 UEFI).
Package Naming Guidelines
UEFI bootloader package(s) should be suffixed with -efi-x86_64
or -efi-i386
to denote package built for 64-bit and 32-bit UEFI respectively. If a single package contains both 64-bit and 32-bit UEFI applications, then -efi
suffix should be used in the pkgname.