hardware.deviceTree: add name

This can be used to explicitly specify a specific dtb file, relative to
the dtb base.

Update the generic-extlinux-compatible module to make use of this option.
This commit is contained in:
Florian Klink 2020-06-21 10:33:09 +02:00
parent bd8137aef1
commit 387f3b58d2
2 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,17 @@ in {
'';
};
name = mkOption {
default = null;
example = "some-dtb.dtb";
type = types.nullOr types.str;
description = ''
The name of an explicit dtb to be loaded, relative to the dtb base.
Useful in extlinux scenarios if the bootloader doesn't pick the
right .dtb file from FDTDIR.
'';
};
overlays = mkOption {
default = [];
example = literalExample

View File

@ -4,6 +4,7 @@ with lib;
let
blCfg = config.boot.loader;
dtCfg = config.hardware.deviceTree;
cfg = blCfg.generic-extlinux-compatible;
timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout;
@ -53,7 +54,7 @@ in
};
config = let
builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}";
builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}" + lib.optionalString (dtCfg.name != null) " -n ${dtCfg.name}";
in
mkIf cfg.enable {
system.build.installBootLoader = "${builder} ${builderArgs} -c";