NixOS on ARM/Raspberry Pi: Difference between revisions

imported>Mweinelt
Bluetooth: Clarify, that the documented device applies to the Raspberry Pi 4
imported>Bct
boot.loader.generic-extlinux-compatible vs. boot.loader.raspberryPi
Line 299: Line 299:


== Notes about the boot process ==
== Notes about the boot process ==
The Raspberry Pi's stage 1 bootloader (in ROM) loads the stage 2 bootloader (bootcode.bin) from the first VFAT partition on the SD card. The NixOS aarch64 SD card image includes a VFAT partition (labelled <code>FIRMWARE</code>) with the stage 2 bootloader and configuration that loads U-Boot. U-Boot then continues from the second partition (labelled <code>NIXOS_SD</code>).


It takes approximately 1 minute to boot a Pi 3B.
It takes approximately 1 minute to boot a Pi 3B.
There are 2 primary options for booting a Raspberry Pi:
=== Boot option 1: <code>boot.loader.generic-extlinux-compatible</code> ===
This configuration is the most similar to the way that NixOS works on other devices. The downside is that NixOS won't attempt to manage anything associated with the first and second stage bootloaders (e.g. config.txt).
You can feel better about this by thinking about this configuration as similar to BIOS settings.
<syntaxhighlight lang="nix">
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
</syntaxhighlight>
=== Boot option 2: <code>boot.loader.raspberryPi</code> ===
This configuration assumes that the VFAT firmware partition is mounted to /boot. If it isn't, options like <code>boot.loader.raspberryPi.firmwareConfig</code> will write their configuration to the wrong partition and have no effect.
<syntaxhighlight lang="nix">
boot.loader.grub.enable = false;
boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.uboot.enable = true;
</syntaxhighlight>


=== Raspberry Pi (all versions) ===
=== Raspberry Pi (all versions) ===