From 1bc44ab88738351b8ab01b4730dba825810b4938 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 6 Sep 2024 16:12:20 +0200 Subject: wireguard: selftests: upgrade deps, toolchains, and add loongarch The older iproute2 doesn't build with newer musl due to not using the right header for basename(), so upgrade to the newer iproute2 so that we can later upgrade our underlying libc and toolchain; The older bash, iptables, and nmap won't build on loongarch, where we need a newer autoconf. For iptables and nmap, repackage after running autoreconf -i -f. We can also get newer compilers and libcs, while we're at it. Signed-off-by: Jason A. Donenfeld --- tools/testing/selftests/wireguard/qemu/Makefile | 28 +++++++++++++++------- .../wireguard/qemu/arch/loongarch64.config | 9 +++++++ 2 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 tools/testing/selftests/wireguard/qemu/arch/loongarch64.config diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile index 35856b11c143..1e5fbc9a89ff 100644 --- a/tools/testing/selftests/wireguard/qemu/Makefile +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -38,10 +38,10 @@ $(DISTFILES_PATH)/$(1): | $(4) endef $(eval $(call tar_download,IPERF,iperf,3.11,.tar.gz,https://downloads.es.net/pub/iperf/,de8cb409fad61a0574f4cb07eb19ce1159707403ac2dc01b5d175e91240b7e5f)) -$(eval $(call tar_download,BASH,bash,5.1.16,.tar.gz,https://ftp.gnu.org/gnu/bash/,5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558)) -$(eval $(call tar_download,IPROUTE2,iproute2,5.17.0,.tar.gz,https://www.kernel.org/pub/linux/utils/net/iproute2/,bda331d5c4606138892f23a565d78fca18919b4d508a0b7ca8391c2da2db68b9)) -$(eval $(call tar_download,IPTABLES,iptables,1.8.7,.tar.bz2,https://www.netfilter.org/projects/iptables/files/,c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0)) -$(eval $(call tar_download,NMAP,nmap,7.92,.tgz,https://nmap.org/dist/,064183ea642dc4c12b1ab3b5358ce1cef7d2e7e11ffa2849f16d339f5b717117)) +$(eval $(call tar_download,BASH,bash,5.2.32,.tar.gz,https://ftp.gnu.org/gnu/bash/,d3ef80d2b67d8cbbe4d3265c63a72c46f9b278ead6e0e06d61801b58f23f50b5)) +$(eval $(call tar_download,IPROUTE2,iproute2,6.9.0,.tar.gz,https://www.kernel.org/pub/linux/utils/net/iproute2/,32c2bed6929f81303f24623cc3392f6f867c0fe368b99933786110ad3f041e72)) +$(eval $(call tar_download,IPTABLES,iptables,1.8.10,.tar.gz,https://www.netfilter.org/projects/iptables/files/,52b0d4b472792faac30da9d783a16f947aaf1f0ce8c542bd99ada53fe897e2fa)) +$(eval $(call tar_download,NMAP,nmap,7.95,.tar.gz,https://nmap.org/dist/,52865e77196205649da0b0a71060c27683234fa6901fa3af1edc7bdf545649b9)) $(eval $(call tar_download,IPUTILS,iputils,s20190709,.tar.gz,https://github.com/iputils/iputils/archive/s20190709.tar.gz/#,a15720dd741d7538dd2645f9f516d193636ae4300ff7dbc8bfca757bf166490a)) $(eval $(call tar_download,WIREGUARD_TOOLS,wireguard-tools,1.0.20210914,.tar.xz,https://git.zx2c4.com/wireguard-tools/snapshot/,97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac)) @@ -248,21 +248,31 @@ QEMU_MACHINE := -cpu host,accel=kvm -machine s390-ccw-virtio -append $(KERNEL_CM else QEMU_MACHINE := -cpu max -machine s390-ccw-virtio -append $(KERNEL_CMDLINE) endif +else ifeq ($(ARCH),loongarch64) +CHOST := loongarch64-linux-musl +QEMU_ARCH := loongarch64 +KERNEL_ARCH := loongarch +KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/loongarch/boot/vmlinux.elf +ifeq ($(HOST_ARCH),$(ARCH)) +QEMU_MACHINE := -cpu host,accel=kvm -machine virt,acpi=off +else +QEMU_MACHINE := -cpu max -machine virt,acpi=off +endif else ifeq ($(ARCH),um) CHOST := $(HOST_ARCH)-linux-musl KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux KERNEL_ARCH := um KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMDLINE=\(.*\)/\1/p' arch/um.config) else -$(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x, um) +$(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x, loongarch64, um) endif TOOLCHAIN_FILENAME := $(CHOST)-cross.tgz TOOLCHAIN_TAR := $(DISTFILES_PATH)/$(TOOLCHAIN_FILENAME) TOOLCHAIN_PATH := $(BUILD_PATH)/$(CHOST)-cross -TOOLCHAIN_DIR := https://download.wireguard.com/qemu-test/toolchains/20211123/ -$(eval $(call file_download,toolchain-sha256sums-20211123,$(TOOLCHAIN_DIR)SHA256SUMS#,83da033fd8c798df476c21d9612da2dfb896ec62fbed4ceec5eefc0e56b3f0c8)) -$(eval $(call file_download,$(TOOLCHAIN_FILENAME),$(TOOLCHAIN_DIR),,$(DISTFILES_PATH)/toolchain-sha256sums-20211123)) +TOOLCHAIN_DIR := https://download.wireguard.com/qemu-test/toolchains/20240917/ +$(eval $(call file_download,toolchain-sha256sums-20240917,$(TOOLCHAIN_DIR)SHA256SUMS#,8734e12f7a5910c47603362c5bcfd62fd917e231508963d3740669c3fbc26d9d)) +$(eval $(call file_download,$(TOOLCHAIN_FILENAME),$(TOOLCHAIN_DIR),,$(DISTFILES_PATH)/toolchain-sha256sums-20240917)) STRIP := $(CHOST)-strip CROSS_COMPILE_FLAG := --build=$(CBUILD) --host=$(CHOST) @@ -409,7 +419,7 @@ $(BASH_PATH)/bash: | $(BASH_PATH)/.installed $(USERSPACE_DEPS) $(IPROUTE2_PATH)/.installed: $(IPROUTE2_TAR) mkdir -p $(BUILD_PATH) flock -s $<.lock tar -C $(BUILD_PATH) -xf $< - printf 'CC:=$(CC)\nPKG_CONFIG:=pkg-config\nTC_CONFIG_XT:=n\nTC_CONFIG_ATM:=n\nTC_CONFIG_IPSET:=n\nIP_CONFIG_SETNS:=y\nHAVE_ELF:=n\nHAVE_MNL:=n\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCFLAGS+=-DHAVE_SETNS -DHAVE_HANDLE_AT\n' > $(IPROUTE2_PATH)/config.mk + printf 'CC:=$(CC)\nPKG_CONFIG:=pkg-config\nTC_CONFIG_XT:=n\nTC_CONFIG_ATM:=n\nTC_CONFIG_IPSET:=n\nIP_CONFIG_SETNS:=y\nHAVE_ELF:=n\nHAVE_MNL:=n\nHAVE_BERKELEY_DB:=n\nHAVE_LATEX:=n\nHAVE_PDFLATEX:=n\nCONF_COLOR:=COLOR_OPT_NEVER\nCFLAGS+=-DHAVE_SETNS -DHAVE_HANDLE_AT\n' > $(IPROUTE2_PATH)/config.mk printf 'libutil.a.done:\n\tflock -x $$@.lock $$(MAKE) -C lib\n\ttouch $$@\nip/ip: libutil.a.done\n\t$$(MAKE) -C ip ip\nmisc/ss: libutil.a.done\n\t$$(MAKE) -C misc ss\n' >> $(IPROUTE2_PATH)/Makefile touch $@ diff --git a/tools/testing/selftests/wireguard/qemu/arch/loongarch64.config b/tools/testing/selftests/wireguard/qemu/arch/loongarch64.config new file mode 100644 index 000000000000..23a522c8317c --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/loongarch64.config @@ -0,0 +1,9 @@ +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_CPU_HAS_LSX=y +CONFIG_CPU_HAS_LASX=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1" +CONFIG_CMDLINE_FORCE=y -- cgit v1.3-3-g829e