grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Determine the linux loader command at runtime


From: Lubomir Rintel
Subject: [PATCH] Determine the linux loader command at runtime
Date: Thu, 30 Jan 2014 09:24:42 +0100

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 <address@hidden>, 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  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]