From 11b58d801ddcbb6d04102edd04d86b3ce77ed3b8 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 1 May 2020 11:23:00 +0800 Subject: [PATCH] default.nix: build SD card contents --- default.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/default.nix b/default.nix index b3a42373..59d7ccbe 100644 --- a/default.nix +++ b/default.nix @@ -8,6 +8,7 @@ let rustPlatform = (import ./rustPlatform.nix { inherit pkgs; }); artiqpkgs = import "${artiq-fast}/default.nix" { inherit pkgs; }; vivado = import "${artiq-fast}/vivado.nix" { inherit pkgs; }; + mkbootimage = (import ./mkbootimage.nix { inherit pkgs; }); in rec { zc706-szl = rustPlatform.buildRustPackage rec { @@ -59,4 +60,29 @@ in ln -s ${zc706-szl}/szl.elf $out ln -s ${zc706-gateware}/top.bit $out ''; + zc706-sd = pkgs.runCommand "zc706-sd" + { + buildInputs = [ mkbootimage ]; + } + '' + bif=`mktemp` + cat > $bif << EOF + the_ROM_image: + { + [bootloader]${zc706-szl}/szl.elf + } + EOF + mkdir $out + mkbootimage $bif $out/boot.bin + ln -s ${zc706-gateware}/top.bit $out + ''; + zc706-sd-zip = pkgs.runCommand "zc706-sd-zip" + { + buildInputs = [ pkgs.zip ]; + } + '' + mkdir -p $out $out/nix-support + zip -j $out/sd.zip ${zc706-sd}/* + echo file binary-dist $out/sd.zip >> $out/nix-support/hydra-build-products + ''; }