This repository was archived by the owner on Mar 23, 2025. It is now read-only.

Description
I'm seeking a way to build a Raspberry Pi CM4 image with several customized dts/dtbo, e.g. mcp4728.dts. My first intuition is something like this:
hardware.deviceTree = {
kernelPackage = pkgs.linux_rpi4;
filter = "bcm2711-rpi-cm4.dtb";
overlays = [
{ name = "mcp4728"; dtsFile = ./mcp4728.dts; }
{ name = "spi6-1cs"; dtboFile = "${pkgs.device-tree_rpi.overlays}/spi6-1cs.dtbo"; }
];
};
But then I find boot.loader.generic-extlinux-compatible.useGenerationDeviceTree = false, and I doubt the path I'm taking will be effective.
My another thought is to create a separate Nix package to handle the build/install part:
{ stdenvNoCC, dtc }:
stdenvNoCC.mkDerivation {
pname = "dtoverlays";
version = "0.0.1";
src = ./.;
buildInputs = [ dtc ];
installPhase = ''
install -d $out/boot/firmware/overlays
mv build/*.dtbo $out/boot/firmware/overlays
'';
}
However as far as I concerned, the install path /boot/firmware/overlays is in a different partition from rootfs, and therefore I also doubt that I can include this package in environment.systemPackages
Is there a way to build the dtbo from source and install them into /boot/firmware/overlays?