1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 11:29:42 +01:00
nixos-hardware/milkv/pioneer/firmware.nix

47 lines
1.1 KiB
Nix
Raw Normal View History

2024-03-31 01:45:46 +01:00
{ stdenv
, writeText
, opensbi
, fip
, zsbl
, linuxboot-kernel
, linuxboot-initrd
, dtbs ? "${linuxboot-kernel}/dtbs"
, ...
}:
let
# Configure a conf.init for linuxboot. If this is not found on the sdcard,
# zsbl will load it from spi flash even when booting from sd. That conf.ini
# might be configured differently and thus not properly boot from sd.
conf-ini = writeText "conf.ini" ''
[sophgo-config]
[devicetree]
name = mango-milkv-pioneer.dtb
[kernel]
name = riscv64_Image
[firmware]
name = fw_dynamic.bin
[ramfs]
name = initrd.img
[eof]
'';
in
stdenv.mkDerivation {
name = "milkv-pioneer-firmware";
buildCommand = ''
install -D ${conf-ini} $out/riscv64/conf.ini
install -D ${fip} $out/fip.bin
install -D ${zsbl} $out/zsbl.bin
install -D ${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin $out/riscv64/
install -D ${linuxboot-initrd}/initrd.img $out/riscv64/
install -D ${dtbs}/sophgo/mango-milkv-pioneer.dtb $out/riscv64/
install -D ${linuxboot-kernel}/Image $out/riscv64/riscv64_Image
'';
}