aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2014-02-14 11:32:38 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2014-03-04 12:52:03 +1100
commit5ea509fd126b7e51fb32ac46c880b86817c8d7a1 (patch)
treebe6debcbe3f9ec8819680d10b397419283bcb8ec
parentae98d1464cdb6ca645cb7d62d44ed7df106a0d3f (diff)
downloadSLOF-5ea509fd126b7e51fb32ac46c880b86817c8d7a1.zip
SLOF-5ea509fd126b7e51fb32ac46c880b86817c8d7a1.tar.gz
SLOF-5ea509fd126b7e51fb32ac46c880b86817c8d7a1.tar.bz2
Introduce dummy console device
Qemu can create console-less machine, aka no output device. And there are dependencies in the guest which expects a valid output device. Add this dummy device that gobbles up all the output send, and keeps the guest happy. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
-rw-r--r--board-qemu/slof/Makefile1
-rw-r--r--board-qemu/slof/OF.fs8
-rw-r--r--board-qemu/slof/dev-null.fs35
3 files changed, 43 insertions, 1 deletions
diff --git a/board-qemu/slof/Makefile b/board-qemu/slof/Makefile
index 43db4aa..6a9fa17 100644
--- a/board-qemu/slof/Makefile
+++ b/board-qemu/slof/Makefile
@@ -76,6 +76,7 @@ VIO_FFS_FILES = \
$(SLOFBRDDIR)/virtio-net.fs \
$(SLOFBRDDIR)/virtio-block.fs \
$(SLOFBRDDIR)/virtio-fs.fs \
+ $(SLOFBRDDIR)/dev-null.fs \
$(SLOFBRDDIR)/virtio-scsi.fs
# Files that should go into the ROM fs (and so have to be listed in OF.ffs):
diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs
index 061df66..66af237 100644
--- a/board-qemu/slof/OF.fs
+++ b/board-qemu/slof/OF.fs
@@ -226,7 +226,13 @@ romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
." using hvterm" cr
" hvterm" io
ELSE
- ." and no default found" cr
+ " /openprom" find-node ?dup IF
+ set-node
+ ." and no default found, creating dev-null" cr
+ " dev-null.fs" included
+ " devnull-console" io
+ 0 set-node
+ THEN
THEN
THEN
THEN
diff --git a/board-qemu/slof/dev-null.fs b/board-qemu/slof/dev-null.fs
new file mode 100644
index 0000000..d0ffad6
--- /dev/null
+++ b/board-qemu/slof/dev-null.fs
@@ -0,0 +1,35 @@
+\ Introduce a dummy console that will eat away all chars and make all
+\ the components dependent on stdout happy.
+
+new-device
+" devnull-console" device-name
+
+: open true ;
+: close ;
+
+: write ( adr len -- actual )
+ nip
+;
+
+: read ( adr len -- actual )
+ nip
+;
+
+: setup-alias
+ " devnull-console" find-alias 0= IF
+ " devnull-console" get-node node>path set-alias
+ ELSE
+ drop
+ THEN
+;
+
+: dummy-term-emit drop ;
+: dummy-term-key 0 ;
+: dummy-term-key? FALSE ;
+
+' dummy-term-emit to emit
+' dummy-term-key to key
+' dummy-term-key? to key?
+
+setup-alias
+finish-device