Message ID | cover.1691783604.git.falcon@tinylab.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1352940vqi; Fri, 11 Aug 2023 14:02:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFoqUs6+xbdoJ7J+rxqCBJ9RJHXepFYN0DgBMZEWsAxbz5EnC9LU26GtCQDKWldkXNgxEJ X-Received: by 2002:a17:906:2209:b0:99b:ed8d:de4 with SMTP id s9-20020a170906220900b0099bed8d0de4mr2770059ejs.20.1691787721822; Fri, 11 Aug 2023 14:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691787721; cv=none; d=google.com; s=arc-20160816; b=ljYwf0wfAJoPvfYRGdHHe5bJ7PzW/GXJ+Lt6k0zSCCrYovADz0nmnHmMh4fb2CugBE 1VnuJpUHWiHMNrtPthByrb9qUZsEJelXwql1OrBj7nIYPo+juPWoqucsv9+2FBoQDlmZ +n47BS31pZKWd8bJCCrSVpd/TE04ALlHyH8y2TiI1IUTix3/r+pT09QaMhdYTrLR3pe8 ME/IqxCfe3Er5t+Y7ICQ0sQaT5lCiPasamfov5u1pNCmD1nxq6zYzvRWh1MuPnVkacet sItcOf8ddUnfyoho4g4qKVqkn8eslkEVPKSFvsnKJDT5P0K6m4s6aaDkEZOnza84k+ha uNFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=02Y/rbskvNlMG/C78q9DtEsr1xLBc3+i125Gs6rRGyw=; fh=TU6hQn1B5Y8k90pL1QmmYKVn+55mITxuhuhy8Zthc4c=; b=uS2TBDJ5u0jAHr5vvaL9qyhMFZ9zTeu+UNAd6g2nhXxWSo/+VvlJokXrruwUmP7EZp LYOA3v7iehgBci29DlJJfRw9TRJ+ytTbzXCJZXpsfvjqysMhxr7Rmvpp3mg0pBPh3tBV yJ/gDZZstaTpT+Lp6uguAE0/5eESJAEMSwqbCosNfR2IEly84iW7Wk05Kkx3LkEWNguz uzQd0pvEKFXoXbuk9cao+B0wZ/lLcrych21CY4qV5SD3A/Y/VGkKlmSKRnuAMNyyS5+c 2slFXnY2hGBDR3Us9tYWIpIvASFFq+j9ph/RqQfJWyNq9hnRAL9TThpcoxiyWga3O9io rz7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id le1-20020a170907170100b0098d5b116e6fsi3874363ejc.856.2023.08.11.14.01.24; Fri, 11 Aug 2023 14:02:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234847AbjHKU1O (ORCPT <rfc822;lanlanxiyiji@gmail.com> + 99 others); Fri, 11 Aug 2023 16:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjHKU1N (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 16:27:13 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D56D3; Fri, 11 Aug 2023 13:27:10 -0700 (PDT) X-QQ-mid: bizesmtp82t1691785623tn8i0b23 Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:27:02 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: UMQM+3VOEYtGKY/+1RDGuawm8rkjGCQuCQAGJ2FUNUZ6aMw2+CvbuX2q1pE7b U7AvHo+/7jkvDO9464KN7cXxLY9djefK3Wm1D/aHAZdWeFyWFAv3Jn9tQflcFBTPV4WXWZb pyk8zg8lzDUuf/+U18j1RAgFluZGW6YgGxLKLIF7QSCYAVsvbaGqb72nCfseSem0fEip0xd pu61mSJHtbMQ1CkokRVgyBvKOtkpv8BTWspjL4OGeH+pAjaw2Z9f3cCqTU35s4e5JdHSOwF Ch7fODDhYFhonkpizP2dWZ9ZHM6frTZOlR5m5RJQK/XTJMFSQdc5TdoyZaY1K0oRCAByjgc 5tXQld38MLO4SWyGRN65EzM4sLoC4kuBdTp4Lep X-QQ-GoodBg: 0 X-BIZMAIL-ID: 13364104683118344947 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 0/7] selftests/nolibc: customize CROSS_COMPILE for all supported architectures Date: Sat, 12 Aug 2023 04:27:01 +0800 Message-Id: <cover.1691783604.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773968002359374831 X-GMAIL-MSGID: 1773968002359374831 |
Series |
selftests/nolibc: customize CROSS_COMPILE for all supported architectures
|
|
Message
Zhangjin Wu
Aug. 11, 2023, 8:27 p.m. UTC
Hi, Willy Here is v2 of the customized CROSS_COMPILE support, this helps a lot during the testing of the other cross-arch nolibc changes: $ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390" $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done Based on your suggestion, we did this changes: - The qemu notes patch [1] is removed, welcome your doc file ;-) - Arnd's crosstools are customized by default - Import cc-cross-prefix to support local cross toolchains too - Use mips64 toolchains for mips like x86_64 toolchains for i386, allow download less toolchains - Use HOSTCC for libc-test compiling Changes from v1 --> v2: * selftests/nolibc: allow use x86_64 toolchain for i386 No change. * selftests/nolibc: allow use mips64 toolchain for mips Allow download less toolchains, save time save storage space * selftests/nolibc: libc-test: use HOSTCC instead of CC libc-test is mainly for local test, use HOSTCC * selftests/nolibc: allow customize CROSS_COMPILE by architecture Moved the ../../../scripts/Makefile.include after our customized CROSS_COMPILE, to let it prefix CC with $(CROSS_COMPILE) for us. * selftests/nolibc: customize CROSS_COMPILE for all architectures Use Arnd's crosstools as the default ones * selftests/nolibc: import cc-cross-prefix macro selftests/nolibc: allow use cross toolchains from software repository Import cc-cross-prefix to allow customize a list of the cross compilers, the ones from local repositories are appended in. If already installed ones from local repos, why not use them, let's do it. Willy, since this series is really important to test the coming patchsets, I send it here before the others to simplify the testing, but we can delay its review, it is not urgent. And here [2] is the simple script I wrote to download, decompress and configure the PATH variable for Anrd's crosstools, hope it helps. Best regards, Zhangjin Wu --- [1]: https://lore.kernel.org/lkml/6de680acbc2d87e13a680d4453ef022568bf489b.1691263493.git.falcon@tinylab.org/ [2]: https://gitee.com/tinylab/linux-lab/blob/next/tools/nolibc/crosstool.sh v1: https://lore.kernel.org/lkml/cover.1691263493.git.falcon@tinylab.org/ Zhangjin Wu (7): selftests/nolibc: allow use x86_64 toolchain for i386 selftests/nolibc: allow use mips64 toolchain for mips selftests/nolibc: libc-test: use HOSTCC instead of CC selftests/nolibc: allow customize CROSS_COMPILE by architecture selftests/nolibc: customize CROSS_COMPILE for all architectures selftests/nolibc: import cc-cross-prefix macro selftests/nolibc: allow use cross toolchains from software repository tools/testing/selftests/nolibc/Makefile | 38 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-)
Comments
Hi Zhangjin, On Sat, Aug 12, 2023 at 04:27:01AM +0800, Zhangjin Wu wrote: > Hi, Willy > > Here is v2 of the customized CROSS_COMPILE support, this helps a lot > during the testing of the other cross-arch nolibc changes: > > $ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390" > $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done > > Based on your suggestion, we did this changes: > > - The qemu notes patch [1] is removed, welcome your doc file ;-) > - Arnd's crosstools are customized by default > - Import cc-cross-prefix to support local cross toolchains too > - Use mips64 toolchains for mips like x86_64 toolchains for i386, allow > download less toolchains > - Use HOSTCC for libc-test compiling (...) I think it's basically OK (just this mips64 thing). I've picked patch 3 already since it's a fix. Once we agree on what to do there, I can queue it if that helps (I can modify mips64- to mips- in the patch if that's OK for you, no need to resend for this, just let me know). I think that later I'll further extend XARCH with new variants to support ARMv5 and Thumb2, because we have different code for this and I continue to manually change the CFLAGS to test both. Thanks, Willy
Hi, Willy > Hi Zhangjin, > > On Sat, Aug 12, 2023 at 04:27:01AM +0800, Zhangjin Wu wrote: > > Hi, Willy > > > > Here is v2 of the customized CROSS_COMPILE support, this helps a lot > > during the testing of the other cross-arch nolibc changes: > > > > $ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390" > > $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done > > > > Based on your suggestion, we did this changes: > > > > - The qemu notes patch [1] is removed, welcome your doc file ;-) > > - Arnd's crosstools are customized by default > > - Import cc-cross-prefix to support local cross toolchains too > > - Use mips64 toolchains for mips like x86_64 toolchains for i386, allow > > download less toolchains > > - Use HOSTCC for libc-test compiling > (...) > > I think it's basically OK (just this mips64 thing). I've picked patch 3 > already since it's a fix. Once we agree on what to do there, I can queue > it if that helps (I can modify mips64- to mips- in the patch if that's > OK for you, no need to resend for this, just let me know). > It is ok for me, thanks ;-) I thought somebody may add mips64 support soon, but we do only have mips currently, it is fair to not use mips64 toolchain. > I think that later I'll further extend XARCH with new variants to > support ARMv5 and Thumb2, because we have different code for this > and I continue to manually change the CFLAGS to test both. > Ok, what about further add x86_64 as the default variant for x86 (like ppc for powerpc)? and then it is able to only resereve the variables for x86_64. I have prepared a patch for this goal in our new tinyconfig patchset, it will further avoid adding the same nolibc-test-x86.config and nolibc-test-x86_64.config. Best regards, Zhangjin > Thanks, > Willy
On Sun, Aug 13, 2023 at 06:05:03PM +0800, Zhangjin Wu wrote: > > I think that later I'll further extend XARCH with new variants to > > support ARMv5 and Thumb2, because we have different code for this > > and I continue to manually change the CFLAGS to test both. > > > > Ok, what about further add x86_64 as the default variant for x86 (like ppc for > powerpc)? and then it is able to only resereve the variables for x86_64. I have > prepared a patch for this goal in our new tinyconfig patchset, it will further > avoid adding the same nolibc-test-x86.config and nolibc-test-x86_64.config. I'm confused, x86 already defaults to x86_64, it's just that it depends on the .config itself to figure whether to produce a 32- or 64-bit kernel. But for example it starts qemu in 64-bit mode. Am I missing anything ? Willy
> On Sun, Aug 13, 2023 at 06:05:03PM +0800, Zhangjin Wu wrote: > > > I think that later I'll further extend XARCH with new variants to > > > support ARMv5 and Thumb2, because we have different code for this > > > and I continue to manually change the CFLAGS to test both. > > > > > > > Ok, what about further add x86_64 as the default variant for x86 (like ppc for > > powerpc)? and then it is able to only resereve the variables for x86_64. I have > > prepared a patch for this goal in our new tinyconfig patchset, it will further > > avoid adding the same nolibc-test-x86.config and nolibc-test-x86_64.config. > > I'm confused, x86 already defaults to x86_64, it's just that it depends > on the .config itself to figure whether to produce a 32- or 64-bit kernel. > But for example it starts qemu in 64-bit mode. Am I missing anything ? > In kernel side, it is, but in our nolibc-test, we have added a copy of x86_64 for x86: $ grep -E "_x86" tools/testing/selftests/nolibc/Makefile IMAGE_x86_64 = arch/x86/boot/bzImage IMAGE_x86 = arch/x86/boot/bzImage CROSS_COMPILE_x86_64 ?= x86_64-linux- x86_64-linux-gnu- CROSS_COMPILE_x86 ?= x86_64-linux- x86_64-linux-gnu- DEFCONFIG_x86_64 = defconfig DEFCONFIG_x86 = defconfig QEMU_ARCH_x86_64 = x86_64 QEMU_ARCH_x86 = x86_64 QEMU_ARGS_x86_64 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS_x86 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" With 'XARCH', the "_x86" copy of them can be simply replaced with such a line: # configure default variants for target kernel supported architectures XARCH_powerpc = ppc +XARCH_x86 = x86_64 XARCH = $(or $(XARCH_$(ARCH)),$(ARCH)) And therefore, the future nolibc-test-x86_64.config is also enough for x86. But I have seen the 'x86' exception in tools/include/nolibc/Makefile, just a confirm on if this replacement is ok. BR, Zhangjin > Willy
On Mon, Aug 14, 2023 at 03:38:54PM +0800, Zhangjin Wu wrote: > > On Sun, Aug 13, 2023 at 06:05:03PM +0800, Zhangjin Wu wrote: > > > > I think that later I'll further extend XARCH with new variants to > > > > support ARMv5 and Thumb2, because we have different code for this > > > > and I continue to manually change the CFLAGS to test both. > > > > > > > > > > Ok, what about further add x86_64 as the default variant for x86 (like ppc for > > > powerpc)? and then it is able to only resereve the variables for x86_64. I have > > > prepared a patch for this goal in our new tinyconfig patchset, it will further > > > avoid adding the same nolibc-test-x86.config and nolibc-test-x86_64.config. > > > > I'm confused, x86 already defaults to x86_64, it's just that it depends > > on the .config itself to figure whether to produce a 32- or 64-bit kernel. > > But for example it starts qemu in 64-bit mode. Am I missing anything ? > > > > In kernel side, it is, but in our nolibc-test, we have added a copy of x86_64 > for x86: > > $ grep -E "_x86" tools/testing/selftests/nolibc/Makefile > IMAGE_x86_64 = arch/x86/boot/bzImage > IMAGE_x86 = arch/x86/boot/bzImage > CROSS_COMPILE_x86_64 ?= x86_64-linux- x86_64-linux-gnu- > CROSS_COMPILE_x86 ?= x86_64-linux- x86_64-linux-gnu- > DEFCONFIG_x86_64 = defconfig > DEFCONFIG_x86 = defconfig > QEMU_ARCH_x86_64 = x86_64 > QEMU_ARCH_x86 = x86_64 > QEMU_ARGS_x86_64 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" > QEMU_ARGS_x86 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > With 'XARCH', the "_x86" copy of them can be simply replaced with such a line: > > # configure default variants for target kernel supported architectures > XARCH_powerpc = ppc > +XARCH_x86 = x86_64 > XARCH = $(or $(XARCH_$(ARCH)),$(ARCH)) > > And therefore, the future nolibc-test-x86_64.config is also enough for x86. > > But I have seen the 'x86' exception in tools/include/nolibc/Makefile, just a > confirm on if this replacement is ok. Ah I thought you meant the opposite, i.e. that ppc did map to powerpc that I was not seeing anywhere else. Yes we can probably do that and remove the x86-specific lines later. Willy
On Mon, Aug 14, 2023 at 10:25:00AM +0200, Willy Tarreau wrote: > On Mon, Aug 14, 2023 at 03:38:54PM +0800, Zhangjin Wu wrote: > > > On Sun, Aug 13, 2023 at 06:05:03PM +0800, Zhangjin Wu wrote: > > > > > I think that later I'll further extend XARCH with new variants to > > > > > support ARMv5 and Thumb2, because we have different code for this > > > > > and I continue to manually change the CFLAGS to test both. > > > > > > > > > > > > > Ok, what about further add x86_64 as the default variant for x86 (like ppc for > > > > powerpc)? and then it is able to only resereve the variables for x86_64. I have > > > > prepared a patch for this goal in our new tinyconfig patchset, it will further > > > > avoid adding the same nolibc-test-x86.config and nolibc-test-x86_64.config. > > > > > > I'm confused, x86 already defaults to x86_64, it's just that it depends > > > on the .config itself to figure whether to produce a 32- or 64-bit kernel. > > > But for example it starts qemu in 64-bit mode. Am I missing anything ? > > > > > > > In kernel side, it is, but in our nolibc-test, we have added a copy of x86_64 > > for x86: > > > > $ grep -E "_x86" tools/testing/selftests/nolibc/Makefile > > IMAGE_x86_64 = arch/x86/boot/bzImage > > IMAGE_x86 = arch/x86/boot/bzImage > > CROSS_COMPILE_x86_64 ?= x86_64-linux- x86_64-linux-gnu- > > CROSS_COMPILE_x86 ?= x86_64-linux- x86_64-linux-gnu- > > DEFCONFIG_x86_64 = defconfig > > DEFCONFIG_x86 = defconfig > > QEMU_ARCH_x86_64 = x86_64 > > QEMU_ARCH_x86 = x86_64 > > QEMU_ARGS_x86_64 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > QEMU_ARGS_x86 = -M pc -append "console=ttyS0,9600 i8042.noaux panic=-1 $(TEST:%=NOLIBC_TEST=%)" > > > > With 'XARCH', the "_x86" copy of them can be simply replaced with such a line: > > > > # configure default variants for target kernel supported architectures > > XARCH_powerpc = ppc > > +XARCH_x86 = x86_64 > > XARCH = $(or $(XARCH_$(ARCH)),$(ARCH)) > > > > And therefore, the future nolibc-test-x86_64.config is also enough for x86. > > > > But I have seen the 'x86' exception in tools/include/nolibc/Makefile, just a > > confirm on if this replacement is ok. > > Ah I thought you meant the opposite, i.e. that ppc did map to powerpc > that I was not seeing anywhere else. Yes we can probably do that and > remove the x86-specific lines later. by "later" I mean "further" in the file. Willy