[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 21/29] 30_os-prober.in: just build chainloader entries, don't
From: |
Leo Sandoval |
Subject: |
[PATCH v3 21/29] 30_os-prober.in: just build chainloader entries, don't try any xnu xnu. |
Date: |
Mon, 14 Oct 2024 11:08:06 -0600 |
From: Peter Jones <pjones@redhat.com>
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 656301eaf..1aac097c1 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -45,68 +45,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
}
@@ -299,11 +256,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.46.2
- [PATCH v3 00/29] Second Distro-agnostic series taken from Fedora Rawhide, Leo Sandoval, 2024/10/14
- [PATCH v3 17/29] 10_linux.in: Make grub2-mkconfig construct titles that look like the ones we want elsewhere., Leo Sandoval, 2024/10/14
- [PATCH v3 18/29] grub-set-password.in: Add friendly grub2 password config tool (#985962), Leo Sandoval, 2024/10/14
- [PATCH v3 19/29] net/tcp: add window scaling support, Leo Sandoval, 2024/10/14
- [PATCH v3 21/29] 30_os-prober.in: just build chainloader entries, don't try any xnu xnu.,
Leo Sandoval <=
- [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Leo Sandoval, 2024/10/14
- Re: [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Neal Gompa, 2024/10/18
- Re: [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Vladimir 'phcoder' Serbinenko, 2024/10/18
- Re: [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Michael Chang, 2024/10/20
- Re: [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Vladimir 'phcoder' Serbinenko, 2024/10/21
- Re: [PATCH v3 22/29] btrfs: Add ability to boot from subvolumes, Neal Gompa, 2024/10/22
[PATCH v3 20/29] grub-get-kernel-settings.in: Add grub-get-kernel-settings and use it in 10_linux, Leo Sandoval, 2024/10/14
[PATCH v3 23/29] btrfs: fix a bad null check, Leo Sandoval, 2024/10/14