Skip to contentSkip to conversation

kconfig: add KCONFIG_ALLCONFIG support for tinyconfig

PATCH Superseded Randrianaina Georges Aaron 2 participants 4 messages Mar 3, 2022 – Mar 8, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: add KCONFIG_ALLCONFIG support for tinyconfig

Since f8f0d06438e5, tinyconfig overrides KCONFIG_ALLCONFIG to include kernel/configs/tiny-base.config. However, this ignores user's preset if defined.

This modification checks if the user has set KCONFIG_ALLCONFIG and if so, concatenates it with kernel/configs/tiny-base.config to be used as preset config symbols.

---
 scripts/kconfig/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/kconfig/Makefile +6 -0
index b8ef0fb4bbef..337693fb4762 100644
@@ -102,7 +102,13 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
 
 PHONY += tinyconfig
 tinyconfig:
+ifeq ($(KCONFIG_ALLCONFIG),)
 	$(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+else
+	$(Q)cat $(KCONFIG_ALLCONFIG) <(echo) kernel/configs/tiny-base.config > .tmp.config
+	$(Q)KCONFIG_ALLCONFIG=.tmp.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+	$(Q)rm -f .tmp.config
+endif
 	$(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
 
 # CHECK: -o cache_dir=<path> working?
Signature · 1 line
2.34.1
#1 lore raw
Quoted 19 lines · Randrianaina Georges Aaron

Since f8f0d06438e5, tinyconfig overrides KCONFIG_ALLCONFIG to include kernel/configs/tiny-base.config. However, this ignores user's preset if defined.

This modification checks if the user has set KCONFIG_ALLCONFIG and if so, concatenates it with kernel/configs/tiny-base.config to be used as preset config symbols.

---
 scripts/kconfig/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/kconfig/Makefile +0 -0
index b8ef0fb4bbef..337693fb4762 100644

scripts/kconfig/Makefile configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c · line 108

Quoted 7 lines
scripts/kconfig/Makefile +3 -0
@@ -102,7 +102,13 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
 
 PHONY += tinyconfig
 tinyconfig:
+ifeq ($(KCONFIG_ALLCONFIG),)
        $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+else
+       $(Q)cat $(KCONFIG_ALLCONFIG) <(echo) kernel/configs/tiny-base.config > .tmp.config

I assume "<(echo)" exists here to insert a blank line. The process substitution is a bash'ism.

If you execute it on Debian or its variants, where /bin/sh is a symlink to dash, it fails.

masahiro@grover:~/ref/linux$ make  KCONFIG_ALLCONFIG=/tmp/dummy.config
tinyconfig
/bin/sh: 1: Syntax error: "(" unexpected
make[1]: *** [scripts/kconfig/Makefile:108: tinyconfig] Error 2
make: *** [Makefile:619: tinyconfig] Error 2

We can delete '<(echo)', but another issue is that this does not work with O=<dir> option.

masahiro@grover:~/ref/linux$ make O=foo
KCONFIG_ALLCONFIG=/tmp/dummy.config tinyconfig
make[1]: Entering directory '/home/masahiro/ref/linux/foo'
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
cat: kernel/configs/tiny-base.config: No such file or directory
make[2]: *** [../scripts/kconfig/Makefile:108: tinyconfig] Error 1
make[1]: *** [/home/masahiro/ref/linux/Makefile:619: tinyconfig] Error 2
make[1]: Leaving directory '/home/masahiro/ref/linux/foo'
make: *** [Makefile:219: __sub-make] Error 2
Quoted 8 lines
scripts/kconfig/Makefile +3 -1
+       $(Q)KCONFIG_ALLCONFIG=.tmp.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+       $(Q)rm -f .tmp.config
+endif
        $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
 
 # CHECK: -o cache_dir=<path> working?
--

2.34.1

--
Best Regards
Masahiro Yamada

#2 lore raw
Quoted 44 lines · Masahiro Yamada
Quoted 19 lines · Randrianaina Georges Aaron

Since f8f0d06438e5, tinyconfig overrides KCONFIG_ALLCONFIG to include kernel/configs/tiny-base.config. However, this ignores user's preset if defined.

This modification checks if the user has set KCONFIG_ALLCONFIG and if so, concatenates it with kernel/configs/tiny-base.config to be used as preset config symbols.

---
 scripts/kconfig/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/kconfig/Makefile +0 -0
index b8ef0fb4bbef..337693fb4762 100644

scripts/kconfig/Makefile configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c · line 108

Quoted 7 lines
scripts/kconfig/Makefile +3 -0
@@ -102,7 +102,13 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
 
 PHONY += tinyconfig
 tinyconfig:
+ifeq ($(KCONFIG_ALLCONFIG),)
        $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+else
+       $(Q)cat $(KCONFIG_ALLCONFIG) <(echo) kernel/configs/tiny-base.config > .tmp.config

I assume "<(echo)" exists here to insert a blank line. The process substitution is a bash'ism.

If you execute it on Debian or its variants, where /bin/sh is a symlink to dash, it fails.

masahiro@grover:~/ref/linux$ make  KCONFIG_ALLCONFIG=/tmp/dummy.config
tinyconfig
/bin/sh: 1: Syntax error: "(" unexpected
make[1]: *** [scripts/kconfig/Makefile:108: tinyconfig] Error 2
make: *** [Makefile:619: tinyconfig] Error 2
Quoted 2 lines

We can delete '<(echo)', but another issue is that this does not work with O=<dir> option.

Yes, we can delete <(echo). We can solve the remaining issue by adding $(srctree) in the presets' path to make it work with O=<dir>.

Quoted 25 lines

masahiro@grover:~/ref/linux$ make O=foo
KCONFIG_ALLCONFIG=/tmp/dummy.config tinyconfig
make[1]: Entering directory '/home/masahiro/ref/linux/foo'
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
cat: kernel/configs/tiny-base.config: No such file or directory
make[2]: *** [../scripts/kconfig/Makefile:108: tinyconfig] Error 1
make[1]: *** [/home/masahiro/ref/linux/Makefile:619: tinyconfig] Error 2
make[1]: Leaving directory '/home/masahiro/ref/linux/foo'
make: *** [Makefile:219: __sub-make] Error 2
Quoted 8 lines
scripts/kconfig/Makefile +3 -1
+       $(Q)KCONFIG_ALLCONFIG=.tmp.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+       $(Q)rm -f .tmp.config
+endif
        $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
 
 # CHECK: -o cache_dir=<path> working?
--

2.34.1

#3 lore raw
Quoted 48 lines · RANDRIANAINA Georges Aaron
Quoted 44 lines · Masahiro Yamada
Quoted 19 lines · Randrianaina Georges Aaron

Since f8f0d06438e5, tinyconfig overrides KCONFIG_ALLCONFIG to include kernel/configs/tiny-base.config. However, this ignores user's preset if defined.

This modification checks if the user has set KCONFIG_ALLCONFIG and if so, concatenates it with kernel/configs/tiny-base.config to be used as preset config symbols.

---
 scripts/kconfig/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/kconfig/Makefile +0 -0
index b8ef0fb4bbef..337693fb4762 100644

scripts/kconfig/Makefile configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c · line 108

Quoted 7 lines
scripts/kconfig/Makefile +3 -0
@@ -102,7 +102,13 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
 
 PHONY += tinyconfig
 tinyconfig:
+ifeq ($(KCONFIG_ALLCONFIG),)
        $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+else
+       $(Q)cat $(KCONFIG_ALLCONFIG) <(echo) kernel/configs/tiny-base.config > .tmp.config

I assume "<(echo)" exists here to insert a blank line. The process substitution is a bash'ism.

If you execute it on Debian or its variants, where /bin/sh is a symlink to dash, it fails.

masahiro@grover:~/ref/linux$ make  KCONFIG_ALLCONFIG=/tmp/dummy.config
tinyconfig
/bin/sh: 1: Syntax error: "(" unexpected
make[1]: *** [scripts/kconfig/Makefile:108: tinyconfig] Error 2
make: *** [Makefile:619: tinyconfig] Error 2
Quoted 5 lines
Quoted 2 lines

We can delete '<(echo)', but another issue is that this does not work with O=<dir> option.

Yes, we can delete <(echo). We can solve the remaining issue by adding $(srctree) in the presets' path to make it work with O=<dir>.

Yes.

Signature · 2 lines
Best Regards
Masahiro Yamada