Merge pull request #178200 from lopsided98/device-tree-preprocessor

nixos/device-tree: preprocess overlays before compiling
This commit is contained in:
Florian Klink 2022-06-19 11:13:54 +02:00 committed by GitHub
commit 4386cb104e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,14 +36,11 @@ let
/plugin/;
/ {
compatible = "raspberrypi";
fragment@0 {
target-path = "/soc";
__overlay__ {
pps {
compatible = "pps-gpio";
status = "okay";
};
};
};
&{/soc} {
pps {
compatible = "pps-gpio";
status = "okay";
};
};
'';
@ -88,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
'';
}) {};