Blame SOURCES/0089-Migrate-PPC-from-Yaboot-to-Grub2.patch

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