diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-11-21 16:12:21 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-11-21 16:12:48 +0100 |
commit | 048a4cd441a59cbf89defb18bb45c9f0b4429b35 (patch) | |
tree | f8f5850ff05521ab82d65745894714a8796cbfb6 /pkgs/os-specific/linux/device-tree/default.nix | |
parent | 030c5028b07afcedce7c5956015c629486cc79d9 (diff) | |
parent | 4c2d05dd6435d449a3651a6dd314d9411b5f8146 (diff) | |
download | nixpkgs-rootfs.tar nixpkgs-rootfs.tar.gz nixpkgs-rootfs.tar.bz2 nixpkgs-rootfs.tar.lz nixpkgs-rootfs.tar.xz nixpkgs-rootfs.tar.zst nixpkgs-rootfs.zip |
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'pkgs/os-specific/linux/device-tree/default.nix')
-rw-r--r-- | pkgs/os-specific/linux/device-tree/default.nix | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/device-tree/default.nix b/pkgs/os-specific/linux/device-tree/default.nix index fb8e92f2330..1a50d799b4b 100644 --- a/pkgs/os-specific/linux/device-tree/default.nix +++ b/pkgs/os-specific/linux/device-tree/default.nix @@ -1,6 +1,29 @@ -{ lib, stdenvNoCC, dtc }: +{ lib, stdenv, stdenvNoCC, dtc }: with lib; { + # Compile single Device Tree overlay source + # file (.dts) into its compiled variant (.dtb) + compileDTS = ({ + name, + dtsFile, + includePaths ? [], + extraPreprocessorFlags ? [] + }: stdenv.mkDerivation { + inherit name; + + nativeBuildInputs = [ dtc ]; + + buildCommand = + let + includeFlagsStr = lib.concatMapStringsSep " " (includePath: "-I${includePath}") includePaths; + extraPreprocessorFlagsStr = lib.concatStringsSep " " extraPreprocessorFlags; + in + '' + $CC -E -nostdinc ${includeFlagsStr} -undef -D__DTS__ -x assembler-with-cpp ${extraPreprocessorFlagsStr} ${dtsFile} | \ + dtc -I dts -O dtb -@ -o $out + ''; + }); + applyOverlays = (base: overlays': stdenvNoCC.mkDerivation { name = "device-tree-overlays"; nativeBuildInputs = [ dtc ]; |