add hardware.dts.includes option
This commit is contained in:
parent
44caefcd3b
commit
b52133a28b
11
NEWS
11
NEWS
@ -134,6 +134,11 @@ and then run the generated `install.sh` script
|
||||
|
||||
2024-12-16
|
||||
|
||||
config option rename: config.hardware.dts.includes is now
|
||||
hardware.dts.includePaths, which is a better name and also
|
||||
means I can use hardware.dts.includes for a different purpose
|
||||
Config options changed: if you had set config.hardware.dts.includes
|
||||
(maybe in an out-of-tree device port) to specify the search paths
|
||||
in which dtc finds include files, you will need to change this to
|
||||
hardware.dts.includePaths.
|
||||
|
||||
The "new" hardware.dts.includes option is now for dtsi files which
|
||||
should be merged into the device tree.
|
||||
|
||||
|
@ -29,6 +29,11 @@ in
|
||||
description = "List of directories to search for DTS includes (.dtsi files)";
|
||||
type = types.listOf types.path;
|
||||
};
|
||||
includes = mkOption {
|
||||
default = [ ];
|
||||
description = "\"dtsi\" fragments to include in the generated device tree";
|
||||
type = types.listOf types.path;
|
||||
};
|
||||
};
|
||||
defaultOutput = mkOption {
|
||||
description = "\"Default\" output: what gets built for this device when outputs.default is requested. Typically this is \"mtdimage\" or \"vmroot\"";
|
||||
|
@ -104,7 +104,7 @@ in
|
||||
system.outputs = rec {
|
||||
dtb = liminix.builders.dtb {
|
||||
inherit (config.boot) commandLine;
|
||||
dts = config.hardware.dts.src;
|
||||
dts = config.hardware.dts.includes ++ [config.hardware.dts.src];
|
||||
includes = config.hardware.dts.includePaths ++ [
|
||||
"${o.kernel.headers}/include"
|
||||
];
|
||||
|
@ -2,6 +2,8 @@
|
||||
stdenv
|
||||
, dtc
|
||||
, lib
|
||||
, runCommand
|
||||
, writeText
|
||||
}:
|
||||
{ dts
|
||||
, includes
|
||||
@ -10,14 +12,20 @@
|
||||
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
||||
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
||||
cmdline = lib.concatStringsSep " " commandLine;
|
||||
chosen = writeText "chosen.dtsi" "/{ chosen { bootargs = ${builtins.toJSON cmdline}; }; };";
|
||||
combined = writeText "combined-dts-fragments"
|
||||
(lib.concatStrings
|
||||
(builtins.map
|
||||
(f: "#include \"${f}\"\n")
|
||||
(dts ++ [ chosen ])));
|
||||
in stdenv.mkDerivation {
|
||||
name = "dtb";
|
||||
phases = [ "buildPhase" ];
|
||||
nativeBuildInputs = [ dtc ];
|
||||
buildPhase = ''
|
||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${dts}
|
||||
echo '/{ chosen { bootargs = ${builtins.toJSON cmdline}; }; };' >> dtb.tmp
|
||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${combined}
|
||||
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
||||
# dtc -I dtb -O dts $out
|
||||
test -e $out
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user