]>
Commit | Line | Data |
---|---|---|
c3e270f4 FB |
1 | --- |
2 | title: The Boot Loader Interface | |
3 | --- | |
4 | ||
2fe82132 LP |
5 | # The Boot Loader Interface |
6 | ||
7 | systemd can interface with the boot loader to receive performance data and | |
8 | other information, and pass control information. This is only supported on EFI | |
9 | systems. Data is transferred between the boot loader and systemd in EFI | |
10 | variables. All EFI variables use the vendor UUID | |
11 | `4a67b082-0a4c-41cf-b6c7-440b29bb8c4f`. | |
12 | ||
13 | * The EFI Variable `LoaderTimeInitUSec` contains the timestamp in microseconds | |
14 | when the loader was initialized. This value is the time spent in the firmware | |
15 | for initialization, it is formatted as numeric, NUL-terminated, decimal | |
16 | string, in UTF-16. | |
17 | ||
18 | * The EFI Variable `LoaderTimeExecUSec` contains the timestamp in microseconds | |
19 | when the loader finished its work and is about to execute the kernel. The | |
20 | time spent in the loader is the difference between `LoaderTimeExecUSec` and | |
21 | `LoaderTimeInitUSec`. This value is formatted the same way as | |
22 | `LoaderTimeInitUSec`. | |
23 | ||
24 | * The EFI variable `LoaderDevicePartUUID` contains the partition GUID of the | |
25 | ESP the boot loader was run from formatted as NUL-terminated UTF16 string, in | |
26 | normal GUID syntax. | |
27 | ||
3f9a0a52 | 28 | * The EFI variable `LoaderConfigTimeout` contains the boot menu timeout |
2fe82132 LP |
29 | currently in use. It may be modified both by the boot loader and by the |
30 | host. The value should be formatted as numeric, NUL-terminated, decimal | |
31 | string, in UTF-16. The time is specified in µs. | |
32 | ||
33 | * Similarly, the EFI variable `LoaderConfigTimeoutOneShot` contains a boot menu | |
3f9a0a52 | 34 | timeout for a single following boot. It is set by the OS in order to request |
2fe82132 LP |
35 | display of the boot menu on the following boot. When set overrides |
36 | `LoaderConfigTimeout`. It is removed automatically after being read by the | |
37 | boot loader, to ensure it only takes effect a single time. This value is | |
38 | formatted the same way as `LoaderConfigTimeout`. If set to `0` the boot menu | |
3f9a0a52 | 39 | timeout is turned off, and the menu is shown indefinitely. |
2fe82132 LP |
40 | |
41 | * The EFI variable `LoaderEntries` may contain a series of boot loader entry | |
42 | identifiers, one after the other, each individually NUL terminated. This may | |
43 | be used to let the OS know which boot menu entries were discovered by the | |
44 | boot loader. A boot loader entry identifier should be a short, non-empty | |
45 | alphanumeric string (possibly containing `-`, too). The list should be in the | |
46 | order the entries are shown on screen during boot. See below regarding a | |
47 | recommended vocabulary for boot loader entry identifiers. | |
48 | ||
49 | * The EFI variable `LoaderEntryDefault` contains the default boot loader entry | |
50 | to use. It contains a NUL-terminated boot loader entry identifier. | |
51 | ||
52 | * Similarly, the EFI variable `LoaderEntryOneShot` contains the default boot | |
53 | loader entry to use for a single following boot. It is set by the OS in order | |
54 | to request booting into a specific menu entry on the following boot. When set | |
55 | overrides `LoaderEntryDefault`. It is removed automatically after being read | |
56 | by the boot loader, to ensure it only takes effect a single time. This value | |
57 | is formatted the same way as `LoaderEntryDefault`. | |
58 | ||
59 | * The EFI variable `LoaderEntrySelected` contains the boot loader entry | |
60 | identifier that was booted. It is set by the boot loader and read by | |
61 | the OS in order to identify which entry has been used for the current boot. | |
62 | ||
63 | * The EFI variable `LoaderFeatures` contains a 64bit unsigned integer with a | |
64 | number of flags bits that are set by the boot loader and passed to the OS and | |
65 | indicate the features the boot loader supports. Specifically, the following | |
66 | bits are defined: | |
67 | ||
68 | * `1 << 0` → The boot loader honours `LoaderConfigTimeout` when set. | |
69 | * `1 << 1` → The boot loader honours `LoaderConfigTimeoutOneShot` when set. | |
70 | * `1 << 2` → The boot loader honours `LoaderEntryDefault` when set. | |
71 | * `1 << 3` → The boot loader honours `LoaderEntryOneShot` when set. | |
72 | * `1 << 4` → The boot loader supports boot counting as described in [Automatic Boot Assessment](https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT). | |
73 | ||
74 | If `LoaderTimeInitUSec` and `LoaderTimeExecUSec` are set, `systemd-analyze` | |
75 | will include them in its boot-time analysis. If `LoaderDevicePartUUID` is set, | |
76 | systemd will mount the ESP that was used for the boot to `/boot`, but only if | |
77 | that directory is empty, and only if no other file systems are mounted | |
78 | there. The `systemctl reboot --boot-loader-entry=…` and `systemctl reboot | |
79 | --boot-loader-menu=…` commands rely on the `LoaderFeatures` , | |
80 | `LoaderConfigTimeoutOneShot`, `LoaderEntries`, `LoaderEntryOneShot` variables. | |
f7f00fb1 LP |
81 | |
82 | ## Boot Loader Entry Identifiers | |
83 | ||
84 | While boot loader entries may be named relatively freely, it's highly | |
85 | recommended to follow the following rules when picking identifiers for the | |
86 | entries, so that programs (and users) can derive basic context and meaning from | |
87 | the identifiers as passed in `LoaderEntries`, `LoaderEntryDefault`, | |
88 | `LoaderEntryOneShot`, `LoaderEntrySelected`, and possibly show nicely localized | |
89 | names for them in UIs. | |
90 | ||
91 | 1. When boot loader entries are defined through [Boot Loader | |
92 | Specification](https://systemd.io/BOOT_LOADER_SPECIFICATION) drop-in files | |
93 | the identifier should be derived directly from the drop-in snippet name, but | |
94 | with the `.conf` (or `.efi` in case of Type #2 entries) suffix removed. | |
95 | ||
96 | 2. Entries automatically discovered by the boot loader (as opposed to being | |
97 | configured in configuration files) should generally have an identifier | |
98 | prefixed with `auto-`. | |
99 | ||
100 | 3. Boot menu entries referring to Microsoft Windows installations should either | |
101 | use the identifier `windows` or use the `windows-` prefix for the | |
102 | identifier. If a menu entry is automatically discovered, it should be | |
103 | prefixed with `auto-`, see above (Example: this means an automatically | |
104 | discovered Windows installation might have the identifier `auto-windows` or | |
105 | `auto-windows-10` or so.). | |
106 | ||
107 | 4. Similar, boot menu entries referring to Apple MacOS X installations should | |
108 | use the identifier `osx` or one that is prefixed with `osx-`. If such an | |
109 | entry is automatically discovered by the boot loader use `auto-osx` as | |
110 | identifier, or `auto-osx-` as prefix for the identifier, see above. | |
111 | ||
112 | 5. If a boot menu entry encapsulates the EFI shell program, it should use the | |
113 | identifier `efi-shell` (or when automatically discovered: `auto-efi-shell`, | |
114 | see above). | |
115 | ||
116 | 6. If a boot menu entry encapsulates a reboot into EFI firmware setup feature, | |
117 | it should use the identifier `reboot-to-firmware-setup` (or | |
118 | `auto-reboot-to-firmware-setup` in case it is automatically discovered). |