Skip to content

Commit b773360

Browse files
committed
10_linux: use PARTUUID or path for kernels with no initrd generated
1 parent 954f4f9 commit b773360

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

util/grub.d/10_linux.in

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ find_rootdev() {
207207
local ident_type=uuid
208208
if ! [ -e "$GRUB_DEVICE" ] ; then
209209
ident_type=error
210-
elif bool "$GRUB_DISABLE_LINUX_UUID" ; then
210+
elif bool "$GRUB_DISABLE_LINUX_UUID" || [ "$1" = "fallback" ] ; then
211211
if bool "$GRUB_DISABLE_LINUX_PARTUUID" ; then
212212
ident_type=path
213213
else
@@ -317,6 +317,7 @@ process_kernels() {
317317
latest_kernels=($(prioritize ${latest_kernels[@]}))
318318
unset IFS
319319
ROOT_PARAM="root=$(find_rootdev)"
320+
ROOT_PARAM_FALLBACK="root=$(find_rootdev fallback)"
320321
if [ -z "${ROOT_PARAM##root=}" ] ; then
321322
gettext_printf "Internal error - Failed to find the root device\n" >&2
322323
exit 1
@@ -328,7 +329,13 @@ process_kernels() {
328329
localpart="${uname_r//$latest/}"
329330
comments="$(get_comments "$uname_r")"
330331
title="${OS}${comments}"
331-
linux_entry "$title" "${GRUB_KERNEL_DIR}${kernel}" "$(get_initrd "$uname_r")" "$ARGS" "${OS_ID}-${kernel}"
332+
initrd="$(get_initrd "$uname_r")"
333+
if [ -z ${initrd/${INITRD_EARLY}/} ] ; then
334+
args="${ARGS/$ROOT_PARAM/$ROOT_PARAM_FALLBACK}"
335+
else
336+
args="$ARGS"
337+
fi
338+
linux_entry "$title" "${GRUB_KERNEL_DIR}${kernel}" "$initrd" "$args" "${OS_ID}-${kernel}"
332339
done
333340
# Now we processed the latest versions of the kernel, time to put
334341
# other kernel versions into the submenu.
@@ -350,7 +357,13 @@ process_kernels() {
350357
comments="$(gettext_printf "With kernel %s" "$uname_r")"
351358
comments=" ($(echo "$comments" | grub_quote))"
352359
title="${OS}${comments}"
353-
linux_entry "$title" "${GRUB_KERNEL_DIR}/${kernel}" "$(get_initrd "$uname_r")" "$ARGS" "${OS_ID}-${kernel}"
360+
initrd="$(get_initrd "$uname_r")"
361+
if [ -z ${initrd/${INITRD_EARLY}/} ] ; then
362+
ARGS="${ARGS/$ROOT_PARAM/$ROOT_PARAM_FALLBACK}"
363+
else
364+
args="$ARGS"
365+
fi
366+
linux_entry "$title" "${GRUB_KERNEL_DIR}${kernel}" "$initrd" "$args" "${OS_ID}-${kernel}"
354367
done
355368
done
356369
printf "}\n"

0 commit comments

Comments
 (0)