Skip to contentSkip to conversation

kconfig: turnaround into single .config

PATCH Superseded Masahiro Yamada 4 participants 13 messages Feb 19, 2015 – Feb 24, 2015

Subsystems (10)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover kconfig: turnaround into single .config

Masahiro Yamada (4):
ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value
malloc_f: fix broken .config caused by CONFIG_SYS_MALLOC_F
kconfig: switch to single .config configuration
kconfig: remove unneeded dependency on !SPL_BUILD

 Kconfig                                 |  27 +---
 arch/arm/Kconfig                        |   7 +-
 arch/arm/cpu/arm1176/bcm2835/Kconfig    |   6 +-
 arch/arm/cpu/armv7/exynos/Kconfig       |  29 ++--
 arch/arm/cpu/armv7/omap3/Kconfig        |  11 +-
 arch/arm/cpu/armv7/s5pc1xx/Kconfig      |   4 +-
 arch/arm/cpu/armv7/tegra-common/Kconfig |  18 ++-
 arch/arm/cpu/armv7/uniphier/Kconfig     |   5 -
 arch/x86/Kconfig                        |   4 +-
 board/amcc/canyonlands/Kconfig          |   4 -
 board/compulab/cm_t335/Kconfig          |   6 +-
 board/gumstix/pepper/Kconfig            |   6 +-
 board/isee/igep0033/Kconfig             |   6 +-
 board/phytec/pcm051/Kconfig             |   6 +-
 board/samsung/goni/Kconfig              |   6 +-
 board/samsung/smdkc100/Kconfig          |   6 +-
 board/silica/pengwyn/Kconfig            |   6 +-
 board/ti/am335x/Kconfig                 |  11 +-
 common/Kconfig                          |   1 -
 config.mk                               |   5 +
 configs/ph1_ld4_defconfig               |   2 +-
 configs/ph1_pro4_defconfig              |   2 +-
 configs/ph1_sld8_defconfig              |   2 +-
 doc/README.kconfig                      | 132 ++++------------
 drivers/core/Kconfig                    |  16 +-
 drivers/mtd/nand/Kconfig                |   6 +-
 dts/Kconfig                             |   1 -
 include/config_uncmd_spl.h              |  13 ++
 scripts/Makefile.autoconf               |  36 +++--
 scripts/Makefile.build                  |   3 +-
 scripts/Makefile.spl                    |  10 +-
 scripts/Makefile.uncmd_spl              |  18 +++
 scripts/multiconfig.sh                  | 261 +-------------------------------
 33 files changed, 184 insertions(+), 492 deletions(-)
 create mode 100644 scripts/Makefile.uncmd_spl
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/4 ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value

It is true that malloc is necessary for Driver Model before relocation, but there is no good reason to reserve the malloc space more than enough. The default value 0x400 works well.

---

Changes in v2: None

 arch/arm/cpu/armv7/uniphier/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/uniphier/Kconfig +1 -1
index 1a47ac9..8fdef28 100644
@@ -52,7 +52,7 @@ config SYS_MALLOC_F
 	default y
 
 config SYS_MALLOC_F_LEN
-	default 0x2000
+	default 0x400
 
 config CMD_PINMON
 	bool "Enable boot mode pins monitor command"
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/4 ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value

Quoted 11 lines · Masahiro Yamada

It is true that malloc is necessary for Driver Model before relocation, but there is no good reason to reserve the malloc space more than enough. The default value 0x400 works well.

---

Changes in v2: None

 arch/arm/cpu/armv7/uniphier/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH v2 2/4 malloc_f: fix broken .config caused by CONFIG_SYS_MALLOC_F

In reply to Masahiro Yamada

Since commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig), the ".config" created by the configuration has been wrong.

For example, the following is a snippet of the ".config" generated by "make beaver_defconfig":

--------------->8-----------------
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
# CONFIG_SYS_MALLOC_F is not set
CONFIG_SYS_MALLOC_F_LEN=0x1800
# CONFIG_EXPERT is not set
---------------8<-----------------

CONFIG_SYS_MALLOC_F_LEN is supposed to depend on CONFIG_SYS_MALLOC_F (see the top level Kconfig), but the ".config" above is not actually following that dependency.

This is caused by two mistakes of commit b724bd7d6349.

[1] Wrong default value of CONFIG_SYS_MALLOC_F CONFIG_SYS_MALLOC_F is a boolean option, but its default value is set to 0x400.

[2] Missing "if SYS_MALLOC_F" in the default setting in each Kconfig For example, arch/arm/cpu/armv7/tegra-common/Kconfig has the line "default 0x1800" for SYS_MALLOC_F_LEN. It must be described as "default 0x1800 if SYS_MALLOC_F" to follow the dependency.

Those two bugs together create such a broken ".config".

Unfortunately, even if we correct both [1] and [2], the value of CONFIG_SYS_MALLOC_F_LEN is not set as we expect.
The "default 0x1800 if SYS_MALLOC_F" would be simply ignored because the "default 0x400" in the top level Kconfig is parsed first.

Notice that if multiple default lines appear for the same CONFIG, the first one takes precedence.

So, this commit correct [1] and [2], also leaves some comments in arch/arm/cpu/armv7/tegra-common/Kconfig and arch/x86/Kconfig to notify not-working default values.

If you want to change the default value of CONFIG_SYS_MALLOC_F_LEN, the easiest way would be to specify it in each *_defconfig.

It is true that describing SoC-common default values in each Kconfig seems handy, but it often introduces nasty problems.
If you do not understand well how Kconfig works, as you see above, you could easily create a broken .config file.

The default value 0x400 is redundant for OMAP, Exynos, UniPhier, etc. They can be simply removed.

