diff mbox series

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

Message ID a5deb231269cff5225be8331888fbea19337d5f9.1691783604.git.falcon@tinylab.org (mailing list archive)
State New
Headers show
Series selftests/nolibc: customize CROSS_COMPILE for all supported architectures | expand

Commit Message

Zhangjin Wu Aug. 11, 2023, 8:32 p.m. UTC
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(+)

Comments

Willy Tarreau Aug. 13, 2023, 9:16 a.m. UTC | #1
On Sat, Aug 12, 2023 at 04:32:41AM +0800, Zhangjin Wu wrote:
> +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-

Given that we don't support mips64, I'd suggest to ust mips-linux-
instead here for now. That doesn't seem right to ask users to
download a toolchain for a different architecture than the one
supported just because we can adapt to it.

Willy
Zhangjin Wu Aug. 13, 2023, 10:18 a.m. UTC | #2
> On Sat, Aug 12, 2023 at 04:32:41AM +0800, Zhangjin Wu wrote:
> > +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-
> 
> Given that we don't support mips64, I'd suggest to ust mips-linux-
> instead here for now. That doesn't seem right to ask users to
> download a toolchain for a different architecture than the one
> supported just because we can adapt to it.
>

Agree very much, and the one below from patch 7/7 [1]:

    +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-

It should be:

    +CROSS_COMPILE_mips      ?= mips-linux- mips-linux-gnu-gcc

And if necessary, the mips64-linux- line in the commit message of [1] should be
corrected too.

Thanks very much!

Best regards,
Zhangjin
[1]: https://lore.kernel.org/lkml/b06de47989e3138de3d178da0d705ad6560924ec.1691783604.git.falcon@tinylab.org/

> Willy
Willy Tarreau Aug. 14, 2023, 7:16 a.m. UTC | #3
On Sun, Aug 13, 2023 at 06:18:05PM +0800, Zhangjin Wu wrote:
> > Given that we don't support mips64, I'd suggest to ust mips-linux-
> > instead here for now. That doesn't seem right to ask users to
> > download a toolchain for a different architecture than the one
> > supported just because we can adapt to it.
> >
> 
> Agree very much, and the one below from patch 7/7 [1]:
> 
>     +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-
> 
> It should be:
> 
>     +CROSS_COMPILE_mips      ?= mips-linux- mips-linux-gnu-gcc
> 
> And if necessary, the mips64-linux- line in the commit message of [1] should be
> corrected too.

I just did that (and fixed mips-linux-gnu- instead of mips-linux-gnu-gcc
above).

Thanks,
Willy
diff mbox series

Patch

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)