|
|
8e15ce |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
8e15ce |
From: Mark Hamzy <hamzy@us.ibm.com>
|
|
|
8e15ce |
Date: Wed, 28 Mar 2012 14:46:41 -0500
|
|
|
8e15ce |
Subject: [PATCH] Migrate PPC from Yaboot to Grub2
|
|
|
8e15ce |
|
|
|
8e15ce |
Add configuration support for serial terminal consoles. This will set the
|
|
|
8e15ce |
maximum screen size so that text is not overwritten.
|
|
|
8e15ce |
---
|
|
|
8e15ce |
Makefile.util.def | 7 +++
|
|
|
8e15ce |
util/grub.d/20_ppc_terminfo.in | 114 +++++++++++++++++++++++++++++++++++++++++
|
|
|
8e15ce |
2 files changed, 121 insertions(+)
|
|
|
8e15ce |
create mode 100644 util/grub.d/20_ppc_terminfo.in
|
|
|
8e15ce |
|
|
|
8e15ce |
diff --git a/Makefile.util.def b/Makefile.util.def
|
|
|
8e15ce |
index f8b356cc1fa..2c9b283a230 100644
|
|
|
8e15ce |
--- a/Makefile.util.def
|
|
|
8e15ce |
+++ b/Makefile.util.def
|
|
|
8e15ce |
@@ -508,6 +508,13 @@ script = {
|
|
|
8e15ce |
condition = COND_HOST_LINUX;
|
|
|
8e15ce |
};
|
|
|
8e15ce |
|
|
|
8e15ce |
+script = {
|
|
|
8e15ce |
+ name = '20_ppc_terminfo';
|
|
|
8e15ce |
+ common = util/grub.d/20_ppc_terminfo.in;
|
|
|
8e15ce |
+ installdir = grubconf;
|
|
|
8e15ce |
+ condition = COND_HOST_LINUX;
|
|
|
8e15ce |
+};
|
|
|
8e15ce |
+
|
|
|
8e15ce |
script = {
|
|
|
8e15ce |
name = '30_os-prober';
|
|
|
8e15ce |
common = util/grub.d/30_os-prober.in;
|
|
|
8e15ce |
diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
|
|
|
8e15ce |
new file mode 100644
|
|
|
8e15ce |
index 00000000000..10d66586820
|
|
|
8e15ce |
--- /dev/null
|
|
|
8e15ce |
+++ b/util/grub.d/20_ppc_terminfo.in
|
|
|
8e15ce |
@@ -0,0 +1,114 @@
|
|
|
8e15ce |
+#! /bin/sh
|
|
|
8e15ce |
+set -e
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+# grub-mkconfig helper script.
|
|
|
8e15ce |
+# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
|
|
8e15ce |
+#
|
|
|
8e15ce |
+# GRUB is free software: you can redistribute it and/or modify
|
|
|
8e15ce |
+# it under the terms of the GNU General Public License as published by
|
|
|
8e15ce |
+# the Free Software Foundation, either version 3 of the License, or
|
|
|
8e15ce |
+# (at your option) any later version.
|
|
|
8e15ce |
+#
|
|
|
8e15ce |
+# GRUB is distributed in the hope that it will be useful,
|
|
|
8e15ce |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
8e15ce |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
8e15ce |
+# GNU General Public License for more details.
|
|
|
8e15ce |
+#
|
|
|
8e15ce |
+# You should have received a copy of the GNU General Public License
|
|
|
8e15ce |
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+prefix=@prefix@
|
|
|
8e15ce |
+exec_prefix=@exec_prefix@
|
|
|
8e15ce |
+bindir=@bindir@
|
|
|
8e15ce |
+libdir=@libdir@
|
|
|
8e15ce |
+. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+export TEXTDOMAIN=@PACKAGE@
|
|
|
8e15ce |
+export TEXTDOMAINDIR=@localedir@
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+X=80
|
|
|
8e15ce |
+Y=24
|
|
|
8e15ce |
+TERMINAL=ofconsole
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+argument () {
|
|
|
8e15ce |
+ opt=$1
|
|
|
8e15ce |
+ shift
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ if test $# -eq 0; then
|
|
|
8e15ce |
+ echo "$0: option requires an argument -- '$opt'" 1>&2
|
|
|
8e15ce |
+ exit 1
|
|
|
8e15ce |
+ fi
|
|
|
8e15ce |
+ echo $1
|
|
|
8e15ce |
+}
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+check_terminfo () {
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ while test $# -gt 0
|
|
|
8e15ce |
+ do
|
|
|
8e15ce |
+ option=$1
|
|
|
8e15ce |
+ shift
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ case "$option" in
|
|
|
8e15ce |
+ terminfo | TERMINFO)
|
|
|
8e15ce |
+ ;;
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ -g)
|
|
|
8e15ce |
+ NEWXY=`argument $option "$@"`
|
|
|
8e15ce |
+ NEWX=`echo $NEWXY | cut -d x -f 1`
|
|
|
8e15ce |
+ NEWY=`echo $NEWXY | cut -d x -f 2`
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ if [ ${NEWX} -ge 80 ] ; then
|
|
|
8e15ce |
+ X=${NEWX}
|
|
|
8e15ce |
+ else
|
|
|
8e15ce |
+ echo "Warning: ${NEWX} is less than the minimum size of 80"
|
|
|
8e15ce |
+ fi
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ if [ ${NEWY} -ge 24 ] ; then
|
|
|
8e15ce |
+ Y=${NEWY}
|
|
|
8e15ce |
+ else
|
|
|
8e15ce |
+ echo "Warning: ${NEWY} is less than the minimum size of 24"
|
|
|
8e15ce |
+ fi
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ shift
|
|
|
8e15ce |
+ ;;
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ *)
|
|
|
8e15ce |
+# # accept console or ofconsole
|
|
|
8e15ce |
+# if [ "$option" != "console" -a "$option" != "ofconsole" ] ; then
|
|
|
8e15ce |
+# echo "Error: GRUB_TERMINFO unknown console: $option"
|
|
|
8e15ce |
+# exit 1
|
|
|
8e15ce |
+# fi
|
|
|
8e15ce |
+# # perfer console
|
|
|
8e15ce |
+# TERMINAL=console
|
|
|
8e15ce |
+ # accept ofconsole
|
|
|
8e15ce |
+ if [ "$option" != "ofconsole" ] ; then
|
|
|
8e15ce |
+ echo "Error: GRUB_TERMINFO unknown console: $option"
|
|
|
8e15ce |
+ exit 1
|
|
|
8e15ce |
+ fi
|
|
|
8e15ce |
+ # perfer console
|
|
|
8e15ce |
+ TERMINAL=ofconsole
|
|
|
8e15ce |
+ ;;
|
|
|
8e15ce |
+ esac
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ done
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+}
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+if ! uname -m | grep -q ppc ; then
|
|
|
8e15ce |
+ exit 0
|
|
|
8e15ce |
+fi
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+if [ "x${GRUB_TERMINFO}" != "x" ] ; then
|
|
|
8e15ce |
+ F1=`echo ${GRUB_TERMINFO} | cut -d " " -f 1`
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ if [ "${F1}" != "terminfo" ] ; then
|
|
|
8e15ce |
+ echo "Error: GRUB_TERMINFO is set to \"${GRUB_TERMINFO}\" The first word should be terminfo."
|
|
|
8e15ce |
+ exit 1
|
|
|
8e15ce |
+ fi
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+ check_terminfo ${GRUB_TERMINFO}
|
|
|
8e15ce |
+fi
|
|
|
8e15ce |
+
|
|
|
8e15ce |
+cat << EOF
|
|
|
8e15ce |
+ terminfo -g ${X}x${Y} ${TERMINAL}
|
|
|
8e15ce |
+EOF
|