2019-05-08 23:25:22 +01:00
|
|
|
{ stdenvNoCC, dtc, findutils }:
|
2019-04-24 18:24:16 +01:00
|
|
|
|
|
|
|
with stdenvNoCC.lib; {
|
|
|
|
applyOverlays = (base: overlays: stdenvNoCC.mkDerivation {
|
|
|
|
name = "device-tree-overlays";
|
|
|
|
nativeBuildInputs = [ dtc findutils ];
|
|
|
|
buildCommand = let
|
|
|
|
quotedDtbos = concatMapStringsSep " " (o: "\"${toString o}\"") (toList overlays);
|
|
|
|
in ''
|
|
|
|
for dtb in $(find ${base} -name "*.dtb" ); do
|
|
|
|
outDtb=$out/$(realpath --relative-to "${base}" "$dtb")
|
|
|
|
mkdir -p "$(dirname "$outDtb")"
|
|
|
|
fdtoverlay -o "$outDtb" -i "$dtb" ${quotedDtbos};
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
}
|