diff options
author | Ben Wolsieffer <benwolsieffer@gmail.com> | 2022-06-17 21:44:01 -0400 |
---|---|---|
committer | Ben Wolsieffer <benwolsieffer@gmail.com> | 2022-06-18 22:24:30 -0400 |
commit | 754005bf485d31384e1905a9af1ad2293a64be20 (patch) | |
tree | 39ae6e2d7080f80a2453055f6029ab03b11bee13 /nixos/modules/hardware | |
parent | 8e4b3323d1a6ae7911ae29bd319cd75f1d41b8aa (diff) |
nixos/device-tree: preprocess overlays before compiling
Run the device tree overlays through the preprocessor before compiling it, as is done in the kernel. This helps make overlays easier to understand, and improves compatibility with those found in the wild. I found the correct command line by running the kernel build with V=1, and then removing all the arguments related to dependency tracking.
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r-- | nixos/modules/hardware/device-tree.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 682b4bc0d7576..5a8a8e27bee1b 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -85,13 +85,14 @@ let # Compile single Device Tree overlay source # file (.dts) into its compiled variant (.dtbo) - compileDTS = name: f: pkgs.callPackage({ dtc }: pkgs.stdenv.mkDerivation { + compileDTS = name: f: pkgs.callPackage({ stdenv, dtc }: stdenv.mkDerivation { name = "${name}-dtbo"; nativeBuildInputs = [ dtc ]; buildCommand = '' - dtc -I dts ${f} -O dtb -@ -o $out + $CC -E -nostdinc -I${getDev cfg.kernelPackage}/lib/modules/${cfg.kernelPackage.modDirVersion}/source/scripts/dtc/include-prefixes -undef -D__DTS__ -x assembler-with-cpp ${f} | \ + dtc -I dts -O dtb -@ -o $out ''; }) {}; |