diff mbox series

[v2,7/7] selftests/nolibc: allow use cross toolchains from software repository

Message ID b06de47989e3138de3d178da0d705ad6560924ec.1691783604.git.falcon@tinylab.org
State New
Headers show
Series selftests/nolibc: customize CROSS_COMPILE for all supported architectures | expand

Commit Message

Zhangjin Wu Aug. 11, 2023, 8:34 p.m. UTC
This allows users to install and use cross toolchains from local
software repositories.

The prefixes of local cross toolchains are appended to the
CROSS_COMPILE_$(XARCH) list, cc-cross-prefix is called to search this
list and return the first <prefix> where a <prefix>gcc is found in PATH.

Since different distributions have different prefixes, here only adds
the frequently used ones.

To use more prefixes not listed in Makefile, please put the lines as
following in your script and load it with a 'source' command:

    export CROSS_COMPILE_i386="x86_64-linux-"
    export CROSS_COMPILE_x86_64="x86_64-linux-"
    export CROSS_COMPILE_x86="x86_64-linux-"
    export CROSS_COMPILE_arm64="aarch64-linux-"
    export CROSS_COMPILE_arm="arm-linux-gnueabi-"
    export CROSS_COMPILE_mips="mips64-linux-"
    export CROSS_COMPILE_ppc="powerpc64-linux-"
    export CROSS_COMPILE_ppc64="powerpc64-linux-"
    export CROSS_COMPILE_ppc64le="powerpc64-linux-"
    export CROSS_COMPILE_riscv="riscv64-linux-"
    export CROSS_COMPILE_s390="s390-linux-"
    export CROSS_COMPILE_loongarch="loongarch64-linux-"

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

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 7687988c780b..ef2507f12e24 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -59,24 +59,25 @@  IMAGE_NAME       = $(notdir $(IMAGE))
 # Notes,
 # - The small, newest and obtainable cross toolchains from [1] are recommended,
 #   Please download, decompress and add the bin/ path to 'PATH' env variable
+# - The frequently used prefixes are added for local cross toolchains
 # - 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_i386      ?= x86_64-linux- x86_64-linux-gnu-
+CROSS_COMPILE_x86_64    ?= x86_64-linux- x86_64-linux-gnu-
+CROSS_COMPILE_x86       ?= x86_64-linux- x86_64-linux-gnu-
+CROSS_COMPILE_arm64     ?= aarch64-linux- aarch64-linux-gnu-
+CROSS_COMPILE_arm       ?= arm-linux-gnueabi- arm-none-eabi-
+CROSS_COMPILE_mips      ?= mips64-linux- mips64el-linux-gnuabi64-
+CROSS_COMPILE_ppc       ?= powerpc64-linux- powerpc-linux-gnu-
+CROSS_COMPILE_ppc64     ?= powerpc64-linux- powerpc64le-linux-gnu-
+CROSS_COMPILE_ppc64le   ?= powerpc64-linux- powerpc64le-linux-gnu-
+CROSS_COMPILE_riscv     ?= riscv64-linux- riscv64-linux-gnu-
+CROSS_COMPILE_s390      ?= s390-linux- s390x-linux-gnu-
 CROSS_COMPILE_loongarch ?= loongarch64-linux-
-CROSS_COMPILE           ?= $(CROSS_COMPILE_$(XARCH))
+CROSS_COMPILE           ?= $(call cc-cross-prefix,$(CROSS_COMPILE_$(XARCH)))
 
 # Make CC is always prefixed with $(CROSS_COMPILE)
 include ../../../scripts/Makefile.include