There are still redundant "CONFIG_SYS_MALLOC_F_LEN=0x400" in many defconfig files, but this commit is not touching them.

---

Changes in v2: None

 Kconfig                                 | 1 -
 arch/arm/cpu/armv7/exynos/Kconfig       | 3 ---
 arch/arm/cpu/armv7/omap3/Kconfig        | 3 ---
 arch/arm/cpu/armv7/tegra-common/Kconfig | 4 +++-
 arch/arm/cpu/armv7/uniphier/Kconfig     | 3 ---
 arch/x86/Kconfig                        | 4 +++-
 board/amcc/canyonlands/Kconfig          | 4 ----
 board/ti/am335x/Kconfig                 | 3 ---
 8 files changed, 6 insertions(+), 19 deletions(-)
Kconfig +0 -1
index 75bab7f..d40f9ec 100644
@@ -58,7 +58,6 @@ config CC_OPTIMIZE_FOR_SIZE
 
 config SYS_MALLOC_F
 	bool "Enable malloc() pool before relocation"
-	default 0x400
 	help
 	  Before relocation memory is very limited on many platforms. Still,
 	  we can provide a small malloc() pool if needed. Driver model in
arch/arm/cpu/armv7/exynos/Kconfig +0 -3
index 2064efa..23869ce 100644
@@ -83,9 +83,6 @@ config DM_GPIO
 config SYS_MALLOC_F
 	default y if !SPL_BUILD
 
-config SYS_MALLOC_F_LEN
-	default 0x400 if !SPL_BUILD
-
 source "board/samsung/smdkv310/Kconfig"
 source "board/samsung/trats/Kconfig"
 source "board/samsung/universal_c210/Kconfig"
arch/arm/cpu/armv7/omap3/Kconfig +0 -3
index 4644098..2e193ab 100644
@@ -105,9 +105,6 @@ config DM_SERIAL
 config SYS_MALLOC_F
 	default y if DM && !SPL_BUILD
 
-config SYS_MALLOC_F_LEN
-	default 0x400 if DM && !SPL_BUILD
-
 config SYS_SOC
 	default "omap3"
 
arch/arm/cpu/armv7/tegra-common/Kconfig +3 -1
index ee32469..0de13ae 100644
@@ -20,8 +20,10 @@ endchoice
 config SYS_MALLOC_F
 	default y
 
+# This is meaningless.
+# "default 0x400" in the top level Kconfig is used in stead.
 config SYS_MALLOC_F_LEN
-	default 0x1800
+	default 0x1800 if SYS_MALLOC_F
 
 config USE_PRIVATE_LIBGCC
 	default y if SPL_BUILD
arch/arm/cpu/armv7/uniphier/Kconfig +0 -3
index 8fdef28..371b274 100644
@@ -51,9 +51,6 @@ endchoice
 config SYS_MALLOC_F
 	default y
 
-config SYS_MALLOC_F_LEN
-	default 0x400
-
 config CMD_PINMON
 	bool "Enable boot mode pins monitor command"
 	default y
arch/x86/Kconfig +3 -1
index 35d24e4..2275374 100644
@@ -79,8 +79,10 @@ config DM_SERIAL
 config SYS_MALLOC_F
 	default y
 
+# This is meaningless.
+# "default 0x400" in the top level Kconfig is used in stead.
 config SYS_MALLOC_F_LEN
-	default 0x800
+	default 0x800 if SYS_MALLOC_F
 
 config RAMBASE
 	hex
board/amcc/canyonlands/Kconfig +0 -4
index 848e08f..c0dbd18 100644
@@ -43,8 +43,4 @@ config SYS_MALLOC_F
 	bool
 	default y
 
-config SYS_MALLOC_F_LEN
-	hex
-	default 0x400
-
 endif
board/ti/am335x/Kconfig +0 -3
index a20e0c1..cad10c2 100644
@@ -50,7 +50,4 @@ config DM_SERIAL
 config SYS_MALLOC_F
 	default y if DM && !SPL_BUILD
 
-config SYS_MALLOC_F_LEN
-	default 0x400 if DM && !SPL_BUILD
-
 endif
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

In reply to Masahiro Yamada

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

---

Changes in v2:
- Fix typos in commit description

 Kconfig                                 |  14 --
 arch/arm/cpu/armv7/tegra-common/Kconfig |   2 +-
 arch/arm/cpu/armv7/uniphier/Kconfig     |   1 -
 config.mk                               |   5 +
 configs/ph1_ld4_defconfig               |   2 +-
 configs/ph1_pro4_defconfig              |   2 +-
 configs/ph1_sld8_defconfig              |   2 +-
 doc/README.kconfig                      | 132 ++++------------
 drivers/mtd/nand/Kconfig                |   2 +-
 include/config_uncmd_spl.h              |   9 ++
 scripts/Makefile.autoconf               |  36 +++--
 scripts/Makefile.build                  |   3 +-
 scripts/Makefile.spl                    |  10 +-
 scripts/Makefile.uncmd_spl              |  16 ++
 scripts/multiconfig.sh                  | 261 +-------------------------------
 15 files changed, 108 insertions(+), 389 deletions(-)
 create mode 100644 scripts/Makefile.uncmd_spl
Kconfig +0 -14
index d40f9ec..d3b8b69 100644
@@ -8,10 +8,6 @@ config UBOOTVERSION
 	string
 	option env="UBOOTVERSION"
 
-config KCONFIG_OBJDIR
-	string
-	option env="KCONFIG_OBJDIR"
-
 menu "General setup"
 
 config LOCALVERSION
@@ -86,16 +82,6 @@ endmenu		# General setup
 
 menu "Boot images"
 
