From 6be4d32b26c0ff5603edb3067c18bbb96ddb302d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 25 Sep 2018 22:42:13 +0200 Subject: qemu: support more arm big endian platforms Signed-off-by: Jason A. Donenfeld --- src/tests/qemu/Makefile | 30 ++++++++++++++++++++++++++---- src/tests/qemu/arch/aarch64_be.config | 5 +++++ src/tests/qemu/arch/armeb.config | 12 ++++++++++++ src/tests/qemu/arch/i386.config | 4 ---- src/tests/qemu/arch/i686.config | 4 ++++ src/tests/qemu/arch/powerpc.config | 9 +++++++++ src/tests/qemu/arch/ppc.config | 9 --------- 7 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 src/tests/qemu/arch/aarch64_be.config create mode 100644 src/tests/qemu/arch/armeb.config delete mode 100644 src/tests/qemu/arch/i386.config create mode 100644 src/tests/qemu/arch/i686.config create mode 100644 src/tests/qemu/arch/powerpc.config delete mode 100644 src/tests/qemu/arch/ppc.config diff --git a/src/tests/qemu/Makefile b/src/tests/qemu/Makefile index 88ed0f5..9d4bfe9 100644 --- a/src/tests/qemu/Makefile +++ b/src/tests/qemu/Makefile @@ -60,6 +60,7 @@ $(eval $(call tar_download,NMAP,nmap,7.60,.tar.bz2,https://nmap.org/dist/)) $(eval $(call tar_download,IPUTILS,iputils,s20161105,.tar.gz,https://github.com/iputils/iputils/archive/s20161105.tar.gz/#)) export CFLAGS ?= -O3 -pipe +export LDFLAGS ?= export CPPFLAGS := -I$(BUILD_PATH)/include ifeq ($(CHOST),$(CBUILD)) @@ -86,6 +87,16 @@ else QEMU_MACHINE := -cpu cortex-a53 -machine virt CFLAGS += -march=armv8-a -mtune=cortex-a53 endif +else ifeq ($(ARCH),aarch64_be) +QEMU_ARCH := aarch64 +KERNEL_ARCH := arm64 +KERNEL_BZIMAGE := $(KERNEL_PATH)/arch/arm64/boot/Image +ifeq ($(CHOST),$(CBUILD)) +QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm +else +QEMU_MACHINE := -cpu cortex-a53 -machine virt +CFLAGS += -march=armv8-a -mtune=cortex-a53 +endif else ifeq ($(ARCH),arm) QEMU_ARCH := arm KERNEL_ARCH := arm @@ -96,6 +107,17 @@ else QEMU_MACHINE := -cpu cortex-a15 -machine virt CFLAGS += -march=armv7-a -mtune=cortex-a15 -mabi=aapcs-linux endif +else ifeq ($(ARCH),armeb) +QEMU_ARCH := arm +KERNEL_ARCH := arm +KERNEL_BZIMAGE := $(KERNEL_PATH)/arch/arm/boot/zImage +ifeq ($(CHOST),$(CBUILD)) +QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm +else +QEMU_MACHINE := -cpu cortex-a15 -machine virt +CFLAGS += -march=armv7-a -mabi=aapcs-linux # We don't pass -mtune=cortex-a15 due to a compiler bug on big endian. +LDFLAGS += -Wl,--be8 +endif else ifeq ($(ARCH),x86_64) QEMU_ARCH := x86_64 KERNEL_ARCH := x86_64 @@ -171,7 +193,7 @@ QEMU_MACHINE := -machine ppce500 endif CFLAGS += -mcpu=powerpc -mlong-double-64 -msecure-plt else -$(error I only build: x86_64, i686, arm, aarch64, mips, mipsel, mips64, mips64el, powerpc) +$(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc) endif REAL_CC := $(CBUILD)-gcc @@ -236,10 +258,10 @@ always-pull: $(KERNEL_PATH)/.installed $(KERNEL_BZIMAGE): always-pull endif -$(KERNEL_PATH)/.config: kernel.config arch/$(QEMU_ARCH).config | $(KERNEL_PATH)/.installed +$(KERNEL_PATH)/.config: kernel.config arch/$(ARCH).config | $(KERNEL_PATH)/.installed cp kernel.config $(KERNEL_PATH)/minimal.config printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_PATH)/minimal.config - cat arch/$(QEMU_ARCH).config >> $(KERNEL_PATH)/minimal.config + cat arch/$(ARCH).config >> $(KERNEL_PATH)/minimal.config $(MAKE) -C $(KERNEL_PATH) ARCH=$(KERNEL_ARCH) allnoconfig cd $(KERNEL_PATH) && ARCH=$(KERNEL_ARCH) scripts/kconfig/merge_config.sh -n .config minimal.config $(if $(findstring -debug,$(KERNEL_VERSION)),cd $(KERNEL_PATH) && sed -i 's/^EXTRAVERSION =.*/EXTRAVERSION = -debug/' Makefile && ARCH=$(KERNEL_ARCH) scripts/kconfig/merge_config.sh -n .config $(PWD)/debug.config,) @@ -297,7 +319,7 @@ $(BUILD_PATH)/tools/wg: $(TOOLS_SOURCES) | $(LIBMNL_PATH)/src/.libs/libmnl.a $(U $(BUILD_PATH)/init: init.c | $(USERSPACE_DEPS) mkdir -p $(BUILD_PATH) - $(MUSL_CC) -o $@ $(CFLAGS) -std=gnu11 $< + $(MUSL_CC) -o $@ $(CFLAGS) $(LDFLAGS) -std=gnu11 $< $(STRIP) -s $@ $(IPUTILS_PATH)/.installed: $(IPUTILS_TAR) diff --git a/src/tests/qemu/arch/aarch64_be.config b/src/tests/qemu/arch/aarch64_be.config new file mode 100644 index 0000000..8dc91c2 --- /dev/null +++ b/src/tests/qemu/arch/aarch64_be.config @@ -0,0 +1,5 @@ +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyAMA0 wg.success=ttyAMA1" diff --git a/src/tests/qemu/arch/armeb.config b/src/tests/qemu/arch/armeb.config new file mode 100644 index 0000000..b699465 --- /dev/null +++ b/src/tests/qemu/arch/armeb.config @@ -0,0 +1,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_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyAMA0 wg.success=ttyAMA1" +CONFIG_CPU_BIG_ENDIAN=y + +# Remove me for 4.20/5.0. This is just a dirty hack to allow CPU_BIG_ENDIAN. +CONFIG_ARCH_HIGHBANK=y diff --git a/src/tests/qemu/arch/i386.config b/src/tests/qemu/arch/i386.config deleted file mode 100644 index ed1e701..0000000 --- a/src/tests/qemu/arch/i386.config +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1" diff --git a/src/tests/qemu/arch/i686.config b/src/tests/qemu/arch/i686.config new file mode 100644 index 0000000..ed1e701 --- /dev/null +++ b/src/tests/qemu/arch/i686.config @@ -0,0 +1,4 @@ +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1" diff --git a/src/tests/qemu/arch/powerpc.config b/src/tests/qemu/arch/powerpc.config new file mode 100644 index 0000000..8ec5911 --- /dev/null +++ b/src/tests/qemu/arch/powerpc.config @@ -0,0 +1,9 @@ +CONFIG_PPC_QEMU_E500=y +CONFIG_FSL_SOC_BOOKE=y +CONFIG_PPC_85xx=y +CONFIG_PHYS_64BIT=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_MATH_EMULATION=y +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1" diff --git a/src/tests/qemu/arch/ppc.config b/src/tests/qemu/arch/ppc.config deleted file mode 100644 index 8ec5911..0000000 --- a/src/tests/qemu/arch/ppc.config +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_PPC_QEMU_E500=y -CONFIG_FSL_SOC_BOOKE=y -CONFIG_PPC_85xx=y -CONFIG_PHYS_64BIT=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_MATH_EMULATION=y -CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1" -- cgit v1.2.3