dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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