Skip to content

apple: pick the ESP on every Apple NVMe controller - #50

Merged
RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
root800080:uboot-esp-by-driver
Nov 21, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:aurora-wipfrom
root800080:uboot-esp-by-driver

Conversation

@root800080

@root800080 root800080 commented Nov 16, 2026 •

Copy link
Copy Markdown

asahi_esp_devpart() only looks for the system ESP on NVMe controllers whose compatible is in its own list. That list has to be kept in step with apple_nvme_ids[] by hand. #47 added apple,t8142-nvme-ans2 and apple,t8140-nvme-ans2 to the driver but not here, so on a MacBook Air M5 (J813) U-Boot binds the SSD and then skips it when picking the ESP:

  • it still prints "Cannot persist EFI variables without system partition";
  • chosen/asahi,efi-system-partition is ignored;
  • it falls back to the first ESP with a loader, which on a Mac with more than one ESP may not be Aurora's.

This checks that the controller is driven by apple_nvme instead, as rtkit_helper.c already does for its own driver, so a controller added to the driver is picked up here too. Every compatible in the old list is in apple_nvme_ids[], so nothing changes on Macs that already work.

If you'd rather keep an explicit list, the alternative is to add apple,t8140-nvme-ans2 (the J813's fallback compatible) to it.

An IS_ENABLED(CONFIG_NVME_APPLE) guard keeps a configuration without the Apple NVMe driver linking; such a configuration has no Apple controller to pick.

Tests

  • J813 (MacBook Air M5), Aurora Fedora on the internal SSD alongside macOS and another ESP with a loader. Stage 1 was aura with aura#250, loaded into RAM over the proxy. Stage 2 was aura + the shipped J813 DTB + this U-Boot (25cbb0f plus this change). After the boot, ubootefi.var on the Aurora ESP holds Boot0001 "Fedora" pointing at \EFI\fedora\shimaa64.efi on the Aurora ESP's partition UUID, plus SbatLevel from shim. U-Boot therefore picked the Aurora ESP, persisted variables there and started shim. The boot went past GRUB; the screen then stays black, which is a separate problem after U-Boot.
  • apple_m1_defconfig, apple_j873_defconfig, and apple_m1_defconfig with NVME_APPLE disabled (NVME and NVME_PCI enabled) build with no warnings.
  • Not tested: any other Mac.

Disclosure: the investigation, the patch and the first draft of this text were done with an LLM coding assistant (Claude Code). I ran the hardware side and have read what is posted here.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, matching on the driver instead of a compatible list is the right fix, and the J813 result shows it. Two small things before merge. The commit has no Signed-off-by line, so please add yours (git commit --amend -s). Optionally, since DM_DRIVER_GET(apple_nvme) now needs CONFIG_NVME_APPLE at link time, a select NVME_APPLE under the Apple arch Kconfig (or an IS_ENABLED() guard) would keep a custom config from failing to link. Happy to help with any of it.

asahi_esp_devpart() only looks for the system ESP on controllers whose
compatible is in its own list. That list has to be kept in step with
apple_nvme_ids[] by hand, and it was not when the T8140/T8142
controllers were added to the driver: on a MacBook Air M5 (J813) U-Boot
binds the SSD but skips it here, so it names no ESP, cannot persist EFI
variables, and may boot another ESP that has a loader.

Check that the controller is driven by apple_nvme instead, as
rtkit_helper.c already does for its own driver. Every compatible in the
old list is in apple_nvme_ids[], so nothing changes for supported Macs.
The IS_ENABLED() guard keeps a configuration without CONFIG_NVME_APPLE
linking; it has no Apple controller to pick.

Signed-off-by: MisterY3515 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@root800080

Copy link
Copy Markdown
Author

Thanks for the review. I've added my Signed-off-by and the IS_ENABLED(CONFIG_NVME_APPLE) guard as suggested. apple_m1_defconfig, apple_j873_defconfig and a configuration without NVME_APPLE all build without warnings or errors.

@RyanTheTide

Copy link
Copy Markdown
Contributor

No-regression row on a MacBook Pro M4 Pro (J616s, T6040; its controller is apple,t6041-nvme-ans2). The test was one aura-try one-shot of its production Stage 2 with only U-Boot swapped: aurora-wip 5266dce plus this PR, built as U-Boot 2026.07-g702b6d13fc9c from apple_m1_defconfig. The aura head, device tree and config were kept byte for byte.

  • The trial booted through shim and GRUB to Linux on the fleet kernel. bios_version shows the trial U-Boot. NVMe root, SELinux enforcing, 0 failed units, 0 AVC denials, 0 kernel errors.
  • ESP choice: U-Boot loaded its EFI variable store from the Aurora ESP. efibootmgr on the trial matches production: BootOrder: 0001,0000 and Boot0001* Fedora on HD(4,GPT,b24655df-...)/\EFI\fedora\shimaa64.efi.
  • The Mac went back to its production Stage 2 afterwards; its hash is unchanged.

With the J813 row above, this covers a controller the old list knew (t6041) and one it didn't (t8140 fallback). The Apple builds CI run passed.

Assisted-by: LLM (Claude:Opus 5.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants