add fast-servo bootimage, sd-image and cleanup

This commit is contained in:
Florian Agbuya 2024-01-29 18:06:26 +08:00
parent ae31216084
commit 69a252e488
1 changed files with 25 additions and 23 deletions

View File

@ -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;
};