2022-10-07 01:19:29 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, dtc
|
|
|
|
}:
|
|
|
|
{ dts
|
2022-10-19 18:34:22 +02:00
|
|
|
, includes
|
2022-10-07 01:19:29 +02:00
|
|
|
}:let
|
|
|
|
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
|
|
|
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "dtb";
|
|
|
|
phases = [ "buildPhase" ];
|
|
|
|
nativeBuildInputs = [ dtc ];
|
|
|
|
buildPhase = ''
|
2022-10-19 18:34:22 +02:00
|
|
|
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${dts}
|
2022-10-07 01:19:29 +02:00
|
|
|
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
|
|
|
test -e $out
|
|
|
|
'';
|
|
|
|
}
|