Skip to content

Commit 0d961bc

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

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

util/grub.d/10_linux.in

Lines changed: 12 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,11 @@ 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+
fi
336+
linux_entry "$title" "${GRUB_KERNEL_DIR}${kernel}" "$initrd" "$ARGS" "${OS_ID}-${kernel}"
332337
done
333338
# Now we processed the latest versions of the kernel, time to put
334339
# other kernel versions into the submenu.
@@ -350,7 +355,11 @@ process_kernels() {
350355
comments="$(gettext_printf "With kernel %s" "$uname_r")"
351356
comments=" ($(echo "$comments" | grub_quote))"
352357
title="${OS}${comments}"
353-
linux_entry "$title" "${GRUB_KERNEL_DIR}/${kernel}" "$(get_initrd "$uname_r")" "$ARGS" "${OS_ID}-${kernel}"
358+
initrd="$(get_initrd "$uname_r")"
359+
if [ -z ${initrd/${INITRD_EARLY}/} ] ; then
360+
ARGS="${ARGS/$ROOT_PARAM/$ROOT_PARAM_FALLBACK}"
361+
fi
362+
linux_entry "$title" "${GRUB_KERNEL_DIR}${kernel}" "$initrd" "$ARGS" "${OS_ID}-${kernel}"
354363
done
355364
done
356365
printf "}\n"

0 commit comments

Comments
 (0)