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

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