From patchwork Fri Aug 11 20:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 134679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1344681vqi; Fri, 11 Aug 2023 13:43:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJqIQv2k0BAMXv+FAKtUITpHUw68+/Xc6jASHkGAuFVx3uV4oh+gXKsH77mSuiUxBgTxQJ X-Received: by 2002:a05:6300:8003:b0:140:f1d2:4fc with SMTP id an3-20020a056300800300b00140f1d204fcmr2389233pzc.45.1691786593695; Fri, 11 Aug 2023 13:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691786593; cv=none; d=google.com; s=arc-20160816; b=SVwZ5H7spsTmxqcpOeKpgkF1nK4wSZGkpHJM09g9gqklGJ5E6t2ak/Nf/DYLLnkYXb mX7NW8TGVcDCRXxK4UiVCZFO/NBawwsqdGwqwsGOyTOlTvei+8ZmAJ4mp8N/QU3GM1MC m2+zSocL74zKcmbhZG0O5YpwiEeOWAmtWCuHyvoNX4QW79A3NxjoBY3sWBHFlfWZF502 nzkGydqlmf8gpMZf3nl4BbkFG/GQI4HJZNEjp7GNeDSUo6fvt/rqKJw2++Hun5b6rZ1i 8QjiLws7I6qJeF7P7tTNS6mlA8dkY6CBHw/GnVfI+jrHgNNsXgR47Jwh7FYO9JL066Ij OpZQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=mKNgOYhtePdO2X4Kbn3wwSVufJ+b2ByZ3goZIR6RMwA=; fh=TU6hQn1B5Y8k90pL1QmmYKVn+55mITxuhuhy8Zthc4c=; b=Oho1J7DA+auFnJxGacGv9Bf8jfnmiaGwD5FomczjGYcuTdjYdtbVCUOlZIqvGE0zG2 wpVK2Cm2u6+U7kogFqwWUcoSCaAdq+Gx2p5B9UcU9n+XIunVFQZyANImSf01swrYn25N 9WYzcQLdAAxweY5x1aNH2CcxDrRfdK2ZzU3+8GBPde1kdAKBU1cvgB8du5p4aLzoz9jp jRnXxcgbwplHbsOy6vkLiMy8E7p32uYLqy7cijf0hyHPfh66Yzu+KIUHP0eSCrfUitAh ixxuDYu26EBjlrHvtj+Mimvz3YE2OljGx+PT47WsbsPC6eY5ivikw3qSMPpyxdPGsMc2 uDdw== 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 d13-20020a056a00198d00b006546d0d5832si3993616pfl.183.2023.08.11.13.43.00; Fri, 11 Aug 2023 13:43:13 -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 S236635AbjHKUcu (ORCPT + 99 others); Fri, 11 Aug 2023 16:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbjHKUct (ORCPT ); Fri, 11 Aug 2023 16:32:49 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60B6518E; Fri, 11 Aug 2023 13:32:48 -0700 (PDT) X-QQ-mid: bizesmtp74t1691785963tp54ggzl Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:32:42 +0800 (CST) X-QQ-SSF: 01200000002000E0X000B00A0000000 X-QQ-FEAT: +ynUkgUhZJmk+CmCBh8hIWz7kAw/TgBO6SK/g3i3wf3qZL1DjYMFDwQpLi61w QrkXy+r9OW+Wp8HSnO76LSPbMqIxJjDmNxbqur9WbAzA3u7JISFeDOMqkoP3lHEJ5IP2KxM Du26jloWTDgWRPDhYE9/4HWirH0fMkbvCfL6EZ4wPf1cb1JvrsIes1wxcxn+68Xbnmu9pBm JBvPHO54FvcVguAcMFURVp9vMhRE+3Sup3pat94nDCP8/cuAjBJyVjiUf4sdc1e0jTUU72q ZHXX5VNPFOTFwHQFW0QQSWlDlbAtn7Fs9uuxyDN6eN+WKgB8Cc9BC04muM4DpmI77vTSL51 X36+B3RYg6jr9B7+XZHLHVdQVUpSRMk/2cCM/Vxow6BufaIvYaRRIrp0jrcH82VKkxt6/yf X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10532850792558521576 From: Zhangjin Wu 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 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773966819304900408 X-GMAIL-MSGID: 1773966819304900408 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 --- 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)