Now that we have everything in place to support ramfb, let's wire it up
by default in the ARM QEMU targets. That way, you can easily use a
graphical console by just passing -device ramfb to the QEMU command line.

Signed-off-by: Alexander Graf <ag...@csgraf.de>
---
 arch/arm/Kconfig                    |  4 ++++
 board/emulation/qemu-arm/qemu-arm.c | 14 ++++++++++++++
 include/configs/qemu-arm.h          |  9 +++++++++
 3 files changed, 27 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 391a77c2b4..1f8b881c73 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -979,6 +979,10 @@ config ARCH_QEMU
        imply DM_RTC
        imply RTC_PL031
        imply OF_HAS_PRIOR_STAGE
+       imply BOARD_EARLY_INIT_R
+       imply DM_VIDEO
+       imply VIDEO_RAMFB
+       imply SYS_CONSOLE_IS_IN_ENV
 
 config ARCH_RMOBILE
        bool "Renesas ARM SoCs"
diff --git a/board/emulation/qemu-arm/qemu-arm.c 
b/board/emulation/qemu-arm/qemu-arm.c
index 16d5a97167..c898ea8a14 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -9,6 +9,7 @@
 #include <fdtdec.h>
 #include <init.h>
 #include <log.h>
+#include <qfw.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
@@ -63,6 +64,19 @@ static struct mm_region qemu_arm64_mem_map[] = {
 struct mm_region *mem_map = qemu_arm64_mem_map;
 #endif
 
+int board_early_init_r(void)
+{
+       struct udevice *qfw_dev;
+
+       /*
+        * Make sure we enumerate the QEMU Firmware device to find ramfb
+        * before console init starts.
+        */
+       qfw_get_dev(&qfw_dev);
+
+       return 0;
+}
+
 int board_init(void)
 {
        return 0;
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index 7ae71e0029..ac67e89a98 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -58,6 +58,12 @@
        BOOT_TARGET_NVME(func) \
        BOOT_TARGET_DHCP(func)
 
+#ifdef CONFIG_VIDEO_RAMFB
+# define QEMU_STDOUT "serial,vidconsole"
+#else
+# define QEMU_STDOUT "serial"
+#endif
+
 #include <config_distro_bootcmd.h>
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -68,6 +74,9 @@
        "pxefile_addr_r=0x40300000\0" \
        "kernel_addr_r=0x40400000\0" \
        "ramdisk_addr_r=0x44000000\0" \
+       "stdin=serial\0" \
+       "stdout=" QEMU_STDOUT "\0" \
+       "stderr=" QEMU_STDOUT "\0" \
        BOOTENV
 
 #define CONFIG_SYS_CBSIZE 512
-- 
2.32.0

Reply via email to