1 Star 0 Fork 99

src-NestOS/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0073-macos-just-build-chainloader-entries-don-t-try-any-x.patch 4.46 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From 86b5e0f596cd6266c48dd1829d97f0debb5dc5c6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 24 May 2017 12:42:32 -0400
Subject: [PATCH 073/220] 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 9b8f596..13a3a6b 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
}
@@ -284,11 +241,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}")"
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-nest-os/grub2.git
git@gitee.com:src-nest-os/grub2.git
src-nest-os
grub2
grub2
master

搜索帮助