-config SPL_BUILD
-	bool
-	depends on $KCONFIG_OBJDIR="spl" || $KCONFIG_OBJDIR="tpl"
-	default y
-
-config TPL_BUILD
-	bool
-	depends on $KCONFIG_OBJDIR="tpl"
-	default y
-
 config SUPPORT_SPL
 	bool
 
arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
index 0de13ae..c9e8919 100644
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
 	default 0x1800 if SYS_MALLOC_F
 
 config USE_PRIVATE_LIBGCC
-	default y if SPL_BUILD
+	default y
 
 config DM
 	default y if !SPL_BUILD
arch/arm/cpu/armv7/uniphier/Kconfig +0 -1
index 371b274..afb3c55 100644
@@ -68,7 +68,6 @@ config CMD_DDRPHY_DUMP
 
 choice
 	prompt "DDR3 Frequency select"
-	depends on SPL_BUILD
 
 config DDR_FREQ_1600
 	bool "DDR3 1600"
config.mk +5 -0
index 64c2951..6282919 100644
@@ -24,6 +24,11 @@ VENDOR :=
 
 ARCH := $(CONFIG_SYS_ARCH:"%"=%)
 CPU := $(CONFIG_SYS_CPU:"%"=%)
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_TEGRA
+CPU := arm720t
+endif
+endif
 BOARD := $(CONFIG_SYS_BOARD:"%"=%)
 ifneq ($(CONFIG_SYS_VENDOR),)
 VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
configs/ph1_ld4_defconfig +1 -1
index 86b4b15..fa8d291 100644
@@ -39,4 +39,4 @@ CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-S:CONFIG_SPL_NAND_DENALI=y
+CONFIG_SPL_NAND_DENALI=y
configs/ph1_pro4_defconfig +1 -1
index 242bcf9..12f0694 100644
@@ -39,4 +39,4 @@ CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-S:CONFIG_SPL_NAND_DENALI=y
+CONFIG_SPL_NAND_DENALI=y
configs/ph1_sld8_defconfig +1 -1
index 8e95f17..e66d166 100644
@@ -39,4 +39,4 @@ CONFIG_DM_I2C=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
-S:CONFIG_SPL_NAND_DENALI=y
+CONFIG_SPL_NAND_DENALI=y
doc/README.kconfig +32 -100

163 lines not on this page · raw message

drivers/mtd/nand/Kconfig +1 -1
index c242214..ccd8211 100644
@@ -36,7 +36,7 @@ config NAND_DENALI_SPARE_AREA_SKIP_BYTES
 
 endif
 
-if SPL_BUILD
+if SPL
 
 config SPL_NAND_DENALI
 	bool "Support Denali NAND controller for SPL"
include/config_uncmd_spl.h +9 -0
index 9cb7a9a..9f0fe44 100644
@@ -20,5 +20,14 @@
 #undef CONFIG_CMD_SNTP
 #undef CONFIG_CMD_TFTPPUT
 #undef CONFIG_CMD_TFTPSRV
+#undef CONFIG_OF_CONTROL
+
+#ifndef CONFIG_SPL_DM
+#undef CONFIG_DM_SERIAL
+#undef CONFIG_DM_GPIO
+#undef CONFIG_DM_I2C
+#undef CONFIG_DM_SPI
+#endif
+
 #endif /* CONFIG_SPL_BUILD */
 #endif /* __CONFIG_UNCMD_SPL_H__ */
scripts/Makefile.autoconf +26 -10
index 8e9d71f..fc970fb 100644
@@ -7,9 +7,17 @@
 # (= When we move all CONFIGs from header files to Kconfig)
 # this makefile can be deleted.
 
