Message ID | ecd5cd252bc728df1becfebff772713e8edce1ec.1689713175.git.falcon@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2015207vqt; Tue, 18 Jul 2023 14:18:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGPZg/ObyIOhi3WU24fCQfR9izitBSDUJsxu88NeUFvb9VYP2fS82IkCRp1hJyu1elKb4cl X-Received: by 2002:a05:6a20:431f:b0:130:9638:36d4 with SMTP id h31-20020a056a20431f00b00130963836d4mr16062177pzk.33.1689715120402; Tue, 18 Jul 2023 14:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689715120; cv=none; d=google.com; s=arc-20160816; b=Po/OhUigPUt63DlUeWI1E4xfq/q5grLDFmbNILFIIo0S1BAEII/qNqgcK8eCDKRd6j ctStsWNa+gIpzjUTnQj3sPRLMt62oG0Ob6kE/moMLWuGuoLKLj3k3DS9x4U9/lAQAPay WrS7rdVutwZQxRN9u/IjPjegVLtl1rOMvKpZD3uSTdEAyvnAbnbNPxbw8q45zF4R0roi Ey45Cynku68A6hVCurAlu5Ud6AYb+Q8GrLKL8hDcO3QBGmeLez+Qi4wRE6ZfYCceoimb bV1WGddrnVGuSWRMwd2xabW8BUTwBj1bPS+tbAInMCQyOqojv0Vm7kCiKZpRwhQQLyrX 3c7A== 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=r7Cmd/XHyUl2Ty9XJ2Bs+6IEKcbeTFzbbxd3pqlVF7s=; fh=3xNEhT4JwWJBHsL+y4xHd45q8QLNnF9PXVo1MLCBxA4=; b=rgJqDHvb5I6KmO3fUK4erGp8mdf71ssydUYT/w2VbcOUgzIpCemZ+yHIpldxiTMu3v BxsYEuHR1wIYbwQK5vgeJkQiLgFJGJtOvrKzZ9U9Nu1Rnwtw5MiW0Hp4DwOqir10OwUy 9OS/ug1cMWX9ICNniyhOynvy9GzwgXERCPh98khfEsKRX4Oa8oGhWl9ZmDXcj6Ry0olq PpWAORBlJyTIHCcB8UT0kVBh9WAwUkHsJ4ZtE6Dn+rPEDJkW9e9ytbiYrSzpJyKWrtrY 6/sSoIRVp46KeCgdha94UpqFDXJw6I9S1xOpSnQFpsEvG7j4ozyIJkAD1D5+9NLzJFYn Z+pg== 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 c31-20020a634e1f000000b00553ced07d17si2069996pgb.123.2023.07.18.14.18.27; Tue, 18 Jul 2023 14:18:40 -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 S230466AbjGRVOW (ORCPT <rfc822;chrisben.tianve@gmail.com> + 99 others); Tue, 18 Jul 2023 17:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjGRVOV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Jul 2023 17:14:21 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4A6C0; Tue, 18 Jul 2023 14:14:19 -0700 (PDT) X-QQ-mid: bizesmtp76t1689714848tywoz5oa Received: from linux-lab-host.localdomain ( [119.123.130.39]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 19 Jul 2023 05:14:07 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: tJPajVdBfNIK2jxArdUWYFT16jn6ztkWRncwJYA/LCJCGKduhgveUNIZLG4JM n2oXYzi9kWKFTKTs66un9clianapv6W7HqIAE3p9mJvLcb2yRSJYREt+J04+h2Tbj8FRt66 XqqfSoAIxuRyxtOWChZqbONtmAf0R9vp041dPA0/5wFaHxSE+OE3fEbaA1lEAc3/x8fU9IB 9bBZUiTMU9XdJy+Clz/WobmhLn//ADk+ZKbcXG8+FhQB9LVNOfRkWJB2PtnMwZq2Hr5RJ7X HooTWAdGrYAP7eGfD2NAzaosBmpLE/P4gARAo6Pm7rzkP9i7ZwPSl/7/ukTdU/4HexqkeCg jeg24Wq3PI6R352t53XZSSli+8EbjgKgCqeVy93AovVbfa2CJfOOu/NiGcPriOACoXIsX62 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 12934479316635104382 From: Zhangjin Wu <falcon@tinylab.org> To: w@1wt.eu Cc: thomas@t-8ch.de, arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Th?= =?utf-8?q?omas_Wei=C3=9Fschuh?= <linux@weissschuh.net> Subject: [PATCH v1 4/8] selftests/nolibc: add extra config file customize support Date: Wed, 19 Jul 2023 05:14:07 +0800 Message-Id: <ecd5cd252bc728df1becfebff772713e8edce1ec.1689713175.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1689713175.git.falcon@tinylab.org> References: <cover.1689713175.git.falcon@tinylab.org> 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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: 1771794722166725382 X-GMAIL-MSGID: 1771794722166725382 |
Series |
tools/nolibc: add 32/64-bit powerpc support
|
|
Commit Message
Zhangjin Wu
July 18, 2023, 9:14 p.m. UTC
The default DEFCONFIG_<ARCH> may not always work for all architectures,
some architectures require to add extra kernel config options, this adds
a new 'extconfig' target for this requirement.
It allows to customize extra kernel config options via the common
common.config and the architecture specific <ARCH>.config, at last
trigger 'allnoconfig' to let them take effect with missing config
options as disabled.
The scripts/kconfig/merge_config.sh tool is used to merge the extra
config files.
Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/lkml/67eb70d4-c9ff-4afc-bac7-7f36cc2c81bc@t-8ch.de/
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
tools/testing/selftests/nolibc/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
Comments
On Wed, Jul 19, 2023 at 05:14:07AM +0800, Zhangjin Wu wrote: > The default DEFCONFIG_<ARCH> may not always work for all architectures, > some architectures require to add extra kernel config options, this adds > a new 'extconfig' target for this requirement. > > It allows to customize extra kernel config options via the common > common.config and the architecture specific <ARCH>.config, at last > trigger 'allnoconfig' to let them take effect with missing config > options as disabled. > > The scripts/kconfig/merge_config.sh tool is used to merge the extra > config files. > > Suggested-by: Thomas Weißschuh <linux@weissschuh.net> > Link: https://lore.kernel.org/lkml/67eb70d4-c9ff-4afc-bac7-7f36cc2c81bc@t-8ch.de/ > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > tools/testing/selftests/nolibc/Makefile | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index f42adef87e12..08a5ca5f418b 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -39,6 +39,9 @@ DEFCONFIG_s390 = defconfig > DEFCONFIG_loongarch = defconfig > DEFCONFIG = $(DEFCONFIG_$(ARCH)) > > +# extra kernel config files under configs/, include common + architecture specific > +EXTCONFIG = common.config $(ARCH).config > + > # optional tests to run (default = all) > TEST = > > @@ -162,6 +165,10 @@ initramfs: nolibc-test > defconfig: > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare > > +extconfig: > + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > + $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig > + Please also mention this entry in the "help" message. Other than that, OK. Willy
Hi Zhangjin, On Tue, Jul 25, 2023 at 10:30:06PM +0800, Zhangjin Wu wrote: > Hi, Willy > > > On Wed, Jul 19, 2023 at 05:14:07AM +0800, Zhangjin Wu wrote: > > > The default DEFCONFIG_<ARCH> may not always work for all architectures, > > > some architectures require to add extra kernel config options, this adds > > > a new 'extconfig' target for this requirement. > > > > > > It allows to customize extra kernel config options via the common > > > common.config and the architecture specific <ARCH>.config, at last > > > trigger 'allnoconfig' to let them take effect with missing config > > > options as disabled. > > > > > > The scripts/kconfig/merge_config.sh tool is used to merge the extra > > > config files. > > > > > > Suggested-by: Thomas Wei?schuh <linux@weissschuh.net> > > > Link: https://lore.kernel.org/lkml/67eb70d4-c9ff-4afc-bac7-7f36cc2c81bc@t-8ch.de/ > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > > --- > > > tools/testing/selftests/nolibc/Makefile | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > > index f42adef87e12..08a5ca5f418b 100644 > > > --- a/tools/testing/selftests/nolibc/Makefile > > > +++ b/tools/testing/selftests/nolibc/Makefile > > > @@ -39,6 +39,9 @@ DEFCONFIG_s390 = defconfig > > > DEFCONFIG_loongarch = defconfig > > > DEFCONFIG = $(DEFCONFIG_$(ARCH)) > > > > > > +# extra kernel config files under configs/, include common + architecture specific > > > +EXTCONFIG = common.config $(ARCH).config > > > + > > > # optional tests to run (default = all) > > > TEST = > > > > > > @@ -162,6 +165,10 @@ initramfs: nolibc-test > > > defconfig: > > > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare > > > > > > +extconfig: > > > + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > > > + $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig > > > + > > > > Please also mention this entry in the "help" message. > > Other than that, OK. > > > > Willy, as we discussed in another tinyconfig series, in order to avoid > add more complexity to users, I plan to drop this standalone 'extconfig' > target and move the extra config operations to defconfig target like > this: > > defconfig: > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare > $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig > > This extra config options are really critical to default boot and test, so, it > should be a 'default' config action as the 'defconfig' target originally mean. > > Will test carefully about this change, what's your idea? Well, *iff* we need to have per-arch config settings, probably to better support Qemu, the console output, etc, then indeed we'd rather add them to all configs indeed. However the example above is bogus. First you create a default config, then prepare the rest of the kernel, then merge that config with the extensions (based on the arch and not the sub-arch BTW) then erase everything to restart from an allnoconfig. Also if you're using merge_config you'll need -Q to disable warning about overridden options since you're starting from a defconfig which contains plenty of them. Usually I just do defconfig, append the few changes, then oldconfig and that's done. But merge_config can probably be fine as well. Also make prepare should be done last, to make sure that if it depends on anything in the config (e.g. 32 vs 64 bit etc) it's up to date. Willy
> Hi Zhangjin, > > On Tue, Jul 25, 2023 at 10:30:06PM +0800, Zhangjin Wu wrote: > > Hi, Willy > > > > > On Wed, Jul 19, 2023 at 05:14:07AM +0800, Zhangjin Wu wrote: > > > > The default DEFCONFIG_<ARCH> may not always work for all architectures, > > > > some architectures require to add extra kernel config options, this adds > > > > a new 'extconfig' target for this requirement. > > > > > > > > It allows to customize extra kernel config options via the common > > > > common.config and the architecture specific <ARCH>.config, at last > > > > trigger 'allnoconfig' to let them take effect with missing config > > > > options as disabled. > > > > > > > > The scripts/kconfig/merge_config.sh tool is used to merge the extra > > > > config files. > > > > > > > > Suggested-by: Thomas Wei?schuh <linux@weissschuh.net> > > > > Link: https://lore.kernel.org/lkml/67eb70d4-c9ff-4afc-bac7-7f36cc2c81bc@t-8ch.de/ > > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > > > --- > > > > tools/testing/selftests/nolibc/Makefile | 7 +++++++ > > > > 1 file changed, 7 insertions(+) > > > > > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > > > index f42adef87e12..08a5ca5f418b 100644 > > > > --- a/tools/testing/selftests/nolibc/Makefile > > > > +++ b/tools/testing/selftests/nolibc/Makefile > > > > @@ -39,6 +39,9 @@ DEFCONFIG_s390 = defconfig > > > > DEFCONFIG_loongarch = defconfig > > > > DEFCONFIG = $(DEFCONFIG_$(ARCH)) > > > > > > > > +# extra kernel config files under configs/, include common + architecture specific > > > > +EXTCONFIG = common.config $(ARCH).config > > > > + > > > > # optional tests to run (default = all) > > > > TEST = > > > > > > > > @@ -162,6 +165,10 @@ initramfs: nolibc-test > > > > defconfig: > > > > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare > > > > > > > > +extconfig: > > > > + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > > > > + $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig > > > > + > > > > > > Please also mention this entry in the "help" message. > > > Other than that, OK. > > > > > > > Willy, as we discussed in another tinyconfig series, in order to avoid > > add more complexity to users, I plan to drop this standalone 'extconfig' > > target and move the extra config operations to defconfig target like > > this: > > > > defconfig: > > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare > > $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > > $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig > > > > This extra config options are really critical to default boot and test, so, it > > should be a 'default' config action as the 'defconfig' target originally mean. > > > > Will test carefully about this change, what's your idea? > > Well, *iff* we need to have per-arch config settings, probably to better > support Qemu, the console output, etc, then indeed we'd rather add them > to all configs indeed. However the example above is bogus. First you > create a default config, then prepare the rest of the kernel , then > merge that config with the extensions (based on the arch and not the > sub-arch BTW) then erase everything to restart from an allnoconfig. > allnoconfig is based on the "$(srctree)/.config" generated by defconfig plus the extra ARCH specific config options, so, it should be additional? Btw, what do you mean? "based on the arch and not the sub-arch BTW", in reality, the ARCH will be changed to XARCH, so, this is sub-arch/variant specific. > Also if you're using merge_config you'll need -Q to disable warning > about overridden options since you're starting from a defconfig which > contains plenty of them. Yeah, we do need this to silence some warnings. > Usually I just do defconfig, append the few > changes, then oldconfig and that's done. I have used olddefconfig (similar to oldconfig but without prompts) before, but allnoconfig is used to mainly to only compile the ones we explicitly enable, with the new additional options as No, which may be more deterministic, it should not touch the old configured ones in .config? I have learned its usage from the merge_config.sh > But merge_config can probably > be fine as well. Also make prepare should be done last, to make sure > that if it depends on anything in the config (e.g. 32 vs 64 bit etc) > it's up to date. > Ok, let's move 'prepare' at the end of all above. And also add the -Q option to silence the potential warnings: defconfig: $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) $(Q)$(srctree)/scripts/kconfig/merge_config.sh -Q -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) prepare We may still need to clear the usage of allnoconfig, In my test, it does work as I explained above. If I really misused it, let's change it back to olddefconfig. Thanks, Zhangjin > Willy
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index f42adef87e12..08a5ca5f418b 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -39,6 +39,9 @@ DEFCONFIG_s390 = defconfig DEFCONFIG_loongarch = defconfig DEFCONFIG = $(DEFCONFIG_$(ARCH)) +# extra kernel config files under configs/, include common + architecture specific +EXTCONFIG = common.config $(ARCH).config + # optional tests to run (default = all) TEST = @@ -162,6 +165,10 @@ initramfs: nolibc-test defconfig: $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare +extconfig: + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) + $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig + kernel: initramfs $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs