[PATCH v2 5/7] selftests/nolibc: customize CROSS_COMPILE for all architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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)
-- 
2.25.1




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux