From 69a252e48863695c799ecd8b5fd80757548fd01c Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Mon, 29 Jan 2024 18:06:26 +0800 Subject: [PATCH] add fast-servo bootimage, sd-image and cleanup --- flake.nix | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index d529a5c..346373b 100644 --- a/flake.nix +++ b/flake.nix @@ -194,6 +194,27 @@ dontFixup = true; }; + bootimage = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage" + { + buildInputs = [ mkbootimage ]; + } + '' + bifdir=`mktemp -d` + cd $bifdir + ln -s ${fsbl { inherit board; }}/fsbl.elf fsbl.elf + ln -s ${u-boot { inherit board; }}/u-boot.elf u-boot.elf + cat > boot.bif << EOF + the_ROM_image: + { + [bootloader]fsbl.elf + u-boot.elf + } + EOF + mkdir $out $out/nix-support + mkbootimage boot.bif $out/boot.bin + echo file binary-dist $out/boot.bin >> $out/nix-support/hydra-build-products + ''; + device-tree = { board ? "zc706" }: let dts = ./fast-servo/device-tree; in pkgs.runCommand "device-tree" @@ -208,7 +229,7 @@ chmod +x fast-servo.dtb cp fast-servo.dtb $out elif [ "${board}" = "zc706" ]; then - cp ${not-os-cfg.build.kernel}/dtbs/zynq-zc706.dtb $out + cp ${not-os-cfg.build.kernel}/dtbs/zynq-zc706.dtb $out/zc706.dtb else echo "Unsupported board type: ${board}" exit 1 @@ -237,27 +258,6 @@ filesToInstall = [ "u-boot.elf" ]; }; - bootimage = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage" - { - buildInputs = [ mkbootimage ]; - } - '' - bifdir=`mktemp -d` - cd $bifdir - ln -s ${fsbl { inherit board; }}/fsbl.elf fsbl.elf - ln -s ${u-boot { inherit board; }}/u-boot.elf u-boot.elf - cat > boot.bif << EOF - the_ROM_image: - { - [bootloader]fsbl.elf - u-boot.elf - } - EOF - mkdir $out $out/nix-support - mkbootimage boot.bif $out/boot.bin - echo file binary-dist $out/boot.bin >> $out/nix-support/hydra-build-products - ''; - # Pinned qemu version due to networking errors in recent version 8.2.0 qemu = pkgs.qemu.overrideAttrs (oldAttrs: rec { version = "8.1.3"; @@ -360,9 +360,9 @@ mkdir firmware cp ${bootimage { inherit board; }}/boot.bin firmware/ + cp ${device-tree { inherit board; }}/${board}.dtb firmware/devicetree.dtb cp ${not-os-cfg.build.kernel}/uImage firmware/ cp ${not-os-cfg.build.uRamdisk}/initrd firmware/uRamdisk.image.gz - cp ${not-os-cfg.build.kernel}/dtbs/zynq-zc706.dtb firmware/devicetree.dtb (cd firmware; mcopy -psvm -i ../firmware_part.img ./* ::) dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS @@ -381,8 +381,10 @@ zc706-sd-image = sd-image { board = "zc706"; }; zc706-not-os = not-os-cfg.build.zynq_image; fast-servo-fsbl = fsbl { board = "fast-servo"; }; + fast-servo-bootimage = bootimage { board = "fast-servo"; }; fast-servo-dtb = device-tree { board = "fast-servo"; }; fast-servo-u-boot = u-boot { board = "fast-servo"; }; + fast-servo-sd-image = sd-image { board = "fast-servo"; }; }; hydraJobs = packages.x86_64-linux // packages.armv7l-linux; };