grub2/0172-macos-just-build-chainloader-entries-don-t-try-any-x.patch

129 lines
4.5 KiB
Diff
Raw Normal View History

From 4cb6b65d74966dfbe6e8463ee1e88d99ca7de5b1 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 24 May 2017 12:42:32 -0400
Subject: [PATCH 172/243] macos: just build chainloader entries, don't try any
xnu xnu.
Since our bugs tell us that the xnu boot entries really just don't work
most of the time, and they create piles of extra boot entries, because
they can't quite figure out 32-vs-64 and other stuff like that.
It's rediculous, and we should just boot their bootloader through the
chainloader instead.
So this patch does that.
Resolves: rhbz#893179
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub.d/30_os-prober.in | 78 +++++++++++----------------------------------
1 file changed, 18 insertions(+), 60 deletions(-)
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index e40274fc0f4..d979de1982a 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then
fi
osx_entry() {
- if [ x$2 = x32 ]; then
- # TRANSLATORS: it refers to kernel architecture (32-bit)
- bitstr="$(gettext "(32-bit)")"
- else
- # TRANSLATORS: it refers to kernel architecture (64-bit)
- bitstr="$(gettext "(64-bit)")"
- fi
# TRANSLATORS: it refers on the OS residing on device %s
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
- cat << EOF
-menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
+ hints=""
+ for hint in `"${grub_probe}" --device ${device} --target=efi_hints 2> /dev/null` ; do
+ hints="${hints} --hint=${hint}"
+ done
+ cat << EOF
+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' {
EOF
save_default_entry | grub_add_tab
prepare_grub_to_access_device ${DEVICE} | grub_add_tab
cat << EOF
+ set gfxpayload=keep
load_video
- set do_resume=0
- if [ /var/vm/sleepimage -nt10 / ]; then
- if xnu_resume /var/vm/sleepimage; then
- set do_resume=1
- fi
- fi
- if [ \$do_resume = 0 ]; then
- xnu_uuid ${OSXUUID} uuid
- if [ -f /Extra/DSDT.aml ]; then
- acpi -e /Extra/DSDT.aml
- fi
- if [ /kernelcache -nt /System/Library/Extensions ]; then
- $1 /kernelcache boot-uuid=\${uuid} rd=*uuid
- elif [ -f /System/Library/Kernels/kernel ]; then
- $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid
- xnu_kextdir /System/Library/Extensions
- else
- $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
- if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
- xnu_mkext /System/Library/Extensions.mkext
- else
- xnu_kextdir /System/Library/Extensions
- fi
- fi
- if [ -f /Extra/Extensions.mkext ]; then
- xnu_mkext /Extra/Extensions.mkext
- fi
- if [ -d /Extra/Extensions ]; then
- xnu_kextdir /Extra/Extensions
- fi
- if [ -f /Extra/devprop.bin ]; then
- xnu_devprop_load /Extra/devprop.bin
- fi
- if [ -f /Extra/splash.jpg ]; then
- insmod jpeg
- xnu_splash /Extra/splash.jpg
- fi
- if [ -f /Extra/splash.png ]; then
- insmod png
- xnu_splash /Extra/splash.png
- fi
- if [ -f /Extra/splash.tga ]; then
- insmod tga
- xnu_splash /Extra/splash.tga
- fi
- fi
+ insmod part_gpt
+ insmod hfsplus
+ search --no-floppy --fs-uuid --set=root ${hints} $(grub_get_device_id "${DEVICE}")
+ chainloader (\$root)/System/Library/CoreServices/boot.efi
+ boot
}
EOF
}
@@ -307,11 +264,12 @@ EOF
echo "$title_correction_code"
;;
macosx)
- if [ "${UUID}" ]; then
- OSXUUID="${UUID}"
- osx_entry xnu_kernel 32
- osx_entry xnu_kernel64 64
- fi
+ for subdevice in ${DEVICE%[[:digit:]]*}* ; do
+ parttype="`"${grub_probe}" --device ${device} --target=gpt_parttype "${subdevice}" 2> /dev/null`"
+ if [[ "$parttype" = "426f6f74-0000-11aa-aa11-00306543ecac" ]]; then
+ DEVICE="${subdevice}" osx_entry
+ fi
+ done
;;
hurd)
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
--
2.17.1