generic-extlinux-compatible: Allow disabling generation of device tree directives

Changed files
+27 -4
nixos
modules
system
boot
loader
generic-extlinux-compatible
+18 -1
nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix
···
'';
};
+
useGenerationDeviceTree = mkOption {
+
default = true;
+
type = types.bool;
+
description = ''
+
Whether to generate Device Tree-related directives in the
+
extlinux configuration.
+
+
When enabled, the bootloader will attempt to load the device
+
tree binaries from the generation's kernel.
+
+
Note that this affects all generations, regardless of the
+
setting value used in their configurations.
+
'';
+
};
+
configurationLimit = mkOption {
default = 20;
example = 10;
···
};
config = let
-
builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}" + lib.optionalString (dtCfg.name != null) " -n ${dtCfg.name}";
+
builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}"
+
+ lib.optionalString (dtCfg.name != null) " -n ${dtCfg.name}"
+
+ lib.optionalString (!cfg.useGenerationDeviceTree) " -r";
in
mkIf cfg.enable {
system.build.installBootLoader = "${builder} ${builderArgs} -c";
+9 -3
nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.sh
···
for i in @path@; do PATH=$PATH:$i/bin; done
usage() {
-
echo "usage: $0 -t <timeout> -c <path-to-default-configuration> [-d <boot-dir>] [-g <num-generations>] [-n <dtbName>]" >&2
+
echo "usage: $0 -t <timeout> -c <path-to-default-configuration> [-d <boot-dir>] [-g <num-generations>] [-n <dtbName>] [-r]" >&2
exit 1
}
···
target=/boot # Target directory
numGenerations=0 # Number of other generations to include in the menu
-
while getopts "t:c:d:g:n:" opt; do
+
while getopts "t:c:d:g:n:r" opt; do
case "$opt" in
t) # U-Boot interprets '0' as infinite and negative as instant boot
if [ "$OPTARG" -lt 0 ]; then
···
d) target="$OPTARG" ;;
g) numGenerations="$OPTARG" ;;
n) dtbName="$OPTARG" ;;
+
r) noDeviceTree=1 ;;
\?) usage ;;
esac
done
···
fi
echo " LINUX ../nixos/$(basename $kernel)"
echo " INITRD ../nixos/$(basename $initrd)"
+
echo " APPEND init=$path/init $extraParams"
+
+
if [ -n "$noDeviceTree" ]; then
+
return
+
fi
+
if [ -d "$dtbDir" ]; then
# if a dtbName was specified explicitly, use that, else use FDTDIR
if [ -n "$dtbName" ]; then
···
exit 1
fi
fi
-
echo " APPEND init=$path/init $extraParams"
}
tmpFile="$target/extlinux/extlinux.conf.tmp.$$"