Boot menu and settingsDraft
The boot menu is where you choose what boots. Whether the machine starts
something by itself is a setting, and every bootloader setting lives in
the Mac's NVRAM under variables whose names start with ob-. The code is
in ob_menu.c, boot_policy.c, ob_settings.c and
ob_settings_write.c under openboot/src.
What the menu shows#
The Boot page has five entries, in this order. An entry that is not available is greyed out.
| Entry | Starts | Can be the default |
|---|---|---|
| Windows (internal) | The EFI system partition (ESP) of the internal Windows install, found by its partition GUID. | yes |
| USB | The removable stick found by OpenBoot's own USB stack, named by the stick's partition GUID. | yes, when the stick is GPT |
| macOS | A one-shot: the NVRAM variable alt-boot-volume is written and the machine restarts into macOS once. The next boot is OpenBoot again. |
yes |
| Firmware menu | The EDK II boot manager menu. | no |
| Options | The Settings page. | no |
OpenBoot stays the machine's default boot. Choosing macOS does not change
boot-volume; it only sets the one-shot variable iBoot consumes.
The default can be any operating system found: the internal Windows,
another loader on an ESP, or macOS. There is no entry that only keeps the
menu open; an open menu stays open until something is started and has no
countdown. The entry named by the stored default carries the badge
default and is selected when the menu opens.
A line under the entries says what is wrong, for example that the default names an ESP that is not present, that macOS is not available, that a variable does not parse, or that the last boots failed. A default that cannot be found never falls back to another entry or disk: the menu opens with the reason.
Keys#
| Key | Does |
|---|---|
| Enter | Starts the selected entry (Options opens the Settings page). Starting Windows, a stick or the Firmware menu deletes ob-lastfail. |
| D | Makes the selected entry the default (ob-default). Refused for Firmware menu, Options, an absent entry and a stick whose partition GUID is unknown. |
| A | Turns autoboot on or off (ob-autoboot). Turning it on needs a default. |
| Space | At power-on, while autoboot counts down: opens the menu instead of starting the default. |
| Left, Right | Move the selection between the entries. |
| O | Opens the Settings page. |
| Tab | Next page (Boot, Logs, System, Settings). |
D and A write NVRAM once each, only when pressed. Nothing writes when the
menu opens or when the selection moves. The Settings page's timeout row
writes ob-timeout only when you picked a value and then chose Save.
Autoboot#
Only an image built with OB_STANDALONE=1 reads the stored settings; a
default build (OB_STANDALONE=0) never reads them and opens the menu.
With autoboot on and a default found, power-on shows Starting <entry> in N s and then starts it. With autoboot off, no settings, bad settings or
no default, the menu opens with no countdown.
A default of macOS does what the macOS entry does: the one-shot write, then a restart. Each such boot costs one extra restart and one NVRAM write. OpenBoot cannot observe whether macOS came up, so it does not count these starts as failures and there is no limit.
Failures#
An autoboot that cannot start ends in a panel with an error code and a
restart. Failures E2, E3 and E4 are counted in ob-lastfail; the third
failure in a row stops in the menu with the reason instead of restarting
again. The counter is deleted when you start an entry from the menu and
when Windows resets or shuts down after it was up for 60 seconds. E1, E5
and E6 are never counted.
The variables#
The variables use one fixed project GUID, defined in
openboot/src/ob_settings.h. Values are plain text. A missing or
unparseable variable counts as absent.
| Variable | Value | Absent or bad means |
|---|---|---|
ob-autoboot |
1 or 0 |
off: the menu |
ob-default |
esp:<partition GUID>, optionally followed by :<loader path>, or macos |
no default: the menu |
ob-timeout |
seconds, 0 to 30 | 0 |
ob-lastfail |
E2:1 to E4:15: error code and count |
no failure |
ob-hold |
<mode>,<arm>,<window ms>,<poll>, every field optional |
the build's defaults for the hold window |
The loader path is strictly checked: backslash separated, starting with a
backslash, printable ASCII without " * / : < > ? |, no .., no empty
part, ending in .efi, at most 86 characters. A value with a bad path is
a bad ob-default and the menu opens with the reason.
What writes NVRAM#
- The menu and the failure path write through one function,
ob_settings_commit. It accepts onlyob-*names of the project GUID and the one-shotalt-boot-volume, using the method iBoot's NVRAM layout allows: a compact copy into the next bank, the bank marker last, everything read back. The active bank is never written: the new copy goes into another bank, its magic bytes are programmed only after the rest of it has been written and verified (nor_write_span,openboot/src/nor_write.h), and the reader takes the valid bank with the highest generation. A write cut short therefore leaves a bank that is not valid, and the previous bank, with Apple's variables, stays in use. No power-cut test on hardware is published. - Unattended writes, the only ones nobody pressed a key for, happen only
in an image built with
OB_SETTINGS_WRITE=1: counting a failed boot, clearing the counter after a Windows session of 60 seconds or more, and the macOS autoboot one-shot. The build default isOB_SETTINGS_WRITE=0, and with it everyob-*write is refused with its reason. - Reading touches no flash: iBoot passes a copy of the whole NVRAM in the device tree.
Changing settings from macOS#
tools/macos/obnvram runs on the Mac (macOS, not recovery) and calls
nvram with the project GUID and an ob-* name only:
sh tools/macos/obnvram show
sh tools/macos/obnvram set autoboot on
sh tools/macos/obnvram set timeout 10
sh tools/macos/obnvram clear-fail
sh tools/macos/obnvram reset
set default takes internal, macos or an ESP GUID; reset deletes
every ob-* variable of the project GUID.
On macOS 27.3 nvram -p does not list a variable of a non-Apple GUID, so
nvram -p | grep finds nothing even when the variable is set. Read one by its
full key: nvram FD403708-AA82-4678-8ABD-058176114E5A:ob-autoboot. The
installer and obnvram do this. That such a value survives a reboot has not
been measured yet.
A stuck machine#
- Space at power-on opens the OpenBoot menu without writing anything.
- Hold the power button for Apple's startup options.
- From macOS,
sh tools/macos/obnvram resetdeletes every setting, and the menu then opens without a default.
Not verified#
- The commands above were not run in a documentation pass.
- The hardware gates that cover the first OpenBoot NVRAM write are recorded elsewhere and are not repeated here.