nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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