forked from pool/grub2
957b4bf706
- Switch to '--no-hostonly' when creating the ZIPL initrd in the KIWI build environment to avoid some potential issues due to the missing modules * grub2-s390x-set-hostonly.patch OBS-URL: https://build.opensuse.org/request/show/1191065 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=510
146 lines
4.9 KiB
Diff
146 lines
4.9 KiB
Diff
From: Raymund Will <rw@suse.com>
|
|
Subject: Enable grub2-mkconfig for s390x-emu
|
|
References: fate#314213, bnc#868909
|
|
Patch-Mainline: no
|
|
|
|
V2:
|
|
* omit subvolume-prefix for platform "emu"
|
|
V3:
|
|
* add 'conmode=' to command-line if GRUB_CONMODE exists. [bnc#868909]
|
|
V4:
|
|
* remove 's' from possible hot-keys for "bootable snapshots". [bnc#885668]
|
|
|
|
---
|
|
util/grub.d/10_linux.in | 63 ++++++++++++++++++++++++++++++++++++++----------
|
|
1 file changed, 51 insertions(+), 12 deletions(-)
|
|
|
|
--- a/util/grub.d/10_linux.in
|
|
+++ b/util/grub.d/10_linux.in
|
|
@@ -65,6 +65,10 @@
|
|
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
|
fi
|
|
|
|
+if [ "x$GRUB_CONMODE" != "x" ]; then
|
|
+ GRUB_CMDLINE_LINUX="conmode=${GRUB_CONMODE} ${GRUB_CMDLINE_LINUX}"
|
|
+fi
|
|
+
|
|
case x"$GRUB_FS" in
|
|
xbtrfs)
|
|
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
@@ -81,6 +85,21 @@
|
|
|
|
title_correction_code=
|
|
|
|
+hotkey=1
|
|
+incr_hotkey()
|
|
+{
|
|
+ [ -z "$hotkey" ] && return
|
|
+ expr $hotkey + 1
|
|
+}
|
|
+print_hotkey()
|
|
+{
|
|
+ keys="123456789abdfgijklmnoprtuvwyz"
|
|
+ if [ -z "$hotkey" ]||[ $hotkey -eq 0 ]||[ $hotkey -gt 30 ]; then
|
|
+ return
|
|
+ fi
|
|
+ echo "--hotkey=$(expr substr $keys $hotkey 1)"
|
|
+}
|
|
+
|
|
linux_entry ()
|
|
{
|
|
os="$1"
|
|
@@ -110,9 +129,11 @@
|
|
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
|
|
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
|
|
fi
|
|
- echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
|
+ echo "menuentry '$(echo "$title" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
|
+ hotkey=$(incr_hotkey)
|
|
else
|
|
- echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
|
+ echo "menuentry '$(echo "$os" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
|
+ hotkey=$(incr_hotkey)
|
|
fi
|
|
if [ x$type != xrecovery ] ; then
|
|
save_default_entry | grub_add_tab
|
|
@@ -135,6 +156,7 @@
|
|
|
|
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
|
|
|
|
+ if [ $PLATFORM != emu ]; then # 'search' does not work for now
|
|
if [ x$dirname = x/ ]; then
|
|
if [ -z "${prepare_root_cache}" ]; then
|
|
prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
|
|
@@ -146,6 +168,7 @@
|
|
fi
|
|
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
|
fi
|
|
+ fi
|
|
message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
|
sed "s/^/$submenu_indentation/" << EOF
|
|
echo '$(echo "$message" | grub_quote)'
|
|
@@ -170,17 +193,15 @@
|
|
|
|
machine=`uname -m`
|
|
case "x$machine" in
|
|
- xi?86 | xx86_64)
|
|
- list=
|
|
- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
|
|
- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
|
|
- done ;;
|
|
- *)
|
|
- list=
|
|
- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
|
|
- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
|
|
- done ;;
|
|
+ xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;;
|
|
+ xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;;
|
|
+ *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \
|
|
+ /boot/kernel-*" ;;
|
|
esac
|
|
+list=
|
|
+for i in $klist ; do
|
|
+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
|
|
+done
|
|
|
|
case "$machine" in
|
|
i?86) GENKERNEL_ARCH="x86" ;;
|
|
@@ -190,6 +211,15 @@
|
|
*) GENKERNEL_ARCH="$machine" ;;
|
|
esac
|
|
|
|
+PLATFORM="native"
|
|
+if [ -d /sys/firmware/efi ]&&[ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then
|
|
+ PLATFORM="efi"
|
|
+else
|
|
+ case "$machine" in
|
|
+ s390*) PLATFORM="emu" ;;
|
|
+ esac
|
|
+fi
|
|
+
|
|
prepare_boot_cache=
|
|
prepare_root_cache=
|
|
boot_device_id=
|
|
@@ -216,6 +246,11 @@
|
|
basename=`basename $linux`
|
|
dirname=`dirname $linux`
|
|
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
|
+ if [ $PLATFORM != "emu" ]; then
|
|
+ hotkey=0
|
|
+ else
|
|
+ rel_dirname=$dirname
|
|
+ fi
|
|
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
|
|
alt_version=`echo $version | sed -e "s,\.old$,,g"`
|
|
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
|
|
@@ -333,7 +368,8 @@
|
|
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
|
fi
|
|
# TRANSLATORS: %s is replaced with an OS name
|
|
- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
|
|
+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' $(print_hotkey) \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
|
|
+ hotkey=$(incr_hotkey)
|
|
is_top_level=false
|
|
fi
|
|
|