Jump to content

NixOS on ARM/PINE64 ROCK64: Difference between revisions

Document how to increase space for kernel
imported>Lopsided98
(Update note about ROCK64 v2 memory corruption.)
(Document how to increase space for kernel)
 
(4 intermediate revisions by 2 users not shown)
Line 49: Line 49:
== Board-specific installation notes ==
== Board-specific installation notes ==


U-Boot needs to be copied to specific sectors on the microSD card, eMMC or image with <code>dd</code>.  
U-Boot needs to be copied to specific sectors on the microSD card, eMMC or image with <code>dd</code>.  This can be done either by using a prebuilt image or by manually formatting the storage.


You can use [https://github.com/Mic92/nixos-aarch64-images nixos-aarch64-images] to get an ROCK64 compatible disk image
=== Using Prebuilt Images ===
or running the commands manually.
 
You can use [https://github.com/Mic92/nixos-aarch64-images nixos-aarch64-images] to get an ROCK64 compatible disk image.
 
=== Manually Formatting ===
 
To manually format your storage, first install the NIXOS ARM 64 image by following the instructions here. Download and flash the SD Card/SBC image to your SD Card
 
[[NixOS_on_ARM#SD card images (SBCs and similar platforms)]]
 
Next, download/build U-Boot for the board, and write <code>idbloader.img</code> and <code>u-boot.itb</code> to the storage. As mentioned previously, Hydra builds can be found here:
 
https://hydra.nixos.org/job/nixpkgs/trunk/ubootRock64.aarch64-linux


Download/build U-Boot for the board, and write <code>idbloader.img</code> and <code>u-boot.itb</code>.
Replace in the command below <code>/dev/mmcblkX</code> with the correct device to the sdcard i.e.  <code>/dev/mmcblk0</code>. You can use the <code>lsblk</code> command to get a list of all devices:
Replace in the command below <code>/dev/mmcblkX</code> with the correct device to the sdcard i.e.  <code>/dev/mmcblk0</code>. You can use the <code>lsblk</code> command to get a list of all devices:


Line 64: Line 74:
This will make the first partition of the installation device unmountable and it can be deleted, but the space needs to be kept to not overwrite the bootloader with another filesystem.
This will make the first partition of the installation device unmountable and it can be deleted, but the space needs to be kept to not overwrite the bootloader with another filesystem.


{{note|As an alternative to the above, the <code>u-boot-rockchip.bin</code> file combines both  <code>idbloader.img</code> and <code>u-boot.itb</code> and can be written using the single command below:
<syntaxhighlight lang="bash">
dd if=u-boot-rockchip.bin of=/dev/mmcblkX seek=64
</syntaxhighlight>
}}


{{note|Prior to NixOS 20.03, a downstream version of U-Boot 2017.09 was packaged, which placed U-Boot in a single <code>idbloader.img</code> file. If that version is used, simply disregard the second command above.}}
{{note|Prior to NixOS 20.03, a downstream version of U-Boot 2017.09 was packaged, which placed U-Boot in a single <code>idbloader.img</code> file. If that version is used, simply disregard the second command above.}}
=== uboot Memory Issues  ===
If you are facing memory issues, kernel panics, kernel oops or general system instability while using the uboot images above (especially with the Rock64 version 2), you can use the ubootRock64v2 image instead, which improves system stability by lowering the memory clock speed at the cost of memory bandwidth.
Hydra builds can be found here (note the v2) https://hydra.nixos.org/job/nixpkgs/trunk/ubootRock64v2.aarch64-linux
Simply follow the manual formatting instructions as above.


== Serial console==
== Serial console==
Line 129: Line 154:
This provides sound over HDMI, which the default kernel does not.
This provides sound over HDMI, which the default kernel does not.


{{note|The old vendor U-Boot 2017.09 did not leave enough room between the kernel and initrd, causing recent kernels to overwrite the beginning of the initrd. This can be fixed by increasing <code>ramdisk_addr_r</code> in the U-Boot console, or using upstream U-Boot. }}
=== Initrd fails to unpack during boot ===
 
The old vendor U-Boot 2017.09 did not leave enough room between the kernel and initrd, causing recent kernels to overwrite the beginning of the initrd. This can be fixed by increasing <code>ramdisk_addr_r</code> in the U-Boot console, or using upstream U-Boot.
 
Here is how to achieve in the uboot console (hit enter during boot to access it):
 
<syntaxHighlight>
=> print ramdisk_addr_r # this prints the old value
ramdisk_addr_r=0x06000000
=> set ramdisk_addr_r 0x07000000 # this sets a new value
=> saveenv # this persist the the configuration
=> boot # than you can normally boot, if it still fails, you can try to increase the ramdisk_addr_r value further
</syntaxHighlight>


== Video decoding ==
== Video decoding ==