-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix compileDTS overlay for raspberry-pi #754
Conversation
due to NixOS/nixpkgs#251898 the compileDTS function has been moved to `device-tree` nixos-hardware has an own overlay for the raspberry-pi which needs the `compileDTS` function now, too. This commit adds it. Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that any overlay is needed for device-tree
? A few fixes have been merged in nixpkgs since this fork was created.
For reference, this is the cleaned-up diff between the nixpkgs and nixos-hardware versions:
--- a/pkgs/os-specific/linux/device-tree/default.nix
+++ b/pkgs/os-specific/linux/device-tree/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, stdenvNoCC, dtc }:
+{ lib, stdenv, stdenvNoCC, dtc, libraspberrypi }:
with lib; {
# Compile single Device Tree overlay source
@@ -26,7 +26,7 @@ with lib; {
applyOverlays = (base: overlays': stdenvNoCC.mkDerivation {
name = "device-tree-overlays";
- nativeBuildInputs = [ dtc ];
+ nativeBuildInputs = [ dtc libraspberrypi ];
buildCommand = let
overlays = toList overlays';
in ''
@@ -46,7 +46,7 @@ with lib; {
# skip incompatible and non-matching overlays
if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then
echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")"
- elif ${if (o.filter == null) then "false" else ''
+ elif ${if ((o.filter or null) == null) then "false" else ''
[[ "''${dtb//${o.filter}/}" == "$dtb" ]]
''}
then
@@ -54,9 +54,15 @@ with lib; {
else
echo -n "Applying overlay ${o.name} to $(basename "$dtb")... "
mv "$dtb"{,.in}
- fdtoverlay -o "$dtb" -i "$dtb.in" "${o.dtboFile}"
+
+ # dtmerge requires a .dtbo ext for dtbo files, otherwise it adds it to the given file implicitly
+ dtboWithExt="$TMPDIR/$(basename "${o.dtboFile}").dtbo"
+ cp -r ${o.dtboFile} "$dtboWithExt"
+
+ dtmerge "$dtb.in" "$dtb" "$dtboWithExt"
+
echo "ok"
- rm "$dtb.in"
+ rm "$dtb.in" "$dtboWithExt"
fi
'')}
9ef2707
to
c4da481
Compare
@Majiir awesome, thanks, I simplified the fix.
This is a good question. There are subtle differences in there. But this is maybe a matter for another PR. This (now small) change at least allows building the config again with the current |
Co-authored-by: Majiir Paktu <majiir@nabaal.net> Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
714aa30
to
f295dff
Compare
@gador @Majiir the main function of that overlay (in the nix sense) is to use I don't remember the specifics about what exactly is not supported by I won't have time for this myself in the coming weeks, but it could be tested by removing the package overlay, turning on the poe-hat overlay and seeing if it builds. |
Let me know when this is good to be merged. |
@carlossless thanks for the feedback! I guess one can have a look at removing the custom I just tested this PR in my config on my raspberry pi 4 with POE+ hat. Works just fine |
Due to the recent change in NixOS/nixpkgs#251898
the evaluation of my raspberry-pi-4 config is now broken with the following error:
The full stack trace is:
Description of changes
due to NixOS/nixpkgs#251898 the compileDTS function has been moved to
device-tree
nixos-hardware has an own overlay for the raspberry-pi which needs the
compileDTS
function now, too.This commit adds it.
Things done
nixos-hardware
andimporting it via
<nixos-hardware>
or Flake inputPlease note: This has not yet been tested IRL on my raspberry-pi. But the evaluation and compilation of my NixOS config now doesn't throw an error.
If anyone is willing to test it, please do so and report back.