aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-24 19:54:55 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-24 20:38:22 +0200
commitb5bf72d0f7ace28b3bb9cfe58d4b550159cb97f5 (patch)
tree8e2361b7284fc39fd0987bbb3eeb330af3106645
parentqemu: allow for cross compilation (diff)
downloadWireGuard-jd/broken-arm-qemu-serial.tar.xz
WireGuard-jd/broken-arm-qemu-serial.zip
qemu: work around bogus QEMU virt ARM machinesjd/broken-arm-qemu-serial
The virt machine type in QEMU only supports one native serial port, which means we're forced to add in a whole PCI bus if we want to get any more information out. Bad situation. This should be reverted as soon as upstream QEMU does something about it.
-rw-r--r--src/tests/qemu/Makefile7
-rw-r--r--src/tests/qemu/arch/aarch64.config11
-rw-r--r--src/tests/qemu/arch/arm.config11
3 files changed, 21 insertions, 8 deletions
diff --git a/src/tests/qemu/Makefile b/src/tests/qemu/Makefile
index ae03f6a..4a8ca17 100644
--- a/src/tests/qemu/Makefile
+++ b/src/tests/qemu/Makefile
@@ -59,6 +59,8 @@ $(eval $(call tar_download,IPUTILS,iputils,s20161105,.tar.gz,https://github.com/
export CFLAGS ?= -O3 -pipe
export CPPFLAGS := -I$(BUILD_PATH)/include
+QEMU_SERIAL_PORTS := -serial stdio -serial file:$(BUILD_PATH)/result
+
ifeq ($(CHOST),$(CBUILD))
CROSS_COMPILE_FLAG := --host=$(CHOST)
CFLAGS += -march=native
@@ -77,6 +79,7 @@ else
QEMU_MACHINE := -cpu cortex-a53 -machine virt
CFLAGS += -march=armv8-a -mtune=cortex-a53
endif
+QEMU_SERIAL_PORTS := -device pci-serial-2x,chardev1=stdio,chardev2=result -chardev stdio,id=stdio -chardev file,path=$(BUILD_PATH)/result,id=result
else ifeq ($(ARCH),arm)
QEMU_ARCH := arm
KERNEL_ARCH := arm
@@ -87,6 +90,7 @@ else
QEMU_MACHINE := -cpu cortex-a15 -machine virt
CFLAGS += -march=armv7-a -mtune=cortex-a15 -mabi=aapcs-linux
endif
+QEMU_SERIAL_PORTS := -device pci-serial-2x,chardev1=stdio,chardev2=result -chardev stdio,id=stdio -chardev file,path=$(BUILD_PATH)/result,id=result
else ifeq ($(ARCH),x86_64)
QEMU_ARCH := x86_64
KERNEL_ARCH := x86_64
@@ -169,9 +173,8 @@ qemu: $(KERNEL_BZIMAGE)
-nographic \
-smp $(NR_CPUS) \
$(QEMU_MACHINE) \
+ $(QEMU_SERIAL_PORTS) \
-m 192M \
- -serial stdio \
- -serial file:$(BUILD_PATH)/result \
-no-reboot \
-monitor none \
-kernel $<
diff --git a/src/tests/qemu/arch/aarch64.config b/src/tests/qemu/arch/aarch64.config
index 7f46172..e5c54e3 100644
--- a/src/tests/qemu/arch/aarch64.config
+++ b/src/tests/qemu/arch/aarch64.config
@@ -1,4 +1,9 @@
-CONFIG_SERIAL_AMBA_PL011=y
-CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_PCI=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_HOST_COMMON=y
+CONFIG_PCI_HOST_GENERIC=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyAMA0 wg.success=ttyAMA1"
+CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
diff --git a/src/tests/qemu/arch/arm.config b/src/tests/qemu/arch/arm.config
index 0f39937..084cf60 100644
--- a/src/tests/qemu/arch/arm.config
+++ b/src/tests/qemu/arch/arm.config
@@ -2,7 +2,12 @@ CONFIG_MMU=y
CONFIG_ARCH_MULTI_V7=y
CONFIG_ARCH_VIRT=y
CONFIG_THUMB2_KERNEL=n
-CONFIG_SERIAL_AMBA_PL011=y
-CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_PCI=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_HOST_COMMON=y
+CONFIG_PCI_HOST_GENERIC=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyAMA0 wg.success=ttyAMA1"
+CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"