Backs up old sd card on copy.

This commit is contained in:
Bailey Stevens 2023-04-04 15:40:16 -04:00
parent 64a572d846
commit 426fe7353a

View file

@ -24,19 +24,20 @@
uncompressed = import ./sd-card.nix { inherit pkgs crossPkgs; compress = false; }; uncompressed = import ./sd-card.nix { inherit pkgs crossPkgs; compress = false; };
vmscript = pkgs.writeScriptBin "vmscript" '' vmscript = pkgs.writeScriptBin "vmscript" ''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell} -e
img=./sd-card.img img=./sd-card.img
cp ${self.outputs.packages.${system}.uncompressed}/sd-card.img $img cp -b ${self.outputs.packages.${system}.uncompressed}/sd-card.img $img
chmod 640 $img chmod 640 $img
${pkgs.qemu}/bin/qemu-system-aarch64 \ ${pkgs.qemu}/bin/qemu-system-aarch64 \
-machine raspi3b \ -machine raspi3b \
-kernel "${crossPkgs.ubootRaspberryPi3_64bit}/u-boot.bin" \ -kernel "${crossPkgs.ubootRaspberryPi3_64bit}/u-boot.bin" \
-cpu max \ -cpu max \
-m 1G \ -m 1G \
-smp 4 \ -smp 4 \
-drive file="$img",format=raw \ -drive file="$img",format=raw \
-serial null \ -nographic \
-serial mon:stdio -serial null \
-serial mon:stdio
''; '';
}; };