-# obj is "include" or "spl/include" or "tpl/include"
-# for non-SPL, SPL, TPL, respectively
-include $(obj)/config/auto.conf
+__all: include/autoconf.mk include/autoconf.mk.dep
+
+ifeq ($(shell grep -q '^CONFIG_SPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
+__all: spl/include/autoconf.mk
+endif
+
+ifeq ($(shell grep -q '^CONFIG_TPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
+__all: tpl/include/autoconf.mk
+endif
+
+include include/config/auto.conf
 
 include scripts/Kbuild.include
 
@@ -22,7 +30,6 @@ CPP		= $(CC) -E
 include config.mk
 
 UBOOTINCLUDE    := \
-		-I$(obj) \
 		-Iinclude \
 		$(if $(KBUILD_SRC), -I$(srctree)/include) \
 		-I$(srctree)/arch/$(ARCH)/include \
@@ -48,10 +55,10 @@ include/autoconf.mk.dep: FORCE
 # same CONFIG macros
 quiet_cmd_autoconf = GEN     $@
       cmd_autoconf = \
-	$(CPP) $(c_flags) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > [email protected] && {	\
+	$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > [email protected] && { \
 		sed -n -f $(srctree)/tools/scripts/define2mk.sed [email protected] |		\
 		while read line; do							\
-			if ! grep -q "$${line%=*}=" $(obj)/config/auto.conf; then	\
+			if ! grep -q "$${line%=*}=" include/config/auto.conf; then	\
 				echo "$$line";						\
 			fi								\
 		done > $@;								\
@@ -60,10 +67,19 @@ quiet_cmd_autoconf = GEN     $@
 		rm [email protected]; false;							\
 	}
 
-$(obj)/autoconf.mk: FORCE
+include/autoconf.mk: FORCE
 	$(call cmd,autoconf)
 
-include/autoconf.mk include/autoconf.mk.dep: include/config.h
+spl/include/autoconf.mk: FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call cmd,autoconf,-DCONFIG_SPL_BUILD)
+
+tpl/include/autoconf.mk: FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call cmd,autoconf,-DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD)
+
+include/autoconf.mk include/autoconf.mk.dep \
+	spl/include/autoconf.mk tpl/include/autoconf.mk: include/config.h
 
 # include/config.h
 # Prior to Kconfig, it was generated by mkconfig. Now it is created here.
@@ -75,10 +91,10 @@ define filechk_config_h
 	done;								\
 	echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
 	echo \#include \<config_defaults.h\>;				\
+	echo \#include \<config_uncmd_spl.h\>;				\
 	echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>;		\
 	echo \#include \<asm/config.h\>;				\
-	echo \#include \<config_fallbacks.h\>;				\
-	echo \#include \<config_uncmd_spl.h\>; )
+	echo \#include \<config_fallbacks.h\>;)
 endef
 
 include/config.h: scripts/Makefile.autoconf create_symlink FORCE
scripts/Makefile.build +2 -1
index 14cf092..ac0554e 100644
@@ -41,8 +41,9 @@ subdir-ccflags-y :=
 
 # Read auto.conf if it exists, otherwise ignore
 # Modified for U-Boot
--include $(prefix)/include/config/auto.conf
+-include include/config/auto.conf
 -include $(prefix)/include/autoconf.mk
+include scripts/Makefile.uncmd_spl
 
 include scripts/Kbuild.include
 
scripts/Makefile.spl +6 -4
index cc189ad..fcacb7f 100644
@@ -21,13 +21,15 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
 
 include $(srctree)/scripts/Kbuild.include
 
-UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE)
-
--include $(obj)/include/config/auto.conf
+-include include/config/auto.conf
 -include $(obj)/include/autoconf.mk
 
+KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
+ifeq ($(CONFIG_TPL_BUILD),y)
+KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
+endif
+
 ifeq ($(CONFIG_TPL_BUILD),y)
-export CONFIG_TPL_BUILD
 SPL_BIN := u-boot-tpl
 else
 SPL_BIN := u-boot-spl
scripts/Makefile.uncmd_spl new file +16 -0
new file mode 100644
index 0000000..0bb7d54
@@ -0,0 +1,16 @@
+# Makefile version of include/config_uncmd_spl.h
+#
+# Invent a better way
+
+ifdef CONFIG_SPL_BUILD
+CONFIG_OF_CONTROL=
+
+ifndef CONFIG_SPL_DM
+CONFIG_DM_SERIAL=
+CONFIG_DM_GPIO=
+CONIFG_DM_I2C=
+CONFIG_DM_SPI=
+CONFIG_DM_SPI_FLASH=
+endif
+
+endif
scripts/multiconfig.sh +7 -254

330 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Quoted 68 lines · Masahiro Yamada

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

arch/arm/cpu/armv7/tegra-common/Kconfig +0 -0
index 0de13ae..c9e8919 100644

arch/arm/cpu/armv7/tegra-common/Kconfig config SYS_MALLOC_F_LEN · line 32

Quoted 8 lines
arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
  	default 0x1800 if SYS_MALLOC_F
 
  config USE_PRIVATE_LIBGCC
-	default y if SPL_BUILD
+	default y
 
  config DM
  	default y if !SPL_BUILD

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be. For example, how do we disabled MMC support in SPL? We have to introduce separate CONFIG_MMC and CONFIG_SPL_MMC don't we? That doesn't seem any better than having separate defconfig files for SPL/non-SPL, or using ifdefs in a single defconfig file. What happened to the ability of one defconfig file to include another, so options could be shared between the two?

#6 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Hi Stephen,

2015-02-20 6:13 GMT+09:00 Stephen Warren <[email protected]>:

Quoted 78 lines · Masahiro Yamada
Quoted 77 lines

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
index 0de13ae..c9e8919 100644
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
        default 0x1800 if SYS_MALLOC_F
 
  config USE_PRIVATE_LIBGCC
-       default y if SPL_BUILD
+       default y
 
Quoted 9 lines

arch/arm/cpu/armv7/tegra-common/Kconfig config SYS_MALLOC_F_LEN · line 32

Quoted 2 lines
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -0
  config DM
        default y if !SPL_BUILD

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be.

Right. This is the disadvantage of the single .config strategy. That's why I chose separate .config at first.

Quoted 2 lines

For example, how do we disabled MMC support in SPL?
We have to introduce separate CONFIG_MMC and CONFIG_SPL_MMC don't we?

Yes, I expect this.

We already have
CONFIG_SPL_MTD_SUPPORT
CONFIG_SPL_NAND_SUPPORT
CONFIG_SPL_NET_SUPPORT
CONFIG_SPL_USB_HOST_SUPPORT
etc.

Quoted 4 lines

That doesn't seem any better than having separate defconfig files for SPL/non-SPL, or using ifdefs in a single defconfig file. What happened to the ability of one defconfig file to include another, so options could be shared between the two?

What you are saying is right, but
we are suffering from various problems that are ascribed to the multi .config way.

I cannot suggest any solution but the single .config.

Signature · 2 lines
Best Regards
Masahiro Yamada
#7 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Quoted 11 lines · Masahiro YAMADA

2015-02-20 6:13 GMT+09:00 Stephen Warren <[email protected]>:

Quoted 7 lines · Masahiro Yamada

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be.

Right. This is the disadvantage of the single .config strategy. That's why I chose separate .config at first.

Just a random thought, maybe it's unworkable, but...

Would it be possible to retain the 2x .config schema but only ever require the user to edit the top level one? For example by having every fooconfig target do something like:

run fooconfig on top level .config as normal ( echo CONFIG_SPL_BUILD=y ; cat .config ) > spl/.config make -C spl <some-sort-of-forced-update>

IOW whenever the user changes .config it is automatically propagated to the spl (or tpl) .config, so we have 2x .config but one of them is non-user-serviceable.

That falls apart for "vi .config" though, so perhaps the echo+cat +forced-update would be better done as part of the recursion into spl/tpl at build time.

Ian.

#8 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Hi Ian,

Quoted 23 lines · On Sat, 21 Feb 2015 10:38:26 +0000 Ian Campbell <[email protected]> wrote:
Quoted 11 lines · Masahiro YAMADA

2015-02-20 6:13 GMT+09:00 Stephen Warren <[email protected]>:

Quoted 7 lines · Masahiro Yamada

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be.

Right. This is the disadvantage of the single .config strategy. That's why I chose separate .config at first.

Just a random thought, maybe it's unworkable, but...

Would it be possible to retain the 2x .config schema but only ever require the user to edit the top level one? For example by having every fooconfig target do something like:

run fooconfig on top level .config as normal ( echo CONFIG_SPL_BUILD=y ; cat .config ) > spl/.config make -C spl <some-sort-of-forced-update>

Quoted 7 lines

IOW whenever the user changes .config it is automatically propagated to the spl (or tpl) .config, so we have 2x .config but one of them is non-user-serviceable.

That falls apart for "vi .config" though, so perhaps the echo+cat +forced-update would be better done as part of the recursion into spl/tpl at build time.

Thanks for your comments.

Actually, I posted a similar idea before:
http://lists.denx.de/pipermail/u-boot/2014-May/180357.html

This series adopted
the single editable .config + forcible-update for SPL/TPL as you suggested.

As for boolean options, it can enable or disable particular options for SPL/TPL. But it cannot set hex or int type options independently.

So, I think we still have CONFIG_SYS_TEXT_BASE, CONFIG_SPL_TEXT_BASE, CONFIG_TPL_TEXT_BASE for example.

I do not think this way has significant advantages against the pure single .config strategy.

Best Regards
Masahiro Yamada

#9 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

In reply to Stephen Warren

Hi Stephen,

Quoted 78 lines · Stephen Warren
Quoted 77 lines · Masahiro Yamada

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
index 0de13ae..c9e8919 100644
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
        default 0x1800 if SYS_MALLOC_F
 
  config USE_PRIVATE_LIBGCC
-       default y if SPL_BUILD
+       default y
 
Quoted 14 lines

arch/arm/cpu/armv7/tegra-common/Kconfig config SYS_MALLOC_F_LEN · line 32

Quoted 2 lines
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -0
  config DM
        default y if !SPL_BUILD

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be. For example, how do we disabled MMC support in SPL? We have to introduce separate CONFIG_MMC and CONFIG_SPL_MMC don't we? That doesn't seem any better than having separate defconfig files for SPL/non-SPL, or using ifdefs in a single defconfig file. What happened to the ability of one defconfig file to include another, so options could be shared between the two?

We use separate options for normal and SPL now. Currently we have CONFIG_SPL_MMC_SUPPORT. So it already works this way.

If we can move to a world where SPL and U-Boot are more similar that will be good.

What I don't understand about this change is why we cannot have 'default y if SPL_BUILD' in a rule if we want to. It seems like that would be useful.

Regards,
Simon

#10 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Hi Simon,

2015-02-21 4:20 GMT+09:00 Simon Glass <[email protected]>:

Quoted 99 lines

Hi Stephen,

Quoted 78 lines · Stephen Warren
Quoted 77 lines · Masahiro Yamada

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
index 0de13ae..c9e8919 100644
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
        default 0x1800 if SYS_MALLOC_F
 
  config USE_PRIVATE_LIBGCC
-       default y if SPL_BUILD
+       default y
 
Quoted 14 lines

arch/arm/cpu/armv7/tegra-common/Kconfig config SYS_MALLOC_F_LEN · line 32

Quoted 2 lines
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -0
  config DM
        default y if !SPL_BUILD

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be. For example, how do we disabled MMC support in SPL? We have to introduce separate CONFIG_MMC and CONFIG_SPL_MMC don't we? That doesn't seem any better than having separate defconfig files for SPL/non-SPL, or using ifdefs in a single defconfig file. What happened to the ability of one defconfig file to include another, so options could be shared between the two?

We use separate options for normal and SPL now. Currently we have CONFIG_SPL_MMC_SUPPORT. So it already works this way.

Quoted 6 lines

If we can move to a world where SPL and U-Boot are more similar that will be good.

What I don't understand about this change is why we cannot have 'default y if SPL_BUILD' in a rule if we want to. It seems like that would be useful.

CONFIG_SPL_BUILD is not defined in Kconfig any more, i.e. we can not use the "if SPL_BUILD" conditonal.

It is given when descending into the spl directory, like the pre-kconfig build.

Here in scripts/Makefile.spl

-include include/config/auto.conf
-include $(obj)/include/autoconf.mk

KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
ifeq ($(CONFIG_TPL_BUILD),y)
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
endif

Signature · 2 lines
Best Regards
Masahiro Yamada
#11 lore raw

PATCH v2 3/4 kconfig: switch to single .config configuration

Hi Masahiro,

Quoted 121 lines · Masahiro YAMADA

Hi Simon,

2015-02-21 4:20 GMT+09:00 Simon Glass <[email protected]>:

Quoted 99 lines

Hi Stephen,

Quoted 78 lines · Stephen Warren
Quoted 77 lines · Masahiro Yamada

When Kconfig for U-boot was examined, one of the biggest issues was how to support multiple images (Normal, SPL, TPL). There were actually two options, "single .config" and "multiple .config". After some discussions and thought experiments, I chose the latter, i.e. to create ".config", "spl/.config", "tpl/.config" for Normal, SPL, TPL, respectively.

It is true that the "multiple .config" strategy provided us the maximum flexibility and helped to avoid duplicating CONFIGs among Normal, SPL, TPL, but I have noticed some fatal problems:

[1] It is impossible to share CONFIG options across the images. If you change the configuration of Main image, you often have to adjust some SPL configurations correspondingly. Currently, we cannot handle the dependencies between them. It means one of the biggest advantages of Kconfig is lost.

[2] It is too painful to change both ".config" and "spl/.config". Sunxi guys started to work around this problem by creating a new configuration target. Commit cbdd9a9737cc (sunxi: kconfig: Add %_felconfig rule to enable FEL build of sunxi platforms.) added "make *_felconfig" to enable CONFIG_SPL_FEL on both images. Changing the configuration of multiple images in one command is a generic demand. The current implementation cannot propose any good solution about this.

[3] Kconfig files are getting ugly and difficult to understand. Commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN to Kconfig) has sprinkled "if !SPL_BUILD" over the Kconfig files.

[4] The build system got more complicated than it should be. To adjust Linux-originated Kconfig to U-Boot, the helper script "scripts/multiconfig.sh" was introduced. Writing a complicated text processor is a shell script sometimes caused problems.

Now I believe the "single .config" will serve us better. With it, all the problems above would go away. Instead, we will have to add some CONFIG_SPL_* (and CONFIG_TPL_*) options such as CONFIG_SPL_DM, but we will not have much. Anyway, this is what we do now in scripts/Makefile.spl.

I admit my mistake with my apology and this commit switches to the single .config configuration.

It is not so difficult to do that:

- Remove unnecessary processings from scripts/multiconfig.sh This file will remain for a while to support the current defconfig format. It will be removed after more cleanups are done.

- Adjust some makefiles and Kconfigs

- Add some entries to include/config_uncmd_spl.h and the new file scripts/Makefile.uncmd_spl. Some CONFIG options that are not supported on SPL must be disabled because one .config is shared between SPL and U-Boot proper going forward. I know this is not a beautiful solution and I think we can do better, but let's see how much we will have to describe them.

- update doc/README.kconfig

More cleaning up patches will follow this.

arch/arm/cpu/armv7/tegra-common/Kconfig +1 -1
index 0de13ae..c9e8919 100644
@@ -26,7 +26,7 @@ config SYS_MALLOC_F_LEN
        default 0x1800 if SYS_MALLOC_F
 
  config USE_PRIVATE_LIBGCC
-       default y if SPL_BUILD
+       default y
 
Quoted 14 lines

arch/arm/cpu/armv7/tegra-common/Kconfig config SYS_MALLOC_F_LEN · line 32

Quoted 2 lines
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -0
  config DM
        default y if !SPL_BUILD

I think the above patch demonstrates the problem very nicely; it changes the semantics from having CONFIG_USE_PRIVATE_LIBGCC enabled only in SPL build to having it enabled everywhere. While that particular change shouldn't be an issue, I think that requiring that all config options to have the same value in main/SPL/TPL will be. For example, how do we disabled MMC support in SPL? We have to introduce separate CONFIG_MMC and CONFIG_SPL_MMC don't we? That doesn't seem any better than having separate defconfig files for SPL/non-SPL, or using ifdefs in a single defconfig file. What happened to the ability of one defconfig file to include another, so options could be shared between the two?

We use separate options for normal and SPL now. Currently we have CONFIG_SPL_MMC_SUPPORT. So it already works this way.

Quoted 6 lines

If we can move to a world where SPL and U-Boot are more similar that will be good.

What I don't understand about this change is why we cannot have 'default y if SPL_BUILD' in a rule if we want to. It seems like that would be useful.

CONFIG_SPL_BUILD is not defined in Kconfig any more, i.e. we can not use the "if SPL_BUILD" conditonal.

It is given when descending into the spl directory, like the pre-kconfig build.

Here in scripts/Makefile.spl

(quoted diff) +0 -2
-include include/config/auto.conf
-include $(obj)/include/autoconf.mk
Quoted 4 lines

KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD
ifeq ($(CONFIG_TPL_BUILD),y)
KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
endif

Thanks for explaining this.

Regards,
Simon

#12 lore raw

PATCH v2 4/4 kconfig: remove unneeded dependency on !SPL_BUILD

In reply to Masahiro Yamada

Now CONFIG_SPL_BUILD is not defined in Kconfig, so "!depends on SPL_BUILD" and "if !SPL_BUILD" are redundant.

---

Changes in v2:
- Fix a typo in commit description

 Kconfig                                 | 12 ++----------
 arch/arm/Kconfig                        |  7 +++----
 arch/arm/cpu/arm1176/bcm2835/Kconfig    |  6 +++---
 arch/arm/cpu/armv7/exynos/Kconfig       | 26 +++++++++++++-------------
 arch/arm/cpu/armv7/omap3/Kconfig        |  8 ++++----
 arch/arm/cpu/armv7/s5pc1xx/Kconfig      |  4 ++--
 arch/arm/cpu/armv7/tegra-common/Kconfig | 12 ++++++------
 arch/arm/cpu/armv7/uniphier/Kconfig     |  1 -
 board/compulab/cm_t335/Kconfig          |  6 +++---
 board/gumstix/pepper/Kconfig            |  6 +++---
 board/isee/igep0033/Kconfig             |  6 +++---
 board/phytec/pcm051/Kconfig             |  6 +++---
 board/samsung/goni/Kconfig              |  6 +++---
 board/samsung/smdkc100/Kconfig          |  6 +++---
 board/silica/pengwyn/Kconfig            |  6 +++---
 board/ti/am335x/Kconfig                 |  8 ++++----
 common/Kconfig                          |  1 -
 drivers/core/Kconfig                    | 16 ++++++----------
 drivers/mtd/nand/Kconfig                |  4 ----
 dts/Kconfig                             |  1 -
 include/config_uncmd_spl.h              |  4 ++++
 scripts/Makefile.uncmd_spl              |  4 +++-
 22 files changed, 71 insertions(+), 85 deletions(-)
Kconfig +2 -10
index d3b8b69..e6a8e48 100644
@@ -12,7 +12,6 @@ menu "General setup"
 
 config LOCALVERSION
 	string "Local version - append to U-Boot release"
-	depends on !SPL_BUILD
 	help
 	  Append an extra string to the end of your U-Boot version.
 	  This will show up on your boot log, for example.
@@ -23,7 +22,6 @@ config LOCALVERSION
 
 config LOCALVERSION_AUTO
 	bool "Automatically append version information to the version string"
-	depends on !SPL_BUILD
 	default y
 	help
 	  This will try to automatically determine if the current tree is a
@@ -44,7 +42,6 @@ config LOCALVERSION_AUTO
 
 config CC_OPTIMIZE_FOR_SIZE
 	bool "Optimize for size"
-	depends on !SPL_BUILD
 	default y
 	help
 	  Enabling this option will pass "-Os" instead of "-O2" to gcc
@@ -91,23 +88,19 @@ config SUPPORT_TPL
 config SPL
 	bool
 	depends on SUPPORT_SPL
-	prompt "Enable SPL" if !SPL_BUILD
-	default y if SPL_BUILD
+	prompt "Enable SPL"
 	help
 	  If you want to build SPL as well as the normal image, say Y.
 
 config TPL
 	bool
 	depends on SPL && SUPPORT_TPL
-	prompt "Enable TPL" if !SPL_BUILD
-	default y if TPL_BUILD
-	default n
+	prompt "Enable TPL"
 	help
 	  If you want to build TPL as well as the normal image and SPL, say Y.
 
 config FIT
 	bool "Support Flattened Image Tree"
-	depends on !SPL_BUILD
 	help
 	  This option allows to boot the new uImage structrure,
 	  Flattened Image Tree.  FIT is formally a FDT, which can include
@@ -131,7 +124,6 @@ config FIT_SIGNATURE
 
 config SYS_EXTRA_OPTIONS
 	string "Extra Options (DEPRECATED)"
-	depends on !SPL_BUILD
 	help
 	  The old configuration infrastructure (= mkconfig + boards.cfg)
 	  provided the extra options field. If you have something like
arch/arm/Kconfig +3 -4
index 41f3220..700e2a8 100644
@@ -739,9 +739,8 @@ config TEGRA
 	bool "NVIDIA Tegra"
 	select SUPPORT_SPL
 	select SPL
-	select OF_CONTROL if !SPL_BUILD
-	select CPU_ARM720T if SPL_BUILD
-	select CPU_V7 if !SPL_BUILD
+	select OF_CONTROL
+	select CPU_V7
 
 config TARGET_VEXPRESS64_AEMV8A
 	bool "Support vexpress_aemv8a"
@@ -833,7 +832,7 @@ config ARCH_UNIPHIER
 	select CPU_V7
 	select SUPPORT_SPL
 	select SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 endchoice
 
arch/arm/cpu/arm1176/bcm2835/Kconfig +3 -3
index 94f57d7..7d0fc67 100644
@@ -1,12 +1,12 @@
 if TARGET_RPI
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 endif
arch/arm/cpu/armv7/exynos/Kconfig +13 -13
index 23869ce..9e47ed3 100644
@@ -6,7 +6,7 @@ choice
 config TARGET_SMDKV310
 	select SUPPORT_SPL
 	bool "Exynos4210 SMDKV310 board"
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_TRATS
 	bool "Exynos4210 Trats board"
@@ -33,32 +33,32 @@ config TARGET_ARNDALE
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_SMDK5250
 	bool "SMDK5250 board"
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_SNOW
 	bool "Snow board"
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_SMDK5420
 	bool "SMDK5420 board"
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_PEACH_PI
 	bool "Peach Pi board"
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_PEACH_PIT
 	bool "Peach Pit board"
 	select SUPPORT_SPL
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 endchoice
 
@@ -66,22 +66,22 @@ config SYS_SOC
 	default "exynos"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 config DM_SPI
-	default y if !SPL_BUILD
+	default y
 
 config DM_SPI_FLASH
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config SYS_MALLOC_F
-	default y if !SPL_BUILD
+	default y
 
 source "board/samsung/smdkv310/Kconfig"
 source "board/samsung/trats/Kconfig"
arch/arm/cpu/armv7/omap3/Kconfig +4 -4
index 2e193ab..b3d5ef3 100644
@@ -94,16 +94,16 @@ config TARGET_TWISTER
 endchoice
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 config DM_SERIAL
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 config SYS_MALLOC_F
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 config SYS_SOC
 	default "omap3"
arch/arm/cpu/armv7/s5pc1xx/Kconfig +2 -2
index 6288134..bc73813 100644
@@ -5,11 +5,11 @@ choice
 
 config TARGET_S5P_GONI
 	bool "S5P Goni board"
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 config TARGET_SMDKC100
 	bool "Support smdkc100 board"
-	select OF_CONTROL if !SPL_BUILD
+	select OF_CONTROL
 
 endchoice
 
arch/arm/cpu/armv7/tegra-common/Kconfig +6 -6
index c9e8919..166de2e 100644
@@ -29,22 +29,22 @@ config USE_PRIVATE_LIBGCC
 	default y
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 config DM_SPI
-	default y if !SPL_BUILD
+	default y
 
 config DM_SPI_FLASH
-	default y if !SPL_BUILD
+	default y
 
 config DM_I2C
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 source "arch/arm/cpu/armv7/tegra20/Kconfig"
 source "arch/arm/cpu/armv7/tegra30/Kconfig"
arch/arm/cpu/armv7/uniphier/Kconfig +0 -1
index afb3c55..b6dc75f 100644
@@ -61,7 +61,6 @@ config CMD_PINMON
 
 config CMD_DDRPHY_DUMP
 	bool "Enable dump command of DDR PHY parameters"
-	depends on !SPL_BUILD
 	help
 	  The command "ddrphy" shows the resulting parameters of DDR PHY
 	  training; it is useful for the evaluation of DDR PHY training.
board/compulab/cm_t335/Kconfig +3 -3
index aadbfbc..3a8f304 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "cm_t335"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/gumstix/pepper/Kconfig +3 -3
index 3099a9e..750db85 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "pepper"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/isee/igep0033/Kconfig +3 -3
index 2fe2ef1..9a8421e 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "am335x_igep0033"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/phytec/pcm051/Kconfig +3 -3
index 65094cf..bb98715 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "pcm051"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/samsung/goni/Kconfig +3 -3
index 2c5d3fc..006e864 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "s5p_goni"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/samsung/smdkc100/Kconfig +3 -3
index 996fe3c..ea87166 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "smdkc100"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/silica/pengwyn/Kconfig +3 -3
index 6ecda80..2e9a2b3 100644
@@ -13,12 +13,12 @@ config SYS_CONFIG_NAME
 	default "pengwyn"
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if !SPL_BUILD
+	default y
 
 config DM_SERIAL
-	default y if !SPL_BUILD
+	default y
 
 endif
board/ti/am335x/Kconfig +4 -4
index cad10c2..8c45892 100644
@@ -39,15 +39,15 @@ config NOR_BOOT
 	  NOR for environment.
 
 config DM
-	default y if !SPL_BUILD
+	default y
 
 config DM_GPIO
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 config DM_SERIAL
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 config SYS_MALLOC_F
-	default y if DM && !SPL_BUILD
+	default y if DM
 
 endif
common/Kconfig +0 -1
index 2ca002d..f82bc88 100644
@@ -1,5 +1,4 @@
 menu "Command line interface"
-	depends on !SPL_BUILD
 
 config HUSH_PARSER
 	bool "Use hush shell"
drivers/core/Kconfig +6 -10
index f0d6110..75d182d 100644
@@ -1,6 +1,5 @@
 config DM
 	bool "Enable Driver Model"
-	depends on !SPL_BUILD
 	help
 	  This config option enables Driver Model. This brings in the core
 	  support, including scanning of platform data on start-up. If
@@ -22,31 +21,28 @@ config SPL_DM
 
 config DM_WARN
 	bool "Enable warnings in driver model"
+	depends on DM
+	default y
 	help
 	  The dm_warn() function can use up quite a bit of space for its
 	  strings. By default this is disabled for SPL builds to save space.
 	  This will cause dm_warn() to be compiled out - it will do nothing
 	  when called.
-	depends on DM
-	default y if !SPL_BUILD
-	default n if SPL_BUILD
 
 config DM_DEVICE_REMOVE
 	bool "Support device removal"
+	depends on DM
+	default y
 	help
 	  We can save some code space by dropping support for removing a
 	  device. This is not normally required in SPL, so by default this
 	  option is disabled for SPL.
-	depends on DM
-	default y if !SPL_BUILD
-	default n if SPL_BUILD
 
 config DM_STDIO
 	bool "Support stdio registration"
+	depends on DM
+	default y
 	help
 	  Normally serial drivers register with stdio so that they can be used
 	  as normal output devices. In SPL we don't normally use stdio, so
 	  we can omit this feature.
-	depends on DM
-	default y if !SPL_BUILD
-	default n if SPL_BUILD
drivers/mtd/nand/Kconfig +0 -4
index ccd8211..72825c3 100644
@@ -6,8 +6,6 @@ config SYS_NAND_SELF_INIT
 	  This option, if enabled, provides more flexible and linux-like
 	  NAND initialization process.
 
-if !SPL_BUILD
-
 config NAND_DENALI
 	bool "Support Denali NAND controller"
 	select SYS_NAND_SELF_INIT
@@ -34,8 +32,6 @@ config NAND_DENALI_SPARE_AREA_SKIP_BYTES
 	  of OOB area before last ECC sector data starts.  This is potentially
 	  used to preserve the bad block marker in the OOB area.
 
-endif
-
 if SPL
 
 config SPL_NAND_DENALI
dts/Kconfig +0 -1
index 5fe63f8..ca5bd6f 100644
@@ -9,7 +9,6 @@ config SUPPORT_OF_CONTROL
 	bool
 
 menu "Device Tree Control"
-	depends on !SPL_BUILD
 	depends on SUPPORT_OF_CONTROL
 
 config OF_CONTROL
include/config_uncmd_spl.h +4 -0
index 9f0fe44..a9106f4 100644
@@ -29,5 +29,9 @@
 #undef CONFIG_DM_SPI
 #endif
 
+#undef CONFIG_DM_WARN
+#undef CONFIG_DM_DEVICE_REMOVE
+#undef CONFIG_DM_STDIO
+
 #endif /* CONFIG_SPL_BUILD */
 #endif /* __CONFIG_UNCMD_SPL_H__ */
scripts/Makefile.uncmd_spl +3 -1
index 0bb7d54..343c3fc 100644
@@ -1,6 +1,6 @@
 # Makefile version of include/config_uncmd_spl.h
 #
-# Invent a better way
+# TODO: Invent a better way
 
 ifdef CONFIG_SPL_BUILD
 CONFIG_OF_CONTROL=
@@ -13,4 +13,6 @@ CONFIG_DM_SPI=
 CONFIG_DM_SPI_FLASH=
 endif
 
+CONFIG_DM_DEVICE_REMOVE=
+
 endif
Signature · 1 line
1.9.1