diff mbox series

[v1,19/22] selftests/nolibc: config default CROSS_COMPILE

Message ID 0ef9f42e04b8b62b8d53c0f3106f5e50629e01d5.1687706332.git.falcon@tinylab.org (mailing list archive)
State New
Headers show
Series selftests/nolibc: add minimal kernel config support | expand

Commit Message

Zhangjin Wu June 25, 2023, 4:39 p.m. UTC
This further simplify the 'make' commands, only require an ARCH now.

Almost all distributions provide toolchains for i386, x86_64, arm64,
arm, mips, riscv32, riscv64 and s390x.

If can not find toolchains from the distribution repositories, we can
download them from https://mirrors.edge.kernel.org/pub/tools/crosstool/
and then customize CROSS_COMPILE_<ARCH> for the testing.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/testing/selftests/nolibc/Makefile | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 9092d209ebd0..a847a2264fed 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -74,6 +74,25 @@  EXTCONFIG_ARCH       = $(EXTCONFIG_$(ARCH))
 # extra kernel configs, include common + architecture specific
 EXTCONFIG            = $(EXTCONFIG_ARCH) $(EXTCONFIG_COMMON)
 
+# CROSS_COMPILE by architecture
+CROSS_COMPILE_i386      ?= x86_64-linux-gnu-
+CROSS_COMPILE_x86_64    ?= x86_64-linux-gnu-
+CROSS_COMPILE_x86       ?= x86_64-linux-gnu-
+CROSS_COMPILE_arm64     ?= aarch64-linux-gnu-
+CROSS_COMPILE_arm       ?= arm-linux-gnueabi-
+CROSS_COMPILE_mips      ?= mipsel-linux-gnu-
+CROSS_COMPILE_riscv32   ?= riscv64-linux-gnu-
+CROSS_COMPILE_riscv64   ?= riscv64-linux-gnu-
+CROSS_COMPILE_riscv     ?= riscv64-linux-gnu-
+CROSS_COMPILE_s390      ?= s390x-linux-gnu-
+CROSS_COMPILE_loongarch ?= loongarch64-linux-
+CROSS_COMPILE           ?= $(CROSS_COMPILE_$(ARCH))
+
+# Make sure CC has $(CROSS_COMPILE) prefix
+ifneq ($(CC),$(CROSS_COMPILE)$(CC))
+CC                      := $(CROSS_COMPILE)$(CC)
+endif
+
 # optional tests to run (default = all)
 TEST =