This simplifies the 'make' commands for nolibc supported architectures, only requires the XARCH option now.
As suggested by Willy, the small, newest and obtainable cross toolchains from [1] are customized by default, users must download, decompress and configure the bin/ path to the PATH environment variable manually.
If still want to use a cross toolchain from local software repositories, we can also pass CROSS_COMPILE, CROSS_COMPILE_$(XARCH) or even CC from command line.
After carefully install and configure $(CROSS_COMPILE_$(XARCH)), qemu-system-$(XARCH) and qemu-$(XARCH), it is able to run tests for the architectures or their variants like this:
$ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390 loongarch" $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make defconfig run XARCH=$arch | grep status; done
[1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/
Signed-off-by: Zhangjin Wu falcon@tinylab.org --- tools/testing/selftests/nolibc/Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 5aff60d31d72..9a787fdf9842 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -55,6 +55,27 @@ IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE))
# CROSS_COMPILE: cross toolchain prefix by architecture +# +# Notes, +# - The small, newest and obtainable cross toolchains from [1] are recommended, +# Please download, decompress and add the bin/ path to 'PATH' env variable +# - To use another cross compiler, pass 'CROSS_COMPLE', 'CROSS_COMPILE_$(XARCH)' +# by variant or even 'CC' from command line +# +# [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ + +CROSS_COMPILE_i386 ?= x86_64-linux- +CROSS_COMPILE_x86_64 ?= x86_64-linux- +CROSS_COMPILE_x86 ?= x86_64-linux- +CROSS_COMPILE_arm64 ?= aarch64-linux- +CROSS_COMPILE_arm ?= arm-linux-gnueabi- +CROSS_COMPILE_mips ?= mips64-linux- +CROSS_COMPILE_ppc ?= powerpc64-linux- +CROSS_COMPILE_ppc64 ?= powerpc64-linux- +CROSS_COMPILE_ppc64le ?= powerpc64-linux- +CROSS_COMPILE_riscv ?= riscv64-linux- +CROSS_COMPILE_s390 ?= s390-linux- +CROSS_COMPILE_loongarch ?= loongarch64-linux- CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH))
# Make CC is always prefixed with $(CROSS_COMPILE)