forked from NixOS/nixos-hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirmware.nix
46 lines (39 loc) · 1.07 KB
/
firmware.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ 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
'';
}