[SLOF] [PATCH] board-qemu: Add a possibility to use hvterm input instead of USB keyboard

Thomas Huth thuth at redhat.com
Thu Nov 10 23:38:23 AEDT 2016

SLOF automatically switches to USB keyboard input when it detects that
a graphics card and USB keyboard are available. However, for debugging
VGA or USB related issues, or running QEMU with the "-nographic" parameter,
it's more convenient to continue using the hvterm as input.
This patch adds the possibility to continue using hvterm if the user
sets the "direct-serial?" NVRAM variable to true. "direct-serial?" is
currently unused for board-qemu -- it's only used on board-js2x so far
for switching the serial ports there, so using this variable for
selecting the serial input on board-qemu seems to be a good fit, too.

Signed-off-by: Thomas Huth <thuth at redhat.com>
 Note: With the latest QEMU version from the master branch, it is
 possible to set NVRAM variables from the command line now, so this
 can now be configured like this:
  qemu-system-ppc64 .... -prom-env "direct-serial?=true"

 board-qemu/slof/OF.fs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
index 1406506..5959003 100644
--- a/board-qemu/slof/OF.fs
+++ b/board-qemu/slof/OF.fs
@@ -231,9 +231,16 @@ romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
         " screen" find-alias dup IF nip THEN
         " keyboard" find-alias dup IF nip THEN
         AND IF
-            ." using screen & keyboard" cr
-            " screen" output
-            " keyboard" input
+            ." using screen "
+            s" direct-serial?" evaluate IF
+                ." & hvterm"
+                s" hvterm" input
+            ELSE
+                ." & keyboard"
+                s" keyboard" input
+            THEN
+            cr
+            s" screen" output
             " hvterm" find-alias IF

More information about the SLOF mailing list