Difference between revisions of "Systemd-boot"

From ArchWiki
Jump to: navigation, search
m (Adding boot entries)
(Gummiboot)
Line 1: Line 1:
 
= Gummiboot =
 
= Gummiboot =
  
[http://freedesktop.org/wiki/Software/gummiboot Gummiboot] is a new UEFI bootloader written by Kay Sievers. It is simple to configure, but can boot only other EFI binaries, including Linux with CONFIG_EFI_STUB enabled.
+
[http://freedesktop.org/wiki/Software/gummiboot Gummiboot] is a new UEFI bootloader written by Kay Sievers. It is simple to configure, but can only start EFI executables, such Linux (with CONFIG_EFI_STUB enabled), grub.efi, and such.
  
 
{{Note|
 
{{Note|
Line 67: Line 67:
 
Gummiboot searches for boot menu items in {{ic|$esp/loader/entries/*.conf}} – each file found must contain exactly one boot entry. The possible options are:
 
Gummiboot searches for boot menu items in {{ic|$esp/loader/entries/*.conf}} – each file found must contain exactly one boot entry. The possible options are:
  
* {{ic|title ''title''}} – operating system name. Required.
+
* {{ic|title ''title''}} – operating system name. '''Required.'''
  
 
* {{ic|title-version ''version''}} – kernel version, shown only when multiple entries with same title exist. Optional.
 
* {{ic|title-version ''version''}} – kernel version, shown only when multiple entries with same title exist. Optional.
Line 73: Line 73:
 
* {{ic|title-machine ''id''}} – machine identifier (usually first few letters from {{ic|/etc/machine-id}}, shown only when multiple entries with same title+version exist. Optional.
 
* {{ic|title-machine ''id''}} – machine identifier (usually first few letters from {{ic|/etc/machine-id}}, shown only when multiple entries with same title+version exist. Optional.
  
* {{ic|efi ''path''}} – EFI image to boot; e.g. {{ic|\EFI\arch\vmlinuz-linux.efi}}. Required.
+
* {{ic|efi ''path''}} – EFI image to boot; e.g. {{ic|\EFI\arch\vmlinuz-linux.efi}}. '''Required.'''
  
* {{ic|options ''path''}} – Options to pass to the kernel or EFI image. For Linux, the initramfs is also configured here using {{ic|1=initrd=''path''}}. Required.
+
* {{ic|options ''path''}} – Options to pass to the kernel or EFI image. For Linux, the initramfs is also configured here using {{ic|1=initrd=''path''}}. Optional, but you'll certainly want to specify initrd and root...
  
 
An example entry for Arch Linux:
 
An example entry for Arch Linux:
Line 82: Line 82:
 
title          Arch Linux
 
title          Arch Linux
 
title-version  3.5-1
 
title-version  3.5-1
 +
title-machine  067d8bfe
 
efi            \EFI\arch\vmlinuz-linux.efi
 
efi            \EFI\arch\vmlinuz-linux.efi
 
options        initrd=\EFI\arch\initramfs-linux.img root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 ro
 
options        initrd=\EFI\arch\initramfs-linux.img root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 ro
 
}}
 
}}
  
When using {{ic|efi}}, the path to initrd is specified in {{ic|options}}.
+
(I have a {{ic|kernel-post-upgrade.sh}} script that automatically generates loader entries on kernel upgrade.)
  
An alternate syntax is also supported, with {{ic|linux}} and {{ic|initrd}} keywords, but '''works exactly the same way''' otherwise:
+
You can also add other EFI programs such as {{ic|\EFI\arch\grub.efi}} or {{ic|\EFI\Microsoft\Boot\Bootmgfw.efi}} (the Windows 7 boot manager).
 
+
{{hc|$esp/loader/entries/arch-git.conf|2=
+
title          Arch Linux
+
linux          \EFI\arch\vmlinuz-linux-git.efi
+
initrd        \EFI\arch\initramfs-linux.img
+
options        root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 ro
+
}}
+
 
+
I have a {{ic|kernel-post-upgrade.sh}} script that automatically generates loader entries on kernel upgrade.
+
  
 
== Separate boot and EFI partitions ==
 
== Separate boot and EFI partitions ==

Revision as of 17:49, 31 July 2012

Gummiboot

Gummiboot is a new UEFI bootloader written by Kay Sievers. It is simple to configure, but can only start EFI executables, such Linux (with CONFIG_EFI_STUB enabled), grub.efi, and such.

Note:

In the following steps, replace $esp with your EFI System Partition. Some users have it on /boot/efi, others on /boot directly.

Building

Download gummiboot source:

$ git clone git://anongit.freedesktop.org/gummiboot
$ cd gummiboot

Compile:

$ make

This should be quick, as there is only one file and no configuration options.

Installing

Copy Gummiboot to the EFI partition:

# install -Dm0644 gummiboot.efi $esp/EFI/gummiboot/gummiboot.efi

Add it to the boot configuration: (only needs to be done once; skip this when upgrading)

# efibootmgr -c -L "Gummiboot" -l '\EFI\gummiboot\gummiboot.efi'
Note:

This can be done only when already booted in UEFI mode. If you do not have another UEFI bootloader set up, you can either run gummiboot.efi from the UEFI Shell, or copy it to the "default" location $esp/EFI/BOOT/BOOTX64.EFI for x86_64 systems.

Configuring

The basic configuration is kept in $esp/loader/default.conf, with just two possible configuration options:

  • default pattern – default entry to select (without the .conf suffix); can be a wildcard like arch-*
  • timeout seconds – menu timeout in seconds

Example:

$esp/loader/default.conf
default arch
timeout 4

Note that both options can be changed in the boot menu itself, which will store them as EFI variables.

Adding boot entries

Note:

If you have separate partitions for /boot and /boot/efi, you must copy the kernel and initramfs to the EFI partition. Gummiboot does not support loading kernels from other partitions than itself. See the section below on how to automate this.

Gummiboot searches for boot menu items in $esp/loader/entries/*.conf – each file found must contain exactly one boot entry. The possible options are:

  • title title – operating system name. Required.
  • title-version version – kernel version, shown only when multiple entries with same title exist. Optional.
  • title-machine id – machine identifier (usually first few letters from /etc/machine-id, shown only when multiple entries with same title+version exist. Optional.
  • efi path – EFI image to boot; e.g. \EFI\arch\vmlinuz-linux.efi. Required.
  • options path – Options to pass to the kernel or EFI image. For Linux, the initramfs is also configured here using initrd=path. Optional, but you'll certainly want to specify initrd and root...

An example entry for Arch Linux:

$esp/loader/entries/arch.conf
title          Arch Linux
title-version  3.5-1
title-machine  067d8bfe
efi            \EFI\arch\vmlinuz-linux.efi
options        initrd=\EFI\arch\initramfs-linux.img root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 ro

(I have a kernel-post-upgrade.sh script that automatically generates loader entries on kernel upgrade.)

You can also add other EFI programs such as \EFI\arch\grub.efi or \EFI\Microsoft\Boot\Bootmgfw.efi (the Windows 7 boot manager).

Separate boot and EFI partitions

TODO: link my kernel-post-upgrade stuff, https://github.com/grawity/code/tree/master/os/arch

Inside the boot menu

TODO: document keybindings from http://freedesktop.org/wiki/Software/gummiboot