From 5ea509fd126b7e51fb32ac46c880b86817c8d7a1 Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Fri, 14 Feb 2014 11:32:38 +0530 Subject: 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 --- board-qemu/slof/Makefile | 1 + board-qemu/slof/OF.fs | 8 +++++++- board-qemu/slof/dev-null.fs | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 board-qemu/slof/dev-null.fs 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 -- cgit v1.1