Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp107210rwo; Tue, 1 Aug 2023 13:48:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFynCFAX/ocWfBoFWsO6YBLOBBUYND4re630tpjV7IfOWFVe3Yy0f3Ar/FruMM+GMDFiTBy X-Received: by 2002:a17:907:760d:b0:99b:f3d1:7735 with SMTP id jx13-20020a170907760d00b0099bf3d17735mr3102213ejc.29.1690922908944; Tue, 01 Aug 2023 13:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690922908; cv=none; d=google.com; s=arc-20160816; b=nkWNoQGMZvsxTdO4XFuhehE4PsKbBEwGHRaTm/FslBn7xVRJLvDDrbkWJ1N5jdS45f 11IWRwXEFENoIkZ2ZjdgSRS1LUZpxQArFPWp+9BwjAeOz+1S0CsPZlTnha1FTp7YQStx FcMvgK64ixSPsF1TV4QktBX/7RkQ0pXGft7Ck3x5WDo09K1RaaMscfjCU4zTuN3p2zLD QhcZYSt/1c26OAu2k6/xospu1Io98TTfQ74TvCG/wvqESpEVu5OH+0kT2pWn1G5RrV4M 4Puh0F9MsRXdEMSXIFBPTDNWEhREW1xsy7X2p6v1SiNAFvkfZvrvTFqQpQ3c9PXq3CYf WCkw== 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=3iRDA/TJ52flmUTD/zZx0Bwn4tmszic9Q0Al2AA/U/U=; fh=7VEAlmh5C0HpP6zqTCNK3j6ZHP9gC5nJSc+EpvArsOo=; b=z2AsyPOPc9o8nYYPEQfBiAUyC4omJhPKNJB7Z+g8g+6FGsWQpRYjHihryd6x0K98fq JVsfEzF1sYAbvaox+0pqTp5PEjfTuWvVUQsyjZ8JeZNOgCZYf+x7fGf2jXJGUfcdZCgk pKePax/8JVvUTC++5tPzYEIY357DWyqI9dM/nDBweAbcdKyXwhdv1bj7vWhSTFcFT29q LAbsYu53h0y0hE9hCwDp/nM2kpUn8y+5u0gLU3ledZDuQ/iXujH4TfumWpIlUgQPcpKN JiZlQvoW15UIt5AkBf/5wEYnGroqADtbQDqAhzlD6I1KurzkzBcL2VO8O/5D3rXWn56C NP9g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020a170906689500b00992b9bf21casi8198838ejr.445.2023.08.01.13.48.03; Tue, 01 Aug 2023 13:48:28 -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 S231206AbjHATmo (ORCPT + 99 others); Tue, 1 Aug 2023 15:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjHATmo (ORCPT ); Tue, 1 Aug 2023 15:42:44 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A669B4; Tue, 1 Aug 2023 12:42:42 -0700 (PDT) X-QQ-mid: bizesmtp90t1690918952tllk1j5k Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 02 Aug 2023 03:42:31 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: ZTnzshg2nJY+dbg7dnU05oGs2oZJoFlj5DwKG4YmNlZjegD8qfswfCMygHPoE L10ipiSo21DO+0w3EvFmwlg0uJuV4b7xGHEzGgCpBvgE+5PfkniSob14/D3lbBZrcVUPDK7 6AIyA9GE/1RUDjjkrJp3ZrlAkquUd/B0Uida7DV8vwoFLVf7NGwobAca8DpHJIJYUmYH3RE bLyuVu9jN3a16t89QTWcrwGzAmZS5jyXXy1ITQRWTy4HCNdr9gtP7HYZBE4HVobUBEuzKuM zC/pSp69bdqF9i8x+o/QyR+jA3HutSxsS5ISBLW/Jj9lYTw0gb42U9yq+oTgZTMYugxvU1h D++AQN6bc91ufgdmqekKlk8f30RDGBtrt//aIJZCHh8ifQJDPtPYb3OqUoVBTj2xIyH3Z9V X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17612294270200470935 From: Zhangjin Wu To: thomas@t-8ch.de Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, w@1wt.eu, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Subject: [PATCH v4 06/12] selftests/nolibc: add nolibc-test-config target Date: Wed, 2 Aug 2023 03:42:31 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 The default DEFCONFIG_ of some architectures may not just work for nolibc test, some require extra kernel config options to enable features like console for print. To make nolibc-test happy, a new nolibc-test-config target is added with a new NOLIBC_TEST_CONFIG macro. The macro allows store extra common options via nolibc-test-common.config and the ones by architecture (or variant) via nolibc-test-$(XARCH).config. During the nolibc-test-config target, the above extra options will be appended to .config generated by the old DEFCONFIG_ target or by another config target specified via the CONFIG variable (e.g. tinyconfig). At last, the 'allnoconfig' target is called with the .config as the base to let them take effect and let new missing symbols as no. The scripts/kconfig/merge_config.sh tool is used to merge the extra config files listed in NOLIBC_TEST_CONFIG. Suggested-by: Thomas Weißschuh Link: https://lore.kernel.org/lkml/67eb70d4-c9ff-4afc-bac7-7f36cc2c81bc@t-8ch.de/ Link: https://lore.kernel.org/lkml/74f6a3b5-666c-41e9-a3d5-0ed5457f20f5@t-8ch.de/ Suggested-by: Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230730061801.GA7690@1wt.eu/#t Reviewed-by: Thomas Weißschuh Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 7902b86911a5..f01b258ef19b 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -63,6 +63,10 @@ DEFCONFIG_s390 = defconfig DEFCONFIG_loongarch = defconfig DEFCONFIG = $(DEFCONFIG_$(XARCH)) +# extra configs/ files appended to .config during the nolibc-test-config target +# include common + architecture specific +NOLIBC_TEST_CONFIG = nolibc-test-common.config nolibc-test-$(XARCH).config + # optional tests to run (default = all) TEST = @@ -192,8 +196,22 @@ MAKE_KERNEL = $(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROS KERNEL_CONFIG = $(objtree)/.config KERNEL_IMAGE = $(objtree)/$(IMAGE) -defconfig: - $(Q)$(MAKE_KERNEL) mrproper $(DEFCONFIG) prepare +# kernel config for nolibc-test +# +# - delete the current configuration and all generated files via 'mrproper' target +# - generate .config via '$(CONFIG)' or '$(DEFCONFIG_$(XARCH))' target +# - merge extra config options from $(NOLIBC_TEST_CONFIG) files to .config +# - use merged .config as base and fills in any missing symbols with '# CONFIG_* is not set' via 'allnoconfig' target +# - prepare things we need to do before we recursively start building the kernel via 'prepare' target +# +nolibc-test-config: + $(Q)$(MAKE_KERNEL) mrproper + $(Q)$(MAKE_KERNEL) $(or $(CONFIG),$(DEFCONFIG)) + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -Q -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(NOLIBC_TEST_CONFIG),$(wildcard $(CURDIR)/configs/$c)) + $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG=$(KERNEL_CONFIG) allnoconfig + $(Q)$(MAKE_KERNEL) prepare + +defconfig: nolibc-test-config kernel: initramfs $(Q)$(MAKE_KERNEL) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs -- 2.25.1