-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
nixos/uboot-builder: allow setting specific dtb #169297
Conversation
07bf762
to
84157d7
Compare
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.
Device-tree specifications and blobs are known to break on updates so being able to use your own (hopefully known-to-work) file is definitely useful.
|
||
builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; }; | ||
builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; }; | ||
|
||
builder = | ||
if cfg.uboot.enable then | ||
"${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr} -c" | ||
"${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr}" | ||
+ lib.optionalString (dtCfg.name != null) " -n ${dtCfg.name}" |
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.
dtCfg.name
is now an arbitrary user-provided string, so best use lib.strings.escapeShellArg
.
Better yet, always sanitze:
builder = escapeShellArgs (
if cfg.uboot.enable then [
builderUboot
"-g" "${toString cfg.uboot.configurationLimit}"
"-t" timeoutStr
] ++ lib.optionals (dtCfg.name != null) [
"-c" dtCfg.name
] else [
builderGeneric
"-c"
]
);
|
||
builderUboot = import ./uboot-builder.nix { inherit pkgs configTxt; inherit (cfg) version; }; | ||
builderGeneric = import ./raspberrypi-builder.nix { inherit pkgs configTxt; }; | ||
|
||
builder = | ||
if cfg.uboot.enable then | ||
"${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr} -c" | ||
"${builderUboot} -g ${toString cfg.uboot.configurationLimit} -t ${timeoutStr}" |
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.
Why not just append the optional -n name after -c and thus diff churn?
I'm closing this since the You should migrate to |
Description of changes
Uboot on Raspberry Pi's is loading the wrong DTB file for some unknown reason. For example on a Pi 3B it's loading bcm2837 instead of bcm2710. This has been corrected with the following fixup on the
linux-rpi
kernel:nixpkgs/pkgs/os-specific/linux/kernel/linux-rpi.nix
Line 58 in b235fa2
However, this fixup doesn't work anymore if custom
hardware.deviceTree.overlays
are used, since the overlays are compiled from source (?). I've looked for a proper workaround and came up with this patch. This patch allows specifying a specific DTB that needs to be loaded, instead of Uboot choosing one. Theboot.loader.generic-extlinux-compatible
already supports this option but this isn't passed by the raspberrypi uboot builder.For the Pi 3B i've used this setting to fixate the correct DTB:
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes