NixOS on ARM/ODROID-HC4: Difference between revisions
imported>Erdnaxe m remove space |
imported>Erdnaxe Link to nixos-hardware |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
|- | |- | ||
!Architecture | !Architecture | ||
| | |AArch64 | ||
|- | |- | ||
!Bootloader | !Bootloader | ||
Line 14: | Line 14: | ||
|- | |- | ||
!Boot options | !Boot options | ||
| | |microSD (SATA?) | ||
|} | |} | ||
</div> | </div> | ||
Line 26: | Line 26: | ||
== Board-specific installation notes == | == Board-specific installation notes == | ||
# First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the | === Petitboot removal === | ||
Petitboot is installed on the SPI memory of the Odroid HC4 from factory. To be able to load an upstreamed version of U-Boot without having to press a hardware button at each boot, you may remove it. | |||
'''Please proceed with caution, this will make Hardkernel images unbootable!''' | |||
From the Petitboot, go for “Exit to shell” and enter these commands to remove Petitboot: | |||
<syntaxhighlight lang="bash"> | |||
flash_eraseall /dev/mtd0 | |||
flash_eraseall /dev/mtd1 | |||
flash_eraseall /dev/mtd2 | |||
flash_eraseall /dev/mtd3 | |||
</syntaxhighlight> | |||
This will make your SPI flash memory empty and the device will now start from SD on next boot. | |||
See [https://forum.odroid.com/viewtopic.php?f=207&t=40906 this Odroid forum topic] to restore Petitboot. | |||
=== NixOS installation === | |||
# First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the latest stable installer image. | |||
# Uncompress the .zst file. One may use the <code>unzstd</code> command (equivalent to <code>zstd -d</code>) on supported machines. The zstd commands can be accessed from the <code>zstd</code> package. | # Uncompress the .zst file. One may use the <code>unzstd</code> command (equivalent to <code>zstd -d</code>) on supported machines. The zstd commands can be accessed from the <code>zstd</code> package. | ||
# Patch this image (.img file) with U-Boot for Odroid HC4. <syntaxhighlight lang="bash"> | # Patch this image (.img file) with U-Boot for Odroid HC4. <syntaxhighlight lang="bash"> | ||
# Clone content of | # Clone content of samueldr's wip/odroidc4 branch, edit the defconfig file, and build | ||
git clone https://github.com/ | git clone https://github.com/samueldr/nixpkgs --depth 1 -b wip/odroidc4 && cd nixpkgs | ||
test "$(uname)" '==' 'Darwin' && sed -i '' 's/defconfig = "odroid-c4_defconfig"/defconfig = "odroid-hc4_defconfig"/' pkgs/misc/uboot/default.nix || sed -i 's/defconfig = "odroid-c4_defconfig"/defconfig = "odroid-hc4_defconfig"/' pkgs/misc/uboot/default.nix | |||
nix-build -I "nixpkgs=$PWD" -A pkgsCross.aarch64-multiplatform.ubootOdroidC4 | nix-build -I "nixpkgs=$PWD" -A pkgsCross.aarch64-multiplatform.ubootOdroidC4 | ||
sudo dd if=result/u-boot.bin of=PATH/TO/nixos-sd-image-21.05.XXXX.XXXXXXXX-aarch64-linux.img conv=fsync,notrunc bs=512 seek=1 | sudo dd if=result/u-boot.bin of=PATH/TO/nixos-sd-image-21.05.XXXX.XXXXXXXX-aarch64-linux.img conv=fsync,notrunc bs=512 seek=1 | ||
Line 36: | Line 56: | ||
# Flash the modified SD image file (.img) to a microSD card. '''This will erase all the data on the card!''' | # Flash the modified SD image file (.img) to a microSD card. '''This will erase all the data on the card!''' | ||
== Known | == Known issues == | ||
=== Fan doesn't work by default === | |||
You need to use software fan control (via <code>fancontrol</code>) for this. | |||
You may refer to [[https://github.com/NixOS/nixos-hardware/blob/master/hardkernel/odroid-hc4/default.nix nixos-hardware Odroid HC4 module]] for <code>fancontrol</code> configuration. | |||
== No HDMI audio by default == | |||
After enabling ALSA you should see a sound card named "ODROID-HC4". Audio is not correctly routed by default so you might need to open alsa-mixer and change: | |||
* <code>FRDDR_A SINK 1 SEL</code> to <code>OUT 1</code> | |||
* <code>FRDDR_A SRC 1 EN</code> to on | |||
* <code>TDMOUT_B SRC SEL</code> to <code>IN 0</code> | |||
* <code>TOHDMITX</code> to on | |||
* <code>TOHDMITX I2S SRC</code> to <code>I2S B</code> | |||
After these changes, <code>speaker-test -c 2</code> should output white noise. | |||
== Resources == | == Resources == | ||
Line 42: | Line 77: | ||
* [https://www.hardkernel.com/shop/odroid-hc4/ Official product page] | * [https://www.hardkernel.com/shop/odroid-hc4/ Official product page] | ||
* [https://github.com/considerate/nixos-odroidhc4/ NixOS configuration for the ODROID HC4 microcomputer by considerate] | * [https://github.com/considerate/nixos-odroidhc4/ NixOS configuration for the ODROID HC4 microcomputer by considerate] | ||
* [https://www.armbian.com/odroid-hc4/ Armbian Odroid HC4] | |||
* [https://u-boot.readthedocs.io/en/latest/board/amlogic/odroid-c4.html U-Boot for Odroid C4 documentation] |
Latest revision as of 10:15, 9 April 2023
Hardkernel ODROID-HC4 | |
---|---|
Manufacturer | Hardkernel |
Architecture | AArch64 |
Bootloader | U-Boot |
Boot options | microSD (SATA?) |
Status
Mostly working, but some manual steps needed to get it running.
U-boot support in NixPkgs is currently in review: NixPkgs Pull Request #101454
Board-specific installation notes
Petitboot removal
Petitboot is installed on the SPI memory of the Odroid HC4 from factory. To be able to load an upstreamed version of U-Boot without having to press a hardware button at each boot, you may remove it. Please proceed with caution, this will make Hardkernel images unbootable!
From the Petitboot, go for “Exit to shell” and enter these commands to remove Petitboot:
flash_eraseall /dev/mtd0
flash_eraseall /dev/mtd1
flash_eraseall /dev/mtd2
flash_eraseall /dev/mtd3
This will make your SPI flash memory empty and the device will now start from SD on next boot.
See this Odroid forum topic to restore Petitboot.
NixOS installation
- First follow the generic installation steps to get the latest stable installer image.
- Uncompress the .zst file. One may use the
unzstd
command (equivalent tozstd -d
) on supported machines. The zstd commands can be accessed from thezstd
package. - Patch this image (.img file) with U-Boot for Odroid HC4.
# Clone content of samueldr's wip/odroidc4 branch, edit the defconfig file, and build git clone https://github.com/samueldr/nixpkgs --depth 1 -b wip/odroidc4 && cd nixpkgs test "$(uname)" '==' 'Darwin' && sed -i '' 's/defconfig = "odroid-c4_defconfig"/defconfig = "odroid-hc4_defconfig"/' pkgs/misc/uboot/default.nix || sed -i 's/defconfig = "odroid-c4_defconfig"/defconfig = "odroid-hc4_defconfig"/' pkgs/misc/uboot/default.nix nix-build -I "nixpkgs=$PWD" -A pkgsCross.aarch64-multiplatform.ubootOdroidC4 sudo dd if=result/u-boot.bin of=PATH/TO/nixos-sd-image-21.05.XXXX.XXXXXXXX-aarch64-linux.img conv=fsync,notrunc bs=512 seek=1
- Flash the modified SD image file (.img) to a microSD card. This will erase all the data on the card!
Known issues
Fan doesn't work by default
You need to use software fan control (via fancontrol
) for this.
You may refer to [nixos-hardware Odroid HC4 module] for fancontrol
configuration.
No HDMI audio by default
After enabling ALSA you should see a sound card named "ODROID-HC4". Audio is not correctly routed by default so you might need to open alsa-mixer and change:
FRDDR_A SINK 1 SEL
toOUT 1
FRDDR_A SRC 1 EN
to onTDMOUT_B SRC SEL
toIN 0
TOHDMITX
to onTOHDMITX I2S SRC
toI2S B
After these changes, speaker-test -c 2
should output white noise.