Neutron is a bare-metal bootloader for ARMv8 AArch64. It is part of Project Atom and targets the Raspberry Pi Zero 2W and compatible boards (such as the Raspberry Pi 3B). It can be run on real hardware or under QEMU using the raspi3b machine, which emulates the same BCM2837-style peripherals and memory map.

What Neutron Does

After the GPU (or QEMU) loads the bootloader image at address 0x80000, Neutron:

  1. Initialises the CPU: Parks secondary cores so only core 0 runs; drops from EL2 to EL1 if necessary; disables MMU and caches; sets up stack and zeroes BSS.

  2. Brings up serial output: Configures the PL011 UART at 0x3F201000 (GPIO 14/15, 115200 baud, 8N1) so that debug and boot messages can be printed.

  3. Queries board information: Uses the VideoCore mailbox to obtain board revision and ARM-accessible memory size.

  4. Initialises storage: Initialises the SD card and mounts the first FAT32 partition so that files can be read from it.

  5. Loads the kernel: Reads the file ATOM.BIN from the FAT32 root into a staging area at 0x100000. It then validates the NKRN header (magic, size, CRC32), copies the payload to the load address (0x200000 by default), and fills a boot_info_t structure at physical address 0x1000.

  6. Transfers control: Jumps to the kernel entry point with register x0 set to the address of boot_info_t. The kernel can use this structure to learn load address, entry address, size, board revision, and memory size.

Design Principles

  • Minimal and self-contained: No external runtime; only the cross-compiler toolchain and, for SD image creation, standard host tools (parted, mtools, dosfstools).
  • Real hardware oriented: Addresses and peripherals follow the BCM2837/BCM2710 layout so that the same binary can run in QEMU and on a Raspberry Pi.
  • Structured kernel handoff: The NKRN format and boot_info_t give the kernel a well-defined contract for load address, entry point, and boot-time information.