nixos/hardware/device-tree: fix application of overlays
Previously whenever an overlay was found to be incompatible with a base device tree blob, the entire base dtb would be skipped in favor of processing the next one. This had the unfortunate effect where overlays would not fully be applied if any incompatibility was found. For example, this is an issue with build device trees specific for one flavor of raspberry pi if the overlay was not compatible _everywhere_. The solution is to forego the `continue` keyword if an overlay is in compatible and instead use a compound conditional statement to skip incompatible overlays but continue trying to apply it to any remaining dtbs.
This commit is contained in:
parent
2dea0f4c2d
commit
bfd1c45e54
|
@ -22,21 +22,19 @@ with lib; {
|
||||||
|
|
||||||
# skip incompatible and non-matching overlays
|
# skip incompatible and non-matching overlays
|
||||||
if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then
|
if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then
|
||||||
echo -n "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")"
|
echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")"
|
||||||
continue
|
elif ${if (o.filter == null) then "false" else ''
|
||||||
fi
|
[[ "''${dtb//${o.filter}/}" == "$dtb" ]]
|
||||||
${optionalString (o.filter != null) ''
|
|
||||||
if [[ "''${dtb//${o.filter}/}" == "$dtb" ]]; then
|
|
||||||
echo -n "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
''}
|
''}
|
||||||
|
then
|
||||||
echo -n "Applying overlay ${o.name} to $(basename "$dtb")... "
|
echo "Skipping overlay ${o.name}: filter does not match $(basename "$dtb")"
|
||||||
mv "$dtb"{,.in}
|
else
|
||||||
fdtoverlay -o "$dtb" -i "$dtb.in" "${o.dtboFile}"
|
echo -n "Applying overlay ${o.name} to $(basename "$dtb")... "
|
||||||
echo "ok"
|
mv "$dtb"{,.in}
|
||||||
rm "$dtb.in"
|
fdtoverlay -o "$dtb" -i "$dtb.in" "${o.dtboFile}"
|
||||||
|
echo "ok"
|
||||||
|
rm "$dtb.in"
|
||||||
|
fi
|
||||||
'')}
|
'')}
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue