NixOS on ARM/Radxa ROCK 4: Difference between revisions
Added rough directions for building and using u-boot from nixpkgs. I have tested this (building u-boot 2024.10, and using it to boot NixOS through both UEFI and extlinux) on a Rock 4B+ v1.73 with onboard eMMC. |
m →Bootloader Firmware: The WYSIWYG editor mangled things very badly. Just adding line breaks :) |
||
Line 52: | Line 52: | ||
* `nixos-rockchip` uses the mainline U-Boot repository. | * `nixos-rockchip` uses the mainline U-Boot repository. | ||
* As an alternative for using nixos-rockchip, There is also support for ROCK 4 U-Boot in Nixpkgs. This build of u-boot is built using the defconfig from u-boot's repositories, so it should be equivalent to 'stock' u-boot, but be aware there may be unknown differences, as it has not been thoroughly tested. The following command will build the u-boot bootloader with Nix on a non-aarch64 system, and output its path as a 'result' symlink in the current directory: | * As an alternative for using nixos-rockchip, There is also support for ROCK 4 U-Boot in Nixpkgs. | ||
This build of u-boot is built using the defconfig from u-boot's repositories, so it should be equivalent to 'stock' u-boot, but be aware there may be unknown differences, as it has not been thoroughly tested. The following command will build the u-boot bootloader with Nix on a non-aarch64 system, and output its path as a 'result' symlink in the current directory: | |||
<code>nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootRockPi4</code> | |||
This will build u-boot as two separate files, <code>idbloader.img</code> and <code>u-boot.itb</code>. To flash the bootloader, follow the directions provided in u-boot's repos for [https://github.com/u-boot/u-boot/blob/af69289d61876d8e62449ee2da2dc6683bcb8198/doc/README.rockchip#L486 how to transfer these files to storage (SD card or EMMC) for usage]. | |||
<code>sudo dd if=idbloader.img of=/dev/sdc seek=64; sudo dd if=u-boot.itb of=/dev/sdc seek=16384</code> | |||
After this, take special care to leave the first ~16mb of the target disk unpartitioned during installation, as this will contain u-boot and overwriting this region will overwrite the bootloader. | |||
The stock UEFI ISO boots fine for installation purposes. If you wish to flash directly to SD/EMMC, the extlinux 'sdimage' may require a minor u-boot env change (<code>env set ramdisk_addr_r 0x06800000</code>, <code>env save</code>) in order to boot, but should work after this change has been made. | |||
(TODO: SPI flash installation directions, for boards where this is present. This requires changes in Nixpkgs, so that the build command presented here will output the file "u-boot-rockchip-spi.bin".) | |||
== System configuration == | == System configuration == |
Revision as of 01:03, 8 December 2024
Radxa ROCK 4 | |
---|---|
Manufacturer | Radxa |
Architecture | AArch64 |
Bootloader | U-Boot |
Boot order | SPI NOR Flash, eMMC, SD |
Maintainer | msgilligan |
The Radxa ROCK 4B+ is a Single-Board Computer with a Rockchip RK3399 SoC.
- CPU: ARM Cortex-A72 and Cortex-A53
- GPU: Mali-T860 MP4
- RAM: 2GB/4GB LPDDR4
- MMC: eMMC Connector for up to 128GB
- NET: 1 Gigabit Ethernet
- USB: 1x USB3 OTG/HOST Type-A, 1x USB 3 Type-A, 2x USB 2 Type-A
- PCIe: M.2 M Key M connector (4-lane PCIe 2.1) supports NVMe SSD
The nixos-rockchip SD-card images have been tested with both the ROCK 4B+ and ROCK 4 SE variants.
Status
Support of this system is YMMV (your mileage may vary).
U-Boot bootloaders are available in different variants:
- U-Boot
The official hardware documentation can be found on the Radxa wiki.
Bootloader Firmware
U-Boot Firmware
- `nixos-rockchip` uses the mainline U-Boot repository.
- As an alternative for using nixos-rockchip, There is also support for ROCK 4 U-Boot in Nixpkgs.
This build of u-boot is built using the defconfig from u-boot's repositories, so it should be equivalent to 'stock' u-boot, but be aware there may be unknown differences, as it has not been thoroughly tested. The following command will build the u-boot bootloader with Nix on a non-aarch64 system, and output its path as a 'result' symlink in the current directory:
nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootRockPi4
This will build u-boot as two separate files, idbloader.img
and u-boot.itb
. To flash the bootloader, follow the directions provided in u-boot's repos for how to transfer these files to storage (SD card or EMMC) for usage.
sudo dd if=idbloader.img of=/dev/sdc seek=64; sudo dd if=u-boot.itb of=/dev/sdc seek=16384
After this, take special care to leave the first ~16mb of the target disk unpartitioned during installation, as this will contain u-boot and overwriting this region will overwrite the bootloader.
The stock UEFI ISO boots fine for installation purposes. If you wish to flash directly to SD/EMMC, the extlinux 'sdimage' may require a minor u-boot env change (env set ramdisk_addr_r 0x06800000
, env save
) in order to boot, but should work after this change has been made.
(TODO: SPI flash installation directions, for boards where this is present. This requires changes in Nixpkgs, so that the build command presented here will output the file "u-boot-rockchip-spi.bin".)
System configuration
Use the instructions in the README.
Use the following command to build the Rock 4B image:
nix build .#RadxaRock4
or for the Rock 4SE:
nix build .#RadxaRock4SE
nabam/nixos-rockchip GitHub Project
nabam/nixos-rockchip is a Nix flake for building several Rockchip SBC images, including Rock 4B and Rock 4SE.