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

How to Install Custom dts/dtbo? #76

@hftsai256

Description

@hftsai256

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions