All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: falcon@tinylab.org, w@1wt.eu
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	tanyuan@tinylab.org, thomas@t-8ch.de
Subject: [PATCH v2 5/7] selftests/nolibc: customize CROSS_COMPILE for all architectures
Date: Sat, 12 Aug 2023 04:32:41 +0800	[thread overview]
Message-ID: <a5deb231269cff5225be8331888fbea19337d5f9.1691783604.git.falcon@tinylab.org> (raw)
In-Reply-To: <cover.1691783604.git.falcon@tinylab.org>

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


  parent reply	other threads:[~2023-08-11 20:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 20:27 [PATCH v2 0/7] selftests/nolibc: customize CROSS_COMPILE for all supported architectures Zhangjin Wu
2023-08-11 20:28 ` [PATCH v2 1/7] selftests/nolibc: allow use x86_64 toolchain for i386 Zhangjin Wu
2023-08-11 20:29 ` [PATCH v2 2/7] selftests/nolibc: allow use mips64 toolchain for mips Zhangjin Wu
2023-08-11 20:30 ` [PATCH v2 3/7] selftests/nolibc: libc-test: use HOSTCC instead of CC Zhangjin Wu
2023-08-13  9:19   ` Willy Tarreau
2023-08-11 20:31 ` [PATCH v2 4/7] selftests/nolibc: allow customize CROSS_COMPILE by architecture Zhangjin Wu
2023-08-11 20:32 ` Zhangjin Wu [this message]
2023-08-13  9:16   ` [PATCH v2 5/7] selftests/nolibc: customize CROSS_COMPILE for all architectures Willy Tarreau
2023-08-13 10:18     ` Zhangjin Wu
2023-08-14  7:16       ` Willy Tarreau
2023-08-11 20:33 ` [PATCH v2 6/7] selftests/nolibc: import cc-cross-prefix macro Zhangjin Wu
2023-08-11 20:34 ` [PATCH v2 7/7] selftests/nolibc: allow use cross toolchains from software repository Zhangjin Wu
2023-08-13  9:37 ` [PATCH v2 0/7] selftests/nolibc: customize CROSS_COMPILE for all supported architectures Willy Tarreau
2023-08-13 10:05   ` Zhangjin Wu
2023-08-14  7:18     ` Willy Tarreau
2023-08-14  7:38       ` Zhangjin Wu
2023-08-14  8:25         ` Willy Tarreau
2023-08-14  8:25           ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5deb231269cff5225be8331888fbea19337d5f9.1691783604.git.falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=tanyuan@tinylab.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.