* configure.ac: Add condition for COND_HOST_XNU.

* Makefile.util.def (10_xnu): New script.
	* util/grub.d/10_xnu.in: New file, extracted from 30_os_prober.in.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-29 13:56:21 +02:00
parent 84e1569ee4
commit b105df76f4
4 changed files with 110 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-05-29 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Add condition for COND_HOST_XNU.
* Makefile.util.def (10_xnu): New script.
* util/grub.d/10_xnu.in: New file, extracted from 30_os_prober.in.
2012-05-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/i386/pc/startup.S [__APPLE__]: Add a workaround for

View File

@ -419,6 +419,13 @@ script = {
condition = COND_HOST_LINUX;
};
script = {
name = '10_xnu';
common = util/grub.d/10_xnu.in;
installdir = grubconf;
condition = COND_HOST_XNU;
};
script = {
name = '20_linux_xen';
common = util/grub.d/20_linux_xen.in;

View File

@ -155,6 +155,7 @@ case "$host_os" in
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
netbsd*) host_kernel=netbsd ;;
solaris*) host_kernel=illumos ;;
darwin*) host_kernel=xnu ;;
cygwin) host_kernel=windows ;;
esac
@ -1118,6 +1119,7 @@ AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])

95
util/grub.d/10_xnu.in Normal file
View File

@ -0,0 +1,95 @@
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2012 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
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)" "${GRUB_DEVICE}")"
cat << EOF
menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
EOF
save_default_entry | sed -e "s/^/ /"
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/ /"
cat << EOF
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
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
}
EOF
}
OSXUUID="`${grub_probe} --target=fs_uuid --device ${GRUB_DEVICE} 2> /dev/null`"
osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64