build dtb (forgot to commit this file?)
This commit is contained in:
parent
1bd35a1edd
commit
af79e1e9e9
1 changed files with 24 additions and 0 deletions
24
kernel/dtb.nix
Normal file
24
kernel/dtb.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
stdenv
|
||||
, openwrt
|
||||
, dtc
|
||||
, kernel
|
||||
}:
|
||||
{ dts
|
||||
}:let
|
||||
includes = [
|
||||
"${openwrt}/target/linux/ath79/dts"
|
||||
"${kernel}/include"
|
||||
];
|
||||
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 = ''
|
||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${openwrt}/target/linux/ath79/dts/${dts}
|
||||
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
||||
test -e $out
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue