How to create UEFI aarch64 SD card image?

I’m trying to install NixOS on two aarch64 devices:

And I installed edk2-rk3588 UEFI Firmware to make booting from NVMe possible. But the issue is that the standard NixOS SD card image only uses extlinux, and does not support UEFI.

I looked at available definitions for SD card images and it seems all of the aarch64 use extlinux:

I tried some experiments using raw-efi format with nixos-generators but I couldn’t get them to boot.

The reason I want a NixOS image is that all of the non-NixOS ones like Armbian or stock inage from Rdaxa have ancient 5.10 kernels which prevent me from using ZFS to do the installation on the NVMe. It’s quite the rabbit hole.

So my question is, how would one go about creating an aarch64 SD card image supporting UEFI boot?

If the devices actually support UEFI, then you can use the aarch64 ISO image instead of the SD image, and you can install to storage like normal. This would really be ideal; it would be exactly like how we install NixOS on x86_64 devices. You boot the ISO, create and mount the file systems, nixos-generate-config, make sure it’s using a UEFI boot loader, nixos-install, and you’re good.

All this is dependent on the devices actually having proper UEFI support, of course. But it sounds like you’re manually setting up EDK2 on them, so that’s promising.

1 Like

That’s a good idea, and I believe I already tried that, but just in case I took this build:
https://hydra.nixos.org/build/239366129

And attempted to boot it from a MicroSD card, which was detected by the EDK2 UEFI firmware:

But when I attempt to boot into it it just takes me back to the “Boot Manager” view. No errors.

If I just let it boot without intervention I just get a lot of errors like this:

Trying to boot from MMC2
No misc partition
spl: partition error
Trying fit image at 0x4000 sector
Not fit magic
Trying fit image at 0x5000 sector
Not fit magic
sys malloc pool space exhausted
alloc_read_gpt_entries: ERROR: Can't allocate lX bytes for GPT Entries
GPT: Failed to allocate memory for PTE
part_get_info_efi: *** ERROR: Invalid GPT ***
part_get_info_efi: ***        Using Backup GPT ***

Full log: rock_5b_boot_fail.log · GitHub

What’s interesting is that I can boot NixOS from the NVMe just fine, which I unstalled form an Armbian image. But I have yet to find a single NixOS image that can boot. I don’t get it.

Oh, interesting, I burned this ISO image: Hydra - Build 239294120 of job nixos:trunk-combined:nixos.iso_minimal.aarch64-linux

But onto a USB drive instead of an SD card and it worked:

This is a screenshot from a UART console from Rock 5B.

I don’t know why SD card boot wouldn’t work from an ISO image, but USB does work.

Thanks for suggesting to try the ISO again @ElvishJerricco .

1 Like

Did you try another SD card?

I have. I tired several. Might be a bug in or misconfiguration of the UEFI firmware.

1 Like

Did you install to your board with this ISO image? I can see the grub menu, however, the installer just hangs on exiting boot service, I can’t figure out why.

I did, it works. You can see which image I used in this screenshot:

I’ve tried all the images you mentioned in that github issue with SD card and usb, unfortunately, they all just hangs on EFI stub: Exiting boot services. My SBC is orange pi 5, if that’s related.

No idea about your board dude. ARM boards and their boot processes are notoriously custom. You cannot expect instructions from one to work on another.

1 Like