There are numerous ways to load Linux kernel depending on the platform customs.
Pick the correct one at runtime, so that legacy platform interfaces don't break
and newer platforms use their native ways of bootstrapping Linux.

Originally from Vladimir Serbinenko <phco...@gmail.com>, slightly modified.
---
 ChangeLog               |  5 +++++
 util/grub.d/10_linux.in | 17 +++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 10abfe2..4f1ee02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-20  Lubomir Rintel  <lkund...@v3.sk>
+
+       * util/grub.d/10_linux.in: Determine the loader command by platform.
+       (linux_entry): Use the command appropriate for given platform.
+
 2014-01-19  Colin Watson  <cjwat...@ubuntu.com>
 
        * grub-core/osdep/freebsd/hostdisk.c (grub_util_fd_open): Ignore
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 00d1931..d980d9a 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -129,14 +129,14 @@ linux_entry ()
   message="$(gettext_printf "Loading Linux %s ..." ${version})"
   sed "s/^/$submenu_indentation/" << EOF
        echo    '$(echo "$message" | grub_quote)'
-       linux   ${rel_dirname}/${basename} 
root=${linux_root_device_thisversion} ro ${args}
+       \$linux ${rel_dirname}/${basename} 
root=${linux_root_device_thisversion} ro ${args}
 EOF
   if test -n "${initrd}" ; then
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
     message="$(gettext_printf "Loading initial ramdisk ...")"
     sed "s/^/$submenu_indentation/" << EOF
        echo    '$(echo "$message" | grub_quote)'
-       initrd  ${rel_dirname}/${initrd}
+       \$initrd        ${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
@@ -169,6 +169,19 @@ prepare_root_cache=
 boot_device_id=
 title_correction_code=
 
+# Pick a correct kernel load command. Use real mode entry point on legacy PC
+# platform (so that EDD and APM keep being available) and native entry point
+# on everything else.
+cat <<EOF
+if [ x\$grub_platform = xpc ]; then
+       linux=linux16
+       initrd=initrd16
+else
+       linux=linux
+       initrd=initrd
+fi
+EOF
+
 # Extra indentation to add to menu entries in a submenu. We're not in a submenu
 # yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
 submenu_indentation=""
-- 
1.8.5.3


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to