2024-01-01 04:50:15 +01:00
|
|
|
{ callPackage
|
|
|
|
, writeShellApplication
|
|
|
|
, stdenv
|
|
|
|
, mtdutils
|
|
|
|
}:
|
2023-04-16 22:43:32 +02:00
|
|
|
|
2024-01-01 04:50:15 +01:00
|
|
|
rec {
|
|
|
|
opensbi = callPackage ./opensbi.nix { };
|
|
|
|
uboot = callPackage ./uboot.nix { inherit opensbi; };
|
2023-06-08 20:24:13 +02:00
|
|
|
updater-flash = writeShellApplication {
|
|
|
|
name = "visionfive2-firmware-update-flash";
|
|
|
|
runtimeInputs = [ mtdutils ];
|
|
|
|
text = ''
|
2024-01-01 04:50:15 +01:00
|
|
|
flashcp -v ${uboot}/u-boot-spl.bin.normal.out /dev/mtd0
|
2024-01-01 19:15:08 +01:00
|
|
|
flashcp -v ${uboot}/u-boot.itb /dev/mtd2
|
2023-06-08 20:24:13 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
updater-sd = writeShellApplication {
|
|
|
|
name = "visionfive2-firmware-update-sd";
|
|
|
|
runtimeInputs = [ ];
|
|
|
|
text = ''
|
2024-01-01 04:50:15 +01:00
|
|
|
dd if=${uboot}/u-boot-spl.bin.normal.out of=/dev/mmcblk0p1 conv=fsync
|
|
|
|
dd if=${uboot}/u-boot.itb of=/dev/mmcblk0p2 conv=fsync
|
2023-06-08 20:24:13 +02:00
|
|
|
'';
|
|
|
|
};
|
2023-04-16 22:43:32 +02:00
|
|
|
}
|