NixOS on ARM: Difference between revisions

From NixOS Wiki
imported>Samueldr
m →‎Enable UART: misc. enhancemetns
Add Radxa ROCK 4 to table (will add linked page next)
 
(243 intermediate revisions by 80 users not shown)
Line 1: Line 1:
Installation images and miscellaneous boot files for ARM devices are built & hosted by '''@dezgeg''' at http://nixos-arm.dezgeg.me/installer.
<languages/>
<translate>
<!--T:1-->
<div style="font-size: 1.5rem; text-align: center;padding-bottom: 0.5rem;"><strong>NixOS supports 64-bit ARM.</strong></div>


A binary cache, containing a [https://github.com/dezgeg/nixconfs/blob/master/packages.txt subset] of the unstable channel, is hosted at http://nixos-arm.dezgeg.me/channel (signed with '''key''' <code>nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%</code>).
<!--T:2-->
The support level for ARM overall varies depending on the architecture and the specific ecosystems and boards.


Additionally, thanks to [https://github.com/grahamc Graham Christensen] and [https://www.packet.net/ Packet] the [https://hydra.nixos.org/ official NixOS Hydra] builds a full set of binaries (available on https://cache.nixos.org) for the AArch64 architecture on the nixpkgs-unstable channel.
<!--T:3-->
The way the ARM integration is built into NixOS is by making '''generic builds the first-class citizens'''. This means that as soon as there is upstream support for the board in the kernel and platform firmware, NixOS should work once those are updated.


== Supported devices ==
<!--T:4-->
It is still possible, when needed, to build and use a customized platform firmware and kernel for specific boards<sup>[[Talk:NixOS_on_ARM#NixOS_.22support.22_for_board-specific_kernels_or_bootloaders|[reference needed]]]</sup>.


=== Upstream (NixOS) supported devices ===
<!--T:5-->
At this moment in time (early 2024) '''only AArch64''' has full support upstream. With that said, neither armv6l or armv7l are being ignored, fixes are worked on and approved as needed. What's missing is support and builds being maintained in binary form. At the time of writing, no publicly available caches for armv6l or armv7l are available.<!-- please get in touch with samueldr on the NixOS on ARM channel if you want to share your own cache, before editing. We need to review the wording to make it crystal clear it's a user-provided cache. -->


NixOS has beta support for these boards using AArch64 architecture on the nixpkgs-unstable channel.
<!--T:6-->
'''For images links, including UEFI install''', skip to the [[NixOS_on_ARM/Installation|Installation page]].


== Supported devices == <!--T:7-->
<!--T:8-->
Table legend:
* SoC - https://en.wikipedia.org/wiki/System_on_a_chip
* ISA - https://en.wikipedia.org/wiki/Instruction_set_architecture
=== Upstream (NixOS) supported devices === <!--T:9-->
<!--T:10-->
NixOS has support for these boards using AArch64 architecture on the nixpkgs-unstable and stable channel.
<!--T:11-->
Support for those board assumes as much is supported as Mainline Linux supports.
<!--
<!--
Order for the device table is:
Order for the device table is:
Line 16: Line 38:
  * By release date, chronological (older first).
  * By release date, chronological (older first).
-->
-->
<div class="table">
{|class="table"
{|class="table"
!width="2%"| Manufacturer
!width="2%"| Manufacturer
!width="2%"| Board
!width="2%"| Board
!width="2%"| SoC
!width="2%"| SoC
!width="2%"| ISA
!width="1%"| ISA
!width="2%"| CPU
!width="2%"| CPU
!width="2%"| RAM
!width="1%"| RAM
!width="2%"| Storage
!width="2%"| Storage
|-
|-
| Raspberry Pi Foundation
| Raspberry Pi Foundation
| [[NixOS_on_ARM/Raspberry_Pi|Raspberry Pi 3]]
| [[NixOS_on_ARM/Raspberry_Pi_3|Raspberry Pi 3]]
| Broadcom BCM2837
| Broadcom BCM2837
| AArch64 / ARMv7
| AArch64 / ARMv7
| 4x Cortex-A53 @ 1.2 GHz
| Cortex-A53 @ 1.2 - 1.4 GHz
| 1 GB
| 1 GB
| SD/microSD
| SD/microSD
|-
| Raspberry Pi Foundation
| [[NixOS_on_ARM/Raspberry_Pi 4|Raspberry Pi 4]]
| Broadcom BCM2711
| AArch64 / ARMv7
| 4× Cortex-A72 @ 1.5 - 1.8 GHz
| 1-8 GB
| microSD, eMMC
|}
|}
</div>
=== Community supported devices ===
=== Community supported devices ===


The installation images by '''@dezgeg''' should work on the following devices:
<!--T:12-->
These boards are not routinely verified as working.


<!--T:13-->
The baseline support level expected is “Just as much as mainline Linux and U-Boot supports them”, except if specified otherwise.
<!--
<!--
Order for the device table is:
Order for the device table is:
Line 42: Line 77:
  * By release date, chronological (older first).
  * By release date, chronological (older first).
-->
-->
{|class="table"
<div class="table">
{| class="sortable table"
!width="2%"| Manufacturer
!width="2%"| Manufacturer
!width="2%"| Board
!width="2%"| Board
!width="2%"| SoC
!width="2%"| SoC
!width="2%"| ISA
!width="1%"| ISA
!width="2%"| CPU
!width="2%"| CPU
!width="2%"| RAM
!width="2%"| RAM
!width="2%"| Storage
!width="2%"| Storage
|-
| Apple
| [[NixOS_on_ARM/Apple Silicon Macs|Apple Silicon Macs]]
| M1/M1 Pro/M1 Max
| AArch64
| —
| —
| NVMe
|-
| ASUS
| [[NixOS_on_ARM/ASUS Tinker Board|Tinker Board]]
| Rockchip RK3288
| ARMv7
| 4× Cortex-A17
| 2 GB
| microSD
|-
| Banana Pi
| [[NixOS_on_ARM/Banana Pi|Banana Pi]]
| Allwinner A20
| ARMv7
| 2× Cortex-A7
| 1 GB
| SD, SATA
|-
| Banana Pi M64
| [[NixOS_on_ARM/Banana Pi M64|Banana Pi M64]]
| Allwinner A64
| AArch64
| 4× Cortex-A53
| 2 GB
| microSD, 8GB eMMc
|-
| Banana Pi BPI-M5
| [[NixOS_on_ARM/Banana Pi BPI-M5|Banana Pi BPI-M5]]
| Amlogic S905X3
| AArch64
| 4× Cortex-A55
| 4 GB LPDDR4
| microSD, 16G eMMC
|-
|-
| BeagleBoard.org
| BeagleBoard.org
| Beaglebone Black
| [[NixOS_on_ARM/BeagleBone_Black|BeagleBone Black]]
| TI AM335x
| TI AM335x [https://git.beagleboard.org/beagleboard/beaglebone-black (src)]
| ARMv7
| 1× Cortex-A8 @ 1 GHz
| 512 MB
| 4 GB eMMC, microSD
|-
| Firefly
| [[NixOS_on_ARM/Firefly_AIO-3399C|AIO-3399C]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 2/4 GB
| 8/16 GB eMMC, microSD
|-
| FriendlyElec
| [[NixOS_on_ARM/NanoPC-T4|NanoPC-T4]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 4 GB
| 16 GB eMMC, microSD, NVMe
|-
| FriendlyElec
| [[NixOS_on_ARM/NanoPi-M4|NanoPi-M4]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 4 GB
| optional eMMC, microSD
|-
| FriendlyElec
| [[NixOS_on_ARM/NanoPi-R6C|NanoPi-R6C]]
| Rockchip RK3588S
| AArch64
| 4× ARM Cortex-A76 @ 2.4 GHz, 4× Cortex-A55 @ 1.8 Ghz
| 4 GB / 8 GB
| optional eMMC, microSD, NVMe
|-
| Hardkernel
| [[NixOS_on_ARM/ODROID-HC1|ODROID-HC1 & ODROID-HC2]]
| Samsung Exynos 5422
| ARMv7
| ARMv7
| 1x Cortex-A8 @ 1 GHz
| Cortex-A15 @ 2GHz, 4× Cortex-A7 @ 1.4GHz
| 512 MB
| 2 GB
| 4 GB eMMC, microSD
| microSD
|-
| Hardkernel
| [[NixOS_on_ARM/ODROID-C2|ODROID-C2]]
| Amlogic S905
| AArch64
| 4× Cortex-A53 @ 1.5GHz
| 2 GB
| eMMC, microSD
|-
| Hardkernel
| [[NixOS_on_ARM/ODROID-HC4|ODROID-HC4]]
| Amlogic S905X3
| AArch64
| 4× Cortex-A55 @ 1.8GHz
| 4 GB
| microSD, SATA
|-
|Kosagi
|[[NixOS on ARM/Kosagi Novena|Kosagi Novena]]
|i.MX6
|ARMv7
|4× Cortex-A9 @ 1.2 GHz
|4 GB
|microSD, SATA
|-
| Libre Computer
| [[NixOS_on_ARM/Libre_Computer_ROC-RK3399-PC|ROC-RK3399-PC]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 4 GB
| eMMC, microSD, NVMe
|-
| Libre Computer
| [[NixOS_on_ARM/Libre_Computer_ROC-RK3328-CC|ROC-RK3328-CC]]
| Rockchip RK3328
| AArch64
| 4× Cortex-A53 @ 1.4GHz
| 4 GB
| eMMC, microSD
|-
| Libre Computer
| [[NixOS_on_ARM/Libre_Computer_AML-S905X-CC-V2|AML-S905X-CC-V2]]
| Amlogic S905X
| AArch64
| 4× Cortex-A53 @ 1.512 GHz
| 1/2GB
| eMMC, microSD
|-
|-
| Linksprite
| Linksprite
| pcDuino3 Nano
| [[NixOS_on_ARM/PcDuino3_Nano|pcDuino3 Nano]]
| Allwinner A20
| Allwinner A20
| ARMv7
| ARMv7
| 2x Cortex-A7 @ 1 GHz
| Cortex-A7 @ 1 GHz
| 1 GB
| 1 GB
| 4 GB NAND, microSD, SATA
| 4 GB NAND, microSD, SATA
|-
|-
| NVIDIA
| NVIDIA
| Jetson TK1
| [[NixOS_on_ARM/Jetson TK1|Jetson TK1]]
| Tegra K1/T124
| Tegra K1/T124
| ARMv7
| ARMv7
| 4x Cortex-A15 @ 2.3 GHz
| Cortex-A15 @ 2.3 GHz
| 2 GB
| 16 GB eMMC, SD, SATA
|-
| NXP
| [https://github.com/NiklasGollenstede/nixos-imx/ i.MX 8M Plus EVK]
| i.MX 8M Plus
| AArch64
| 4× Cortex-A53 @ 1.8 Ghz
| 6 GB
| 32 GB eMMC, microSD
|-
| NXP
| [https://github.com/gangaram-tii/nixos-imx8mq/ i.MX 8M Quad EVK]
| i.MX 8M Quad
| AArch64
| 4× Cortex-A53 @ 1.5 Ghz + 1× Cortex-M4
| 3 GB
| 16 GB eMMC, microSD
|-
| OLIMEX
| [[NixOS_on_ARM/OLIMEX_Teres-A64|Teres-A64]]
| AllWinner A64
| AArch64
| 4× Cortex-A53 @ 1.1 GHz
| 2GB
| 16 GB eMMC, microSD
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_One|Orange Pi One]]
| Allwinner H3
| ARMv7
| 4× Cortex-A7 @ 1.2 GHz
| 512 MB
| microSD
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_PC|Orange Pi PC]]
| Allwinner H3
| ARMv7
| 4× Cortex-A7 @ 1.6 GHz
| 1 GB
| SD/microSD
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_Zero_Plus2_H5|Orange Pi Zero Plus2 (H5)]]
| Allwinner H5
| AArch64
| 4× Cortex-A53 @ 1.2 GHz
| 1 GB
| SD/microSD + 8GB eMMC
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_Zero2_H616|Orange Pi Zero2 (H616)]]
| Allwinner H616
| AArch64
| 4× Cortex-A53 @ 1.2 GHz
| 1 GB
| SD/microSD + 2MB SPI Flash
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_R1_Plus_LTS|Orange Pi R1 Plus LTS]]
| Rockchip RK3328
| AArch64
| 4× Cortex-A53 @ 1.5 GHz
| 1 GB
| microSD
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_5|Orange Pi 5]]
| Rockchip RK3588s
| AArch64
| 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz
| 4/8/16 GB
| microSD, NVMe
|-
| Orange Pi
| [[NixOS_on_ARM/Orange_Pi_5_Plus|Orange Pi 5 Plus]]
| Rockchip RK3588
| AArch64
| 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz
| 4/8/16 GB
| eMMC, microSD, NVMe
|-
| PINE64
| [[NixOS_on_ARM/PINE A64-LTS|PINE A64-LTS]]
| Allwinner R18
| AArch64
| 4× Cortex-A53 @ ? GHz
| 2 GB
| 2 GB
| 16 GB eMMC, SD, SATA
| microSD & eMMC
|-
| PINE64
| [[NixOS_on_ARM/PINE64_Pinebook|Pinebook]]
| Allwinner A64
| AArch64
| 4× Cortex-A53 @ ? Ghz
| 2 GB
| microSD & eMMC
|-
| PINE64
| [[NixOS_on_ARM/PINE64_Pinebook_Pro|Pinebook Pro]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 4 GB
| microSD & eMMC
|-
| PINE64
| [[NixOS_on_ARM/PINE64_ROCK64|ROCK64]]
| Rockchip RK3328
| AArch64
| 4× Cortex-A53 @ 1.5 GHz
| 1/2/4 GB
| microSD/eMMC
|-
| PINE64
| [[NixOS_on_ARM/PINE64_ROCKPro64|ROCKPro64]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 2/4 GB
| microSD/eMMC
|-
| Clockworkpi
| [[NixOS_on_ARM/Clockworkpi_A06_uConsole|uConsole A06]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz
| 4 GB
| microSD
|-
| Radxa
| [[NixOS on ARM/Radxa ROCK 4|ROCK 4]]
| Rockchip RK3399
| AArch64
| 2× Cortex-A72, 4×Cortex-A53
| 2/4 GB
| eMMC, microSD, NVMe via expansion board
|-
| Radxa
| [[NixOS on ARM/Radxa ROCK5 Model B|ROCK5 Model B]]
| Rockchip RK3588
| AArch64
| 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz
| 4/8/16 GB
| eMMC, microSD, NVMe
|-
| Radxa
| [[NixOS on ARM/Radxa ROCK5 Model A|ROCK5 Model A]]
| Rockchip RK3588s
| AArch64
| 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz
| 4/8/16 GB
| eMMC, microSD, NVMe
|-
|-
| Raspberry Pi Foundation
| Raspberry Pi Foundation
Line 79: Line 395:
| Broadcom BCM2835
| Broadcom BCM2835
| ARMv6
| ARMv6
| 1x ARM1176 @ 700 MHz
| 1 × ARM1176 @ 700 MHz
| 256 MB / 512 MB
| 256 MB / 512 MB
| SD/microSD
| SD/microSD
|-
|-
Line 87: Line 403:
| Broadcom BCM2836
| Broadcom BCM2836
| ARMv7
| ARMv7
| 4x Cortex-A7 @ 900 MHz
| Cortex-A7 @ 900 MHz
| 1 GB
| 1 GB
| SD/microSD
| SD/microSD
|-
|-
| Raspberry Pi Foundation
| Raspberry Pi Foundation
| [[NixOS_on_ARM/Raspberry_Pi|Raspberry Pi 3]]
| [[NixOS_on_ARM/Raspberry_Pi 3|Raspberry Pi 3]]
| Broadcom BCM2837
| Broadcom BCM2837
| AArch64 / ARMv7
| AArch64 / ARMv7
| 4x Cortex-A53 @ 1.2 GHz
| Cortex-A53 @ 1.2 GHz
| 1 GB
| 1 GB
| SD/microSD
| SD/microSD
|-
| Raspberry Pi Foundation
| [[NixOS_on_ARM/Raspberry_Pi 4|Raspberry Pi 4]]
| Broadcom BCM2711
| AArch64 / ARMv7
| 4× Cortex-A53 @ 1.5 GHz
| 1-8 GB
| microSD
|-
| Raspberry Pi Foundation
| [[NixOS_on_ARM/Raspberry_Pi 5|Raspberry Pi 5]]
| Broadcom BCM2712
| AArch64
| 4× Cortex-A76 @ 2.4 GHz
| 4-8 GB
| microSD
|-
|-
| Toshiba
| Toshiba
Line 103: Line 435:
| Tegra 2 250 (T20)
| Tegra 2 250 (T20)
| ARMv7
| ARMv7
| 2x Cortex-A9 @ 1 GHz
| Cortex-A9 @ 1 GHz
| 512 MB
| 512 MB
| 8-32 GB eMMC, SD
| 8­­–32 GB eMMC, SD
|-
|-
| Wandboard
| Wandboard
| Wandboard Solo/Dual/Quad
| [[NixOS_on_ARM/Wandboard|Wandboard Solo/Dual/Quad]]
| Freescale i.MX6
| Freescale i.MX6
| ARMv7
| ARMv7
| 1x/2x/4x Cortex-A9 @ 1000 MHz
| //Cortex-A9 @ 1000 MHz
| 512 MB / 1 GB / 2 GB
| 512 MB / 1 GB / 2 GB
| microSD, SATA
| microSD, SATA
|}
|}
</div>


QEMU emulation is not supported as of right now<sup>[https://nixos.wiki/wiki/Talk:NixOS_on_ARM#QEMU_support Talk]</sup>.
==== Special Devices ==== <!--T:14-->


== Installation ==
<!--T:15-->
It is possible to emulate an ARM platform with QEMU.


The installation images come in two flavors: <code>sd-image-armv6l-linux.img</code> is built for the ARMv6 architecture and it comes with the Raspberry Pi kernel. sd-image-armv7l-linux.img is built for the ARMv7 architecture and comes with the mainline multiplatform ARMv7 kernel (multi_v7_defconfig). Make sure you download the correct image for your board!
<!--T:16-->
 
<div class="table">
The .img files can be directly written to a microSD/SD card (minimal recommended size: 4 GB) using dd.
{|class="table"
 
!width="2%"| Manufacturer
<syntaxhighlight lang="bash">sudo dd if=sd-image-armv7l-linux.img of=/dev/sdX</syntaxhighlight>
!width="2%"| Board
Replace <code>/dev/sdX</code> with the path to your SD card device.
!width="2%"| SoC
 
!width="2%"| ISA
The base images are configured to boot up with a serial TTY ( RX/TX UART ) @ 115200 Baud. That way you not necessarily have to have a HDMI Display and keyboard.
!width="2%"| CPU
 
!width="2%"| RAM
== Board-specific installation notes ==
!width="2%"| Storage
 
|-
Depending on the board, some additional preparation steps might be needed to make the SD card bootable on your device.
| QEMU
 
| [[NixOS_on_ARM/QEMU|QEMU]]
=== Beaglebone Black ===
| —
 
| ARMv7
U-Boot and its SPL (called the MLO) need to be copied to specific sectors on the microSD card with dd. Download U-Boot & MLO for the board (<code>uboot-am335x_boneblack_defconfig-2017.03_u-boot.img</code>, <code>uboot-am335x_boneblack_defconfig-2017.03_MLO</code>), and copy them to the correct location with (again, replace /dev/sdX with the correct path to the SD card device):
| up to 8
 
| up to 2 GB
<syntaxhighlight lang="bash">
| Anything QEMU supports
sudo dd if=uboot-am335x_boneblack_defconfig-2017.03_MLO        of=/dev/sdX count=1 seek=1 bs=128k
|}
sudo dd if=uboot-am335x_boneblack_defconfig-2017.03_u-boot.img of=/dev/sdX count=2 seek=1 bs=384k
</div>
</syntaxhighlight>
 
In case there is a valid boot loader on the eMMC of the board and the NixOS U-Boot isn't getting launched, try holding the button labeled 'S2' when resetting the board. Also the boot ROM might have a size limitation on the microSD cards used for booting; the author wasn't able to get a 64 GB SDXC card working but a 8 GB SDHC card worked.
 
=== Jetson TK1 ===
 
The proprietary NVIDIA bootloader can only boot NVIDIA's L4T kernel, so it needs to be replaced by flashing U-Boot on the board's eMMC via the recovery USB port. The easiest way to do that is to use tegra-uboot-flasher-scripts, though unfortunately that's currently not packaged in NixOS. Once U-Boot is flashed, the ARMv7 image will boot out-of-the-box.
 
=== pcDuino 3 Nano ===
 
U-Boot needs to be copied to specific sectors on the microSD card with dd. Download U-Boot for the board (<code>uboot-Linksprite_pcDuino3_Nano_defconfig-2015.07_u-boot-sunxi-with-spl.bin</code>), and copy it to the correct location with (again, replace <code>/dev/sdX</code> with the correct path to the SD card device):
 
<syntaxhighlight lang="bash">sudo dd if=uboot-Linksprite_pcDuino3_Nano_defconfig-2015.07_u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8</syntaxhighlight>
 
=== Wandboard ===
 
U-Boot and its SPL need to be copied to specific sectors on the microSD card with dd. Download U-Boot & SPL for the board (<code>uboot-wandboard_defconfig-2017.03_u-boot.img</code>, <code>uboot-wandboard_defconfig-2017.03_SPL</code>), and copy them to the correct location with (again, replace /dev/sdX with the correct path to the SD card device):
 
<syntaxhighlight lang="bash">
sudo dd if=uboot-wandboard_defconfig-2017.03_SPL        of=/dev/sdX seek=1 bs=1k
sudo dd if=uboot-wandboard_defconfig-2017.03_u-boot.img of=/dev/sdX seek=69 bs=1k
</syntaxhighlight>
 
Only the Quad model has been tested, but the others should work as well with the same U-Boot binary.
 
== Enable UART ==
 
If you try to use UART to log on NixOS, you might hang on the line "Starting kernel ...". To enable UART, you will need to add at the end of the line that contains <code>loglevel4</code> in the file <code>/extlinux/extlinux.conf</code> the text:
{{file|/extlinux/extlinux.conf||<nowiki>
    console=ttyAMA0,115200n8
</nowiki>}}
{{file|/extlinux/extlinux.conf||<nowiki>
    console=ttyS0,115200n8
</nowiki>}}
The actual device (<code>ttyAMA0</code>, <code>ttyS0</code>) will depend on the hardware.
 
== NixOS installation & configuration ==
 
The installation image is actually a MBR partition table plus two partitions; a FAT32 /boot and a ext4 root filesystem. The image is designed such that it's possible to directly reuse the SD image's partition layout and "install" NixOS on the very same SD card by simply replacing the default configuration.nix and running nixos-rebuild. Using this installation method is strongly recommended, though if you know exactly what you're doing and how U-Boot on your board works, you can use nixos-install as usual. To help with the SD card installation method, the boot scripts on the image automatically resize the rootfs partition to fit the SD card on the first boot.
 
Use this as a template:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{ config, pkgs, lib, ... }:
{
  # NixOS wants to enable GRUB by default
  boot.loader.grub.enable = false;
  # Enables the generation of /boot/extlinux/extlinux.conf
  boot.loader.generic-extlinux-compatible.enable = true;
  # !!! If your board is a Raspberry Pi 1, select this:
  boot.kernelPackages = pkgs.linuxPackages_rpi;
  # !!! Otherwise (even if you have a Raspberry Pi 2 or 3), pick this:
  boot.kernelPackages = pkgs.linuxPackages_latest;
 
  # !!! This is only for ARMv6 / ARMv7. Don't enable this on AArch64, cache.nixos.org works there.
  nix.binaryCaches = lib.mkForce [ "http://nixos-arm.dezgeg.me/channel" ];
  nix.binaryCachePublicKeys = [ "nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%" ];
 
  # !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough.
  boot.kernelParams = ["cma=32M"];
   
  # File systems configuration for using the installer's partition layout
  fileSystems = {
    "/boot" = {
      device = "/dev/disk/by-label/NIXOS_BOOT";
      fsType = "vfat";
    };
    "/" = {
      device = "/dev/disk/by-label/NIXOS_SD";
      fsType = "ext4";
    };
  };
   
  # !!! Adding a swap file is optional, but strongly recommended!
  # swapDevices = [ { device = "/swapfile"; size = 1024; } ];
}</nowiki>}}
Note: the default configuration.nix will contain something like <code>imports = [ <nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix> ];</code> do not include that in your final installation or you will experience interesting problems. It is only for building the installation image!
 
To make the ARM experience slightly less painful, the config template adds <code>nixos-arm.dezgeg.me</code> as a binary cache, which contains a small subset of packages on the unstable channel (though a caution for US users: the server hosting them is physically located in Finland). Note that the binary cache isn't enabled on the prebuilt images, so enable it via the command line when building for the first time:
 
<syntaxhighlight lang="bash">nixos-rebuild switch --fast --option binary-caches http://nixos-arm.dezgeg.me/channel --option binary-cache-public-keys nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%</syntaxhighlight>
 
=== Resizing the boot partition ===
{{note|The instructions as they are were tested on the Raspberry Pi 3}}
 
{{warning|Platforms needing a secondary boot loader before the boot partition, (when using <code>dd</code> to add u-boot, MLO or SPL) will need to take in consideration where the original <code>/boot</code> partition starts.}}
 
It is possible that you run out of disk space on the boot partition after some system upgrades.
To resize the boot partition:
* (If not already done, boot once to trigger the initial partition resizing)
* Backup the files currently stored in the boot partition
* Repartition and make sure to delete and then recreate the boot partition (fat32, primary, label: <code>NIXOS_BOOT</code>)
* Copy the files from the backup back to the new boot partition
 
== Details about the boot process ==
 
On NixOS, all ARM boards use the popular U-Boot as the bootloader and [https://github.com/u-boot/u-boot/blob/master/doc/README.distro U-Boot's Generic Distro Configuration Concept] as the mechanism to communicate boot information (such as path to kernel zImage, initrd, DTB, command line arguments). For a quick TL;DR about the generic distro configuration support: U-Boot is scripted to scan all attached storage devices & partitions and look for a file named <code>/extlinux/extlinux.conf</code> or <code>/boot/extlinux/extlinux.conf</code> (which will be generated by NixOS, just like <code>/boot/grub/grub.cfg</code> is generated on PCs).


U-Boot also provides an interactive shell and the generation selection menu (just like GRUB). However, support for input or display devices varies greatly, depending on the board:
== Installation == <!--T:17-->


=== Beaglebone Black ===
<!--T:18-->
{{main|NixOS_on_ARM/Installation}}


Only serial console (via the 6-pin FTDI pin header) is supported.
== Initial configuration == <!--T:19-->


=== Jetson TK1 ===
<!--T:20-->
{{main|NixOS_on_ARM/Initial_Configuration}}


Only serial console (via the DB-9 connector) is supported.
== Troubleshooting == <!--T:21-->


=== pcDuino 3 Nano ===
<!--T:22-->
=== Hanging at <code>Starting kernel ...</code> ===
When booting a NixOS system, it may look like it is hung at <code>Starting kernel ...</code>.


USB keyboards and HDMI displays work perfectly. Also a 3.3v serial port via the 3-pin header works.
<!--T:23-->
It is unlikely to be hung at this part. This is the last message printed by U-Boot. U-Boot prints to both the display and the console at once.


=== Wandboard ===
<!--T:24-->
To view the kernel messages and boot output, the “<code>stdout</code>” of the kernel needs to be configured appropriately.


Only serial console (via the DB-9 connector) is supported.
<!--T:25-->
The kernel's <code>stdout</code> will differ depending on semantics.


== Porting NixOS to new boards ==
<!--T:26-->
* When there are no valid <code>console=</code> kernel command-line arguments, it will default to the <code>/chosen/stdout-path</code> device tree property. (Generally a serial console.)
* When valid <code>console=</code> parameters are present, the kernel picks the leftmost valid one as <code>stdout</code>.


=== The easy way ===
<!--T:27-->
In other words, the solution may be to enable the appropriate <code>console=</code> parameters according to your hardware configuration and system.


''(if you're lucky)''
<!--T:28-->
* For the display, add <code>console=tty0</code>.
* For a serial console, refer to the target device configuration.


If your board is an ARMv7 board supported by multi_v7_defconfig and you have access to U-Boot on the board, getting <code>sd-image-armv7l-linux.img</code> to boot is the easiest option:
=== Details about the boot process === <!--T:29-->


* If you're lucky and your U-Boot build comes with the extlinux.conf support built in, the image boots out-of-the-box. This is the case for all (upstream) Allwinner and Tegra U-Boots, for instance.
<!--T:30-->
* Otherwise, you can get the boot information (path to kernel zImage, initrd, DTB, command line arguments) by extracting <code>extlinux.conf</code> from the boot partition of the image, and then attempt to boot it via the U-Boot shell, or some other mechanism that your board's distro uses (e.g. <code>uEnv.txt</code>).
NixOS can also be booted through [[NixOS on ARM/UEFI|UEFI]] on ARM. The semantics are generally the same as on other architectures. Do note that the common use of Device Tree instead of ACPI in consumer-class hardware [[NixOS_on_ARM/UEFI#Device_Trees|''may'' make this a bit more awkward]].


==== Building u-boot from your NixOS PC ====
<!--T:31-->
Otherwise, in SBC-class hardware, it is common that boards are generally expected to use U-Boot as the platform firmware and bootloader. See the section about [[U-Boot#Using NixOS with U-Boot|using NixOS with U-Boot]].


Assuming
== Binary caches == <!--T:32-->


* Your board is supported upstream by u-boot or there is a recent enough fork with <code>extlinux.conf</code> support.
=== AArch64 === <!--T:33-->
* You do not have nix setup on an ARM device
* Your nix isn't setup for cross-compilation


It is still possible to build u-boot using tools provided by NixOS.
<!--T:34-->
The [https://hydra.nixos.org/ official NixOS Hydra] instance builds a full set of binaries (available on https://cache.nixos.org) for the AArch64 architecture on the nixpkgs-unstable and stable channels.


In the following terminal session, replace <code>orangepi_pc_defconfig</code> with the appropriate board [http://git.denx.de/?p=u-boot.git;a=tree;f=configs;hb=HEAD from the configs folder] of u-boot.
=== armv6l and armv7l === <!--T:35-->


{{Commands|<nowiki>
<!--T:36-->
$ nix-shell -E 'with import <nixpkgs> {}; stdenv.mkDerivation { name = "arm-shell"; buildInputs = [git gnumake gcc gcc-arm-embedded dtc]; }'
Some '''''users''''' have provided best effort caches in the past for 32 bit ARM, but none are currently available.
$ git clone git://git.denx.de/u-boot.git
$ cd u-boot
# We're checking out a version from before the use of `binman`.
# The dtc package is 1.4.2, which does not include `pylibftd`.
# Furthermore, I do not know how to package the library so it would be
# available in the python interpreter, making binman happy.
$ git checkout v2017.03
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_pc_defconfig
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
</nowiki>}}


The name of the final file will change depending on the board. For this specific build, and most Allwinner builds, the file will be named <code>u-boot-sunxi-with-spl.bin</code>.
== Getting Support == <!--T:37-->


=== The hard way ===
<!--T:38-->
There is a dedicated room for the upstream NixOS effort on Matrix,
[https://matrix.to/#/#nixos-on-arm:nixos.org #nixos-on-arm:nixos.org].


Alternatively/if all else fails, you can do it the hard way and bootstrap NixOS from an existing ARM Linux installation.
<!--T:39-->
Don't hesitate to ask questions. Note that reply times may vary greatly, depending on the provided information.


=== Contributing new boards to nixpkgs ===
== Resources == <!--T:40-->


* Add a new derivation for your board's U-Boot configuration, see for example ubootJetsonTK1 in {{Nixpkgs Link|short=all-packages.nix|pkgs/top-level/all-packages.nix}}.
=== See also === <!--T:41-->
* If your board's U-Boot configuration doesn't use the <code>extlinux.conf</code> format by default, create a patch to enable it. Some C hacking skills & U-Boot knowledge might be required. For some pointers, see this patch to enable it on the Versatile Express.
* Make a pull request, also containing the board-specific instructions. Ping '''@dezgeg''' for review and for building & hosting the U-Boots at http://nixos-arm.dezgeg.me/installer.


== Resources ==
<!--T:42-->
* [[U-Boot]], as it is often paired with SBC-class hardware.
* [https://mobile.nixos.org/ Mobile NixOS], which provides enhanced semantic around some non-standard boot semantics.


=== Subpages ===
=== Subpages === <!--T:43-->


<!--T:44-->
The following is a list of all sub-pages of the ''NixOS on ARM'' topic.
The following is a list of all sub-pages of the ''NixOS on ARM'' topic.


<!--T:45-->
{{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}
{{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}
</translate>

Latest revision as of 03:15, 10 October 2024

NixOS supports 64-bit ARM.

The support level for ARM overall varies depending on the architecture and the specific ecosystems and boards.

The way the ARM integration is built into NixOS is by making generic builds the first-class citizens. This means that as soon as there is upstream support for the board in the kernel and platform firmware, NixOS should work once those are updated.

It is still possible, when needed, to build and use a customized platform firmware and kernel for specific boards[reference needed].

At this moment in time (early 2024) only AArch64 has full support upstream. With that said, neither armv6l or armv7l are being ignored, fixes are worked on and approved as needed. What's missing is support and builds being maintained in binary form. At the time of writing, no publicly available caches for armv6l or armv7l are available.

For images links, including UEFI install, skip to the Installation page.

Supported devices

Table legend:

Upstream (NixOS) supported devices

NixOS has support for these boards using AArch64 architecture on the nixpkgs-unstable and stable channel.

Support for those board assumes as much is supported as Mainline Linux supports.

Manufacturer Board SoC ISA CPU RAM Storage
Raspberry Pi Foundation Raspberry Pi 3 Broadcom BCM2837 AArch64 / ARMv7 4× Cortex-A53 @ 1.2 - 1.4 GHz 1 GB SD/microSD
Raspberry Pi Foundation Raspberry Pi 4 Broadcom BCM2711 AArch64 / ARMv7 4× Cortex-A72 @ 1.5 - 1.8 GHz 1-8 GB microSD, eMMC

Community supported devices

These boards are not routinely verified as working.

The baseline support level expected is “Just as much as mainline Linux and U-Boot supports them”, except if specified otherwise.

Manufacturer Board SoC ISA CPU RAM Storage
Apple Apple Silicon Macs M1/M1 Pro/M1 Max AArch64 NVMe
ASUS Tinker Board Rockchip RK3288 ARMv7 4× Cortex-A17 2 GB microSD
Banana Pi Banana Pi Allwinner A20 ARMv7 2× Cortex-A7 1 GB SD, SATA
Banana Pi M64 Banana Pi M64 Allwinner A64 AArch64 4× Cortex-A53 2 GB microSD, 8GB eMMc
Banana Pi BPI-M5 Banana Pi BPI-M5 Amlogic S905X3 AArch64 4× Cortex-A55 4 GB LPDDR4 microSD, 16G eMMC
BeagleBoard.org BeagleBone Black TI AM335x (src) ARMv7 1× Cortex-A8 @ 1 GHz 512 MB 4 GB eMMC, microSD
Firefly AIO-3399C Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 2/4 GB 8/16 GB eMMC, microSD
FriendlyElec NanoPC-T4 Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 4 GB 16 GB eMMC, microSD, NVMe
FriendlyElec NanoPi-M4 Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 4 GB optional eMMC, microSD
FriendlyElec NanoPi-R6C Rockchip RK3588S AArch64 4× ARM Cortex-A76 @ 2.4 GHz, 4× Cortex-A55 @ 1.8 Ghz 4 GB / 8 GB optional eMMC, microSD, NVMe
Hardkernel ODROID-HC1 & ODROID-HC2 Samsung Exynos 5422 ARMv7 4× Cortex-A15 @ 2GHz, 4× Cortex-A7 @ 1.4GHz 2 GB microSD
Hardkernel ODROID-C2 Amlogic S905 AArch64 4× Cortex-A53 @ 1.5GHz 2 GB eMMC, microSD
Hardkernel ODROID-HC4 Amlogic S905X3 AArch64 4× Cortex-A55 @ 1.8GHz 4 GB microSD, SATA
Kosagi Kosagi Novena i.MX6 ARMv7 4× Cortex-A9 @ 1.2 GHz 4 GB microSD, SATA
Libre Computer ROC-RK3399-PC Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 4 GB eMMC, microSD, NVMe
Libre Computer ROC-RK3328-CC Rockchip RK3328 AArch64 4× Cortex-A53 @ 1.4GHz 4 GB eMMC, microSD
Libre Computer AML-S905X-CC-V2 Amlogic S905X AArch64 4× Cortex-A53 @ 1.512 GHz 1/2GB eMMC, microSD
Linksprite pcDuino3 Nano Allwinner A20 ARMv7 2× Cortex-A7 @ 1 GHz 1 GB 4 GB NAND, microSD, SATA
NVIDIA Jetson TK1 Tegra K1/T124 ARMv7 4× Cortex-A15 @ 2.3 GHz 2 GB 16 GB eMMC, SD, SATA
NXP i.MX 8M Plus EVK i.MX 8M Plus AArch64 4× Cortex-A53 @ 1.8 Ghz 6 GB 32 GB eMMC, microSD
NXP i.MX 8M Quad EVK i.MX 8M Quad AArch64 4× Cortex-A53 @ 1.5 Ghz + 1× Cortex-M4 3 GB 16 GB eMMC, microSD
OLIMEX Teres-A64 AllWinner A64 AArch64 4× Cortex-A53 @ 1.1 GHz 2GB 16 GB eMMC, microSD
Orange Pi Orange Pi One Allwinner H3 ARMv7 4× Cortex-A7 @ 1.2 GHz 512 MB microSD
Orange Pi Orange Pi PC Allwinner H3 ARMv7 4× Cortex-A7 @ 1.6 GHz 1 GB SD/microSD
Orange Pi Orange Pi Zero Plus2 (H5) Allwinner H5 AArch64 4× Cortex-A53 @ 1.2 GHz 1 GB SD/microSD + 8GB eMMC
Orange Pi Orange Pi Zero2 (H616) Allwinner H616 AArch64 4× Cortex-A53 @ 1.2 GHz 1 GB SD/microSD + 2MB SPI Flash
Orange Pi Orange Pi R1 Plus LTS Rockchip RK3328 AArch64 4× Cortex-A53 @ 1.5 GHz 1 GB microSD
Orange Pi Orange Pi 5 Rockchip RK3588s AArch64 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz 4/8/16 GB microSD, NVMe
Orange Pi Orange Pi 5 Plus Rockchip RK3588 AArch64 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz 4/8/16 GB eMMC, microSD, NVMe
PINE64 PINE A64-LTS Allwinner R18 AArch64 4× Cortex-A53 @ ? GHz 2 GB microSD & eMMC
PINE64 Pinebook Allwinner A64 AArch64 4× Cortex-A53 @ ? Ghz 2 GB microSD & eMMC
PINE64 Pinebook Pro Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 4 GB microSD & eMMC
PINE64 ROCK64 Rockchip RK3328 AArch64 4× Cortex-A53 @ 1.5 GHz 1/2/4 GB microSD/eMMC
PINE64 ROCKPro64 Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 2/4 GB microSD/eMMC
Clockworkpi uConsole A06 Rockchip RK3399 AArch64 2× Cortex-A72 @ 2.0 GHz, 4× Cortex-A53 @ 1.5 Ghz 4 GB microSD
Radxa ROCK 4 Rockchip RK3399 AArch64 2× Cortex-A72, 4×Cortex-A53 2/4 GB eMMC, microSD, NVMe via expansion board
Radxa ROCK5 Model B Rockchip RK3588 AArch64 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz 4/8/16 GB eMMC, microSD, NVMe
Radxa ROCK5 Model A Rockchip RK3588s AArch64 4× Cortex-A76 @ 2.4GHz, 4×Cortex-A55 @ 1.8 GHz 4/8/16 GB eMMC, microSD, NVMe
Raspberry Pi Foundation Raspberry Pi Broadcom BCM2835 ARMv6 1 × ARM1176 @ 700 MHz 256 MB / 512 MB SD/microSD
Raspberry Pi Foundation Raspberry Pi 2 Broadcom BCM2836 ARMv7 4× Cortex-A7 @ 900 MHz 1 GB SD/microSD
Raspberry Pi Foundation Raspberry Pi 3 Broadcom BCM2837 AArch64 / ARMv7 4× Cortex-A53 @ 1.2 GHz 1 GB SD/microSD
Raspberry Pi Foundation Raspberry Pi 4 Broadcom BCM2711 AArch64 / ARMv7 4× Cortex-A53 @ 1.5 GHz 1-8 GB microSD
Raspberry Pi Foundation Raspberry Pi 5 Broadcom BCM2712 AArch64 4× Cortex-A76 @ 2.4 GHz 4-8 GB microSD
Toshiba AC100 (mini laptop) Tegra 2 250 (T20) ARMv7 2× Cortex-A9 @ 1 GHz 512 MB 8­­–32 GB eMMC, SD
Wandboard Wandboard Solo/Dual/Quad Freescale i.MX6 ARMv7 1×/2×/4× Cortex-A9 @ 1000 MHz 512 MB / 1 GB / 2 GB microSD, SATA

Special Devices

It is possible to emulate an ARM platform with QEMU.

Manufacturer Board SoC ISA CPU RAM Storage
QEMU QEMU ARMv7 up to 8 up to 2 GB Anything QEMU supports

Installation

Initial configuration

Troubleshooting

Hanging at Starting kernel ...

When booting a NixOS system, it may look like it is hung at Starting kernel ....

It is unlikely to be hung at this part. This is the last message printed by U-Boot. U-Boot prints to both the display and the console at once.

To view the kernel messages and boot output, the “stdout” of the kernel needs to be configured appropriately.

The kernel's stdout will differ depending on semantics.

  • When there are no valid console= kernel command-line arguments, it will default to the /chosen/stdout-path device tree property. (Generally a serial console.)
  • When valid console= parameters are present, the kernel picks the leftmost valid one as stdout.

In other words, the solution may be to enable the appropriate console= parameters according to your hardware configuration and system.

  • For the display, add console=tty0.
  • For a serial console, refer to the target device configuration.

Details about the boot process

NixOS can also be booted through UEFI on ARM. The semantics are generally the same as on other architectures. Do note that the common use of Device Tree instead of ACPI in consumer-class hardware may make this a bit more awkward.

Otherwise, in SBC-class hardware, it is common that boards are generally expected to use U-Boot as the platform firmware and bootloader. See the section about using NixOS with U-Boot.

Binary caches

AArch64

The official NixOS Hydra instance builds a full set of binaries (available on https://cache.nixos.org) for the AArch64 architecture on the nixpkgs-unstable and stable channels.

armv6l and armv7l

Some users have provided best effort caches in the past for 32 bit ARM, but none are currently available.

Getting Support

There is a dedicated room for the upstream NixOS effort on Matrix, #nixos-on-arm:nixos.org.

Don't hesitate to ask questions. Note that reply times may vary greatly, depending on the provided information.

Resources

See also

  • U-Boot, as it is often paired with SBC-class hardware.
  • Mobile NixOS, which provides enhanced semantic around some non-standard boot semantics.

Subpages

The following is a list of all sub-pages of the NixOS on ARM topic.