add device-tree builder

This commit is contained in:
Florian Agbuya 2024-01-29 15:28:17 +08:00
parent eb10e3ad4e
commit e6f4512554

View File

@ -189,6 +189,27 @@
dontFixup = true; dontFixup = true;
}; };
device-tree = { board ? "zc706" }: let
dts = ./fast-servo/device-tree;
in pkgs.runCommand "device-tree"
{
buildInputs = [ pkgs.gcc pkgs.dtc ];
}
''
mkdir -p $out
if [ "${board}" = "fast-servo" ]; then
gcc -I ${dts} -E -nostdinc -undef -D__DTS__ -x assembler-with-cpp -o fast-servo.dts ${dts}/system-top.dts
dtc -I dts -O dtb -o fast-servo.dtb fast-servo.dts
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
else
echo "Unsupported board type: ${board}"
exit 1
fi
'';
u-boot = { board ? "zc706" }: pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot { u-boot = { board ? "zc706" }: pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
defconfig = "xilinx_zynq_virt_defconfig"; defconfig = "xilinx_zynq_virt_defconfig";
patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch; patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch;
@ -349,10 +370,12 @@
packages.armv7l-linux = { packages.armv7l-linux = {
zc706-fsbl = fsbl { board = "zc706"; }; zc706-fsbl = fsbl { board = "zc706"; };
zc706-bootimage = bootimage { board = "zc706"; }; zc706-bootimage = bootimage { board = "zc706"; };
zc706-dtb = device-tree { board = "zc706"; };
zc706-u-boot = u-boot { board = "zc706"; }; zc706-u-boot = u-boot { board = "zc706"; };
zc706-qemu = not-os-qemu { board = "zc706"; }; zc706-qemu = not-os-qemu { board = "zc706"; };
zc706-sd-image = sd-image { board = "zc706"; }; zc706-sd-image = sd-image { board = "zc706"; };
zc706-not-os = not-os-cfg.build.zynq_image; zc706-not-os = not-os-cfg.build.zynq_image;
fast-servo-dtb = device-tree { board = "fast-servo"; };
fast-servo-u-boot = u-boot { board = "fast-servo"; }; fast-servo-u-boot = u-boot { board = "fast-servo"; };
}; };
hydraJobs = packages.x86_64-linux // packages.armv7l-linux; hydraJobs = packages.x86_64-linux // packages.armv7l-linux;