NixOS on ARM/Radxa ROCK 4: Difference between revisions
Msgilligan (talk | contribs) Further improve @nabam's nixos-rockchip section |
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. |
||
Line 43: | Line 43: | ||
* U-Boot | * U-Boot | ||
** [https://github.com/u-boot/u-boot/ Mainline] - Supports ?? boot options | ** [https://github.com/u-boot/u-boot/ Mainline] - Supports ?? boot options | ||
** [https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/uboot/default.nix Nixpkgs] - | ** [https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/uboot/default.nix Nixpkgs] - tested by @ryjelsum, seemingly working but not thoroughly used | ||
The official hardware documentation can be found [https://docs.radxa.com/en/rock4 on the Radxa wiki]. | The official hardware documentation can be found [https://docs.radxa.com/en/rock4 on the Radxa wiki]. | ||
Line 52: | Line 52: | ||
* `nixos-rockchip` uses the mainline U-Boot repository. | * `nixos-rockchip` uses the mainline U-Boot repository. | ||
* There is also support for ROCK 4 U-Boot in Nixpkgs, but | * 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 == |