]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* configure.ac: Add condition for COND_HOST_XNU.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 29 May 2012 11:56:21 +0000 (13:56 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 29 May 2012 11:56:21 +0000 (13:56 +0200)
* Makefile.util.def (10_xnu): New script.
* util/grub.d/10_xnu.in: New file, extracted from 30_os_prober.in.

ChangeLog
Makefile.util.def
configure.ac
util/grub.d/10_xnu.in [new file with mode: 0644]

index 9f724e568d677609a62f1c19722341fbbf20ea5a..49442fb7bfc8d77f151e1004cfd98139c48a231a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 921305e9ec7666bd77dc9430b95542782652e715..dc2d21aae59bf575ac64398d94a4f0a1eba54075 100644 (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;
index 943256651591b8a9d71fbc9abc7ccb62376dc15f..3c5c4a41f6dc101b7aa563d37e298d469ed7529c 100644 (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])
diff --git a/util/grub.d/10_xnu.in b/util/grub.d/10_xnu.in
new file mode 100644 (file)
index 0000000..55a9546
--- /dev/null
@@ -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