10_xnu.in 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #! /bin/sh
  2. set -e
  3. # grub-mkconfig helper script.
  4. # Copyright (C) 2006,2007,2008,2009,2012 Free Software Foundation, Inc.
  5. #
  6. # GRUB is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # GRUB is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  18. prefix="@prefix@"
  19. exec_prefix="@exec_prefix@"
  20. datarootdir="@datarootdir@"
  21. export TEXTDOMAIN=@PACKAGE@
  22. export TEXTDOMAINDIR="@localedir@"
  23. . "$pkgdatadir/grub-mkconfig_lib"
  24. osx_entry() {
  25. if [ x$2 = x32 ]; then
  26. # TRANSLATORS: it refers to kernel architecture (32-bit)
  27. bitstr="$(gettext "(32-bit)")"
  28. else
  29. # TRANSLATORS: it refers to kernel architecture (64-bit)
  30. bitstr="$(gettext "(64-bit)")"
  31. fi
  32. # TRANSLATORS: it refers on the OS residing on device %s
  33. onstr="$(gettext_printf "(on %s)" "${GRUB_DEVICE}")"
  34. cat << EOF
  35. 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}")' {
  36. EOF
  37. save_default_entry | grub_add_tab
  38. prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab
  39. cat << EOF
  40. load_video
  41. set do_resume=0
  42. if [ /var/vm/sleepimage -nt10 / ]; then
  43. if xnu_resume /var/vm/sleepimage; then
  44. set do_resume=1
  45. fi
  46. fi
  47. if [ \$do_resume = 0 ]; then
  48. xnu_uuid ${OSXUUID} uuid
  49. if [ -f /Extra/DSDT.aml ]; then
  50. acpi -e /Extra/DSDT.aml
  51. fi
  52. if [ /kernelcache -nt /System/Library/Extensions ]; then
  53. $1 /kernelcache boot-uuid=\${uuid} rd=*uuid
  54. elif [ -f /System/Library/Kernels/kernel ]; then
  55. $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid
  56. xnu_kextdir /System/Library/Extensions
  57. else
  58. $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
  59. if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
  60. xnu_mkext /System/Library/Extensions.mkext
  61. else
  62. xnu_kextdir /System/Library/Extensions
  63. fi
  64. fi
  65. if [ -f /Extra/Extensions.mkext ]; then
  66. xnu_mkext /Extra/Extensions.mkext
  67. fi
  68. if [ -d /Extra/Extensions ]; then
  69. xnu_kextdir /Extra/Extensions
  70. fi
  71. if [ -f /Extra/devprop.bin ]; then
  72. xnu_devprop_load /Extra/devprop.bin
  73. fi
  74. if [ -f /Extra/splash.jpg ]; then
  75. insmod jpeg
  76. xnu_splash /Extra/splash.jpg
  77. fi
  78. if [ -f /Extra/splash.png ]; then
  79. insmod png
  80. xnu_splash /Extra/splash.png
  81. fi
  82. if [ -f /Extra/splash.tga ]; then
  83. insmod tga
  84. xnu_splash /Extra/splash.tga
  85. fi
  86. fi
  87. }
  88. EOF
  89. }
  90. OSXUUID="`${grub_probe} --target=fs_uuid --device ${GRUB_DEVICE} 2> /dev/null`"
  91. osx_entry xnu_kernel 32
  92. osx_entry xnu_kernel64 64