[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Do full console initialization in the initrd, not just keymap. (#458362)



With the advent of plymouth, this means that the virtual console may be
in graphics mode. This causes font setting to fail. Since we can't
realistically wait until plymouth finishes to do this, we need to do
the full initialization before plymouth starts. Copy in the font and
any required mappings, and run the udev console setup helper directly.

This removes the special case for loading the keymap, as it's handled
by this.
---
 mkinitrd |   49 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/mkinitrd b/mkinitrd
index cbf5978..3a9bf0b 100755
--- a/mkinitrd
+++ b/mkinitrd
@@ -1535,9 +1535,10 @@ EOF
 
 if [ $ncryptodevs -ne 0 ]; then
     inst /sbin/cryptsetup "$MNTIMAGE"
+fi
 
-    KEYTABLE=
-    KEYMAP=
+if [ -f /etc/sysconfig/i18n -o -f /etc/sysconfig/keyboard ]; then
+    I18N=yes
     if [ -f /etc/sysconfig/console/default.kmap ]; then
         KEYMAP=/etc/sysconfig/console/default.kmap
     else
@@ -1548,16 +1549,8 @@ if [ $ncryptodevs -ne 0 ]; then
             KEYMAP="$KEYTABLE.map"
         fi
     fi
-
+    inst /etc/sysconfig/keyboard "$MNTIMAGE"
     if [ -n "$KEYMAP" ]; then
-        LOADKEYS=loadkeys
-        if [ -f /etc/sysconfig/i18n ]; then
-            . /etc/sysconfig/i18n
-        fi
-        if [ "${LANG}" != "${LANG%%.UTF-8}" -o "${LANG}" != "${LANG%%.utf8}" ]; then
-            LOADKEYS="loadkeys -u"
-        fi
-
         inst /bin/loadkeys "$MNTIMAGE"
         findkeymap $KEYMAP
 
@@ -1573,6 +1566,34 @@ if [ $ncryptodevs -ne 0 ]; then
             esac
         done
     fi
+
+    if [ -f /etc/sysconfig/i18n ]; then
+        . /etc/sysconfig/i18n
+    fi
+    inst /etc/sysconfig/i18n "$MNTIMAGE"
+    [ -z "$SYSFONT" ] && SYSFONT=latarcyrheb-sun16
+    if [ -n "$SYSFONT" ]; then
+        inst /bin/setfont "$MNTIMAGE"
+
+        for FN in /lib/kbd/consolefonts/$SYSFONT.* ; do
+            inst $FN "$MNTIMAGE"
+            case "$FN" in
+                *.gz)
+                    gzip -d "$MNTIMAGE$FN"
+                    ;;
+                *.bz2)
+                    bzip2 -d "$MNTIMAGE$FN"
+                    ;;
+            esac
+        done
+        if [ -n "$SYSFONTACM" ]; then
+            inst /lib/kbd/consoletrans/$SYSFONTACM "$MNTIMAGE"
+        fi
+        if [ -n "$UNIMAP" ]; then
+            inst /lib/kbd/unimaps/$UNIMAP "$MNTIMAGE"
+        fi
+    fi
+    inst /lib/udev/console_init "$MNTIMAGE"
 fi
 
 echo -n >| $RCFILE
@@ -1612,6 +1633,7 @@ fi
 for i in 0 1 2 3 ; do
     emit "mknod /dev/ttyS$i c 4 $(($i + 64))"
 done
+[ -n "$I18N" ] && emit "/lib/udev/console_init tty0"
 
 emit "daemonize --ignore-missing /bin/plymouthd"
 
@@ -1690,11 +1712,6 @@ emitcrypto()
     emit "plymouth ask-for-password --command \"cryptsetup luksOpen $1 $2\""
 }
 
-if [ -n "$KEYMAP" ]; then
-    emit "echo Loading keymap."
-    emit "$LOADKEYS $KEYMAP"
-fi
-
 for cryptdev in ${!cryptopart } ; do
     emitcrypto `eval echo '$'$cryptdev`
 done
-- 
1.6.0.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]