generic-extlinux-compatible: Allow disabling generation of device tree directives
This commit is contained in:
parent
d7cdd09ad2
commit
16a907b00b
@ -30,6 +30,21 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 {
|
configurationLimit = mkOption {
|
||||||
default = 20;
|
default = 20;
|
||||||
example = 10;
|
example = 10;
|
||||||
@ -54,7 +69,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
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
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
system.build.installBootLoader = "${builder} ${builderArgs} -c";
|
system.build.installBootLoader = "${builder} ${builderArgs} -c";
|
||||||
|
@ -6,7 +6,7 @@ export PATH=/empty
|
|||||||
for i in @path@; do PATH=$PATH:$i/bin; done
|
for i in @path@; do PATH=$PATH:$i/bin; done
|
||||||
|
|
||||||
usage() {
|
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
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ default= # Default configuration
|
|||||||
target=/boot # Target directory
|
target=/boot # Target directory
|
||||||
numGenerations=0 # Number of other generations to include in the menu
|
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
|
case "$opt" in
|
||||||
t) # U-Boot interprets '0' as infinite and negative as instant boot
|
t) # U-Boot interprets '0' as infinite and negative as instant boot
|
||||||
if [ "$OPTARG" -lt 0 ]; then
|
if [ "$OPTARG" -lt 0 ]; then
|
||||||
@ -30,6 +30,7 @@ while getopts "t:c:d:g:n:" opt; do
|
|||||||
d) target="$OPTARG" ;;
|
d) target="$OPTARG" ;;
|
||||||
g) numGenerations="$OPTARG" ;;
|
g) numGenerations="$OPTARG" ;;
|
||||||
n) dtbName="$OPTARG" ;;
|
n) dtbName="$OPTARG" ;;
|
||||||
|
r) noDeviceTree=1 ;;
|
||||||
\?) usage ;;
|
\?) usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -96,6 +97,12 @@ addEntry() {
|
|||||||
fi
|
fi
|
||||||
echo " LINUX ../nixos/$(basename $kernel)"
|
echo " LINUX ../nixos/$(basename $kernel)"
|
||||||
echo " INITRD ../nixos/$(basename $initrd)"
|
echo " INITRD ../nixos/$(basename $initrd)"
|
||||||
|
echo " APPEND init=$path/init $extraParams"
|
||||||
|
|
||||||
|
if [ -n "$noDeviceTree" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d "$dtbDir" ]; then
|
if [ -d "$dtbDir" ]; then
|
||||||
# if a dtbName was specified explicitly, use that, else use FDTDIR
|
# if a dtbName was specified explicitly, use that, else use FDTDIR
|
||||||
if [ -n "$dtbName" ]; then
|
if [ -n "$dtbName" ]; then
|
||||||
@ -109,7 +116,6 @@ addEntry() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo " APPEND init=$path/init $extraParams"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpFile="$target/extlinux/extlinux.conf.tmp.$$"
|
tmpFile="$target/extlinux/extlinux.conf.tmp.$$"
|
||||||
|
Loading…
Reference in New Issue
Block a user