Skip to contentSkip to conversation

kconfig: turnaround into single .config

PATCH Superseded Masahiro Yamada 4 participants 32 messages Feb 20, 2015 – Feb 25, 2015

Subsystems (10)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover kconfig: turnaround into single .config

Masahiro Yamada (6):
ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value
malloc_f: fix broken .config caused by CONFIG_SYS_MALLOC_F
malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len
kconfig: switch to single .config configuration
kconfig: remove unneeded dependency on !SPL_BUILD
malloc_f: enable SYS_MALLOC_F by default if DM is on

Simon Glass (1):
kconfig: Adjust ordering so that defaults work as expected

 Kconfig                                 |  32 +---
 arch/arm/Kconfig                        |   7 +-
 arch/arm/cpu/arm1176/bcm2835/Kconfig    |   6 +-
 arch/arm/cpu/armv7/exynos/Kconfig       |  30 ++--
 arch/arm/cpu/armv7/omap3/Kconfig        |  12 +-
 arch/arm/cpu/armv7/s5pc1xx/Kconfig      |   4 +-
 arch/arm/cpu/armv7/tegra-common/Kconfig |  20 ++-
 arch/arm/cpu/armv7/uniphier/Kconfig     |   8 -
 arch/x86/Kconfig                        |   6 +-
 board/amcc/canyonlands/Kconfig          |   8 -
 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                 |  12 +-
 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, 183 insertions(+), 512 deletions(-)
 create mode 100644 scripts/Makefile.uncmd_spl
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/7 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 v3: None
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 v3 2/7 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.

This commit corrects [1] and [2] so as not to create a broken .config file in any cases. Note that the default values in arch/arm/cpu/armv7/tegra-common/Kconfig and arch/x86/Kconfig are not working at this moment. This will be solved by the next commit.

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 v3:
- Drop comments "This is meaningless ..."
- Update commit description

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 | 2 +-
 arch/arm/cpu/armv7/uniphier/Kconfig     | 3 ---
 arch/x86/Kconfig                        | 2 +-
 board/amcc/canyonlands/Kconfig          | 4 ----
 board/ti/am335x/Kconfig                 | 3 ---
 8 files changed, 2 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 +1 -1
index ee32469..8b51558 100644
@@ -21,7 +21,7 @@ config SYS_MALLOC_F
 	default y
 
 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 +1 -1
index 35d24e4..65909e7 100644
@@ -80,7 +80,7 @@ config SYS_MALLOC_F
 	default y
 
 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
#3 lore raw

PATCH v3 2/7 malloc_f: fix broken .config caused by CONFIG_SYS_MALLOC_F

Hi Masahiro,

Quoted 50 lines · 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.

This commit corrects [1] and [2] so as not to create a broken .config file in any cases. Note that the default values in arch/arm/cpu/armv7/tegra-common/Kconfig and arch/x86/Kconfig are not working at this moment. This will be solved by the next commit.

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.

Quoted 8 lines

---

Changes in v3:
- Drop comments "This is meaningless ..."
- Update commit description

Changes in v2: None

I think it might have been better for this patch to merge with patch 4, since patch 3 fixes one of these problem. But it's not important.

#4 lore raw

PATCH v3 3/7 kconfig: Adjust ordering so that defaults work as expected

In reply to Masahiro Yamada

From: Simon Glass <[email protected]>

At present defaults in arch-specific Kconfig files are ignored if the top-level item comes ahead of it in include order. This means that it is not possible to have a U-Boot default that architectures and boards can override. This does not seem very useful.

Move the include earlier to support this.

---

Changes in v3:
- The same as what Simon posted
http://patchwork.ozlabs.org/patch/441670/
Included in this series to clarify the order

Changes in v2: None

 Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Kconfig +3 -2
index d40f9ec..351e5c9 100644
@@ -12,6 +12,9 @@ config KCONFIG_OBJDIR
 	string
 	option env="KCONFIG_OBJDIR"
 
+# Allow defaults in arch-specific code to override any given here
+source "arch/Kconfig"
+
 menu "General setup"
 
 config LOCALVERSION
@@ -171,8 +174,6 @@ config SYS_CLK_FREQ
 
 endmenu		# Boot images
 
-source "arch/Kconfig"
-
 source "common/Kconfig"
 
 source "dts/Kconfig"
Signature · 1 line
1.9.1
#5 lore raw

PATCH v3 4/7 malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len

In reply to Masahiro Yamada

Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden by SoC Kconfig file, but we still have to add the same conditional "if SYS_MALLOC_F" to every default. Otherwise, a broken .config file could be generated. It is too painful.

This commit intends to solve it by introducing SoC-default ARCH_MALLOC_F_LEN. This works as follows:

- If ARCH_MALLOC_F_LEN is defined, it overrides the default of SYS_MALLOC_F_LEN. If you have the SoC-optimized value, you might wish to do this.

- If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default to 0x400. This is the global default and it should work well enough in most cases.

- You can still change SYS_MALLOC_F_LEN per board, although you do not probably have to do so. Per-board default should be saved into each defconfig.

---

Changes in v3:
- Newly added

Changes in v2: None

 Kconfig                                 | 1 +
 arch/arm/cpu/armv7/tegra-common/Kconfig | 5 +++--
 arch/x86/Kconfig                        | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)
Kconfig +1 -0
index 351e5c9..cb5a6a8 100644
@@ -70,6 +70,7 @@ config SYS_MALLOC_F
 config SYS_MALLOC_F_LEN
 	hex "Size of malloc() pool before relocation"
 	depends on SYS_MALLOC_F
+	default ARCH_MALLOC_F_LEN if ARCH_MALLOC_F_LEN
 	default 0x400
 	help
 	  Before relocation memory is very limited on many platforms. Still,
arch/arm/cpu/armv7/tegra-common/Kconfig +3 -2
index 8b51558..c326106 100644
@@ -20,8 +20,9 @@ endchoice
 config SYS_MALLOC_F
 	default y
 
-config SYS_MALLOC_F_LEN
-	default 0x1800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+	hex
+	default 0x1800
 
 config USE_PRIVATE_LIBGCC
 	default y if SPL_BUILD
arch/x86/Kconfig +3 -2
index 65909e7..0e49dd3 100644
@@ -79,8 +79,9 @@ config DM_SERIAL
 config SYS_MALLOC_F
 	default y
 
-config SYS_MALLOC_F_LEN
-	default 0x800 if SYS_MALLOC_F
+config ARCH_MALLOC_F_LEN
+	hex
+	default 0x800
 
 config RAMBASE
 	hex
Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 4/7 malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len

Hi Masahiro,

Quoted 16 lines · Masahiro Yamada

Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden by SoC Kconfig file, but we still have to add the same conditional "if SYS_MALLOC_F" to every default. Otherwise, a broken .config file could be generated. It is too painful.

This commit intends to solve it by introducing SoC-default ARCH_MALLOC_F_LEN. This works as follows:

- If ARCH_MALLOC_F_LEN is defined, it overrides the default of SYS_MALLOC_F_LEN. If you have the SoC-optimized value, you might wish to do this.

- If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default to 0x400. This is the global default and it should work well enough in most cases.

Quoted 6 lines

- You can still change SYS_MALLOC_F_LEN per board, although you do not probably have to do so. Per-board default should be saved into each defconfig.

---

Seems like a reasonable solution to me. I have to admit I prefer to adding another option, but if that is the only way to avoid the broken Kconfig (which I think works fine but could be quite confusing for people) then so be it.

#7 lore raw

PATCH v3 4/7 malloc_f: add ARCH_MALLOC_F_LEN to specify SoC-default malloc_f_len

In reply to Masahiro Yamada

2015-02-20 14:24 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 16 lines

Now the default value of CONFIG_SYS_MALLOC_F_LEN can be overridden by SoC Kconfig file, but we still have to add the same conditional "if SYS_MALLOC_F" to every default. Otherwise, a broken .config file could be generated. It is too painful.

This commit intends to solve it by introducing SoC-default ARCH_MALLOC_F_LEN. This works as follows:

- If ARCH_MALLOC_F_LEN is defined, it overrides the default of SYS_MALLOC_F_LEN. If you have the SoC-optimized value, you might wish to do this.

- If ARCH_MALLOC_F_LEN is not defined, SYS_MALLOC_F_LEN is default to 0x400. This is the global default and it should work well enough in most cases.

Quoted 6 lines

- You can still change SYS_MALLOC_F_LEN per board, although you do not probably have to do so. Per-board default should be saved into each defconfig.

---

Sorry, this patch does not work at all.
I was completely misunderstanding.

I take it back.

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

PATCH v3 5/7 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 v3: None
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 cb5a6a8..bdaef56 100644
@@ -8,10 +8,6 @@ config UBOOTVERSION
 	string
 	option env="UBOOTVERSION"
 
-config KCONFIG_OBJDIR
-	string
-	option env="KCONFIG_OBJDIR"
-
 # Allow defaults in arch-specific code to override any given here
 source "arch/Kconfig"
 
@@ -90,16 +86,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 c326106..a3f5282 100644
@@ -25,7 +25,7 @@ config ARCH_MALLOC_F_LEN
 	default 0x1800
 
 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
#9 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

Quoted 59 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.

Quoted 5 lines

- update doc/README.kconfig

More cleaning up patches will follow this.

I notice with seaboard there is a bit of a code size different. But I don't think this matters.

06: kconfig: switch to single .config configuration

       arm: (for 1/1 boards)  all -839.0  bss +4.0  rodata -27.0

spl/u-boot-spl:all +16.0 spl/u-boot-spl:data +16.0 text -816.0
seaboard : all -839 bss +4 rodata -27
spl/u-boot-spl:all +16 spl/u-boot-spl:data +16 text -816
u-boot: add: 1/-11, grow: 0/-1 bytes: 4/-1352 (-1348)
function old new delta
__div0 - 4 +4
__aeabi_idiv0 12 - -12
__lshrdi3 24 - -24
__ashldi3 24 - -24
__aeabi_llsr 24 - -24
__aeabi_llsl 24 - -24
__ashrdi3 26 - -26
__aeabi_uidivmod 26 - -26
__aeabi_lasr 26 - -26
__aeabi_idivmod 26 - -26
raise 28 - -28
__udivsi3 604 152 -452
__divsi3 660 - -660
spl-u-boot-spl: add: 0/0, grow: 1/0 bytes: 16/0 (16)
function old new delta
gdata 184 200 +16

Regards,
Simon

#10 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

In reply to Masahiro Yamada
Quoted 11 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:

Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

Quoted 8 lines

[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.

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Quoted 3 lines

[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.

It seems like the root cause of this sprinkling is wanting to use default y to avoid touching a bunch of defconfig files, but not wanting to do the default y at the toplevel Kconfig. Maybe better tooling for bulk defconfig updates would help. In any case, couldn't you do CONFIG_SPL_DM currently, by making DM depend on "!SPL_BUILD || SPL_DM", without fundamentally changing the SPL kconfig infrastructure?

Why do symbols like LOCALVERSION and CC_OPTIMIZE_FOR_SIZE depend on ! SPL_BUILD?

Quoted 10 lines

[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 had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Quoted 6 lines

- 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.

How is uncmd_spl better than "!SPL_BUILD"?

-Scott

#11 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

Hi Scott,

Quoted 12 lines · On Mon, 23 Feb 2015 19:22:51 -0600 Scott Wood <[email protected]> wrote:
Quoted 11 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:

Quoted 7 lines
Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

Yes, it can as for "make *_defconfig".

If we modify some options in .config for example by "make menuconfig", we also modify some in spl/.config correspondingly.

Users are responsible for configure .config and spl/.config in sync in the sane combination.

Quoted 4 lines

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

To have independent symboles coexist in a single .config, I can only suggest to duplicate options like CONFIG_FOO=0x100
CONFIG_SPL_FOO=0x200
CONFIG_TPL_FOO=0x300

Quoted 3 lines

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

I guess it is possible for boolean options, but impossible to set hex/int options independently.

BTW, Ian's idea had been already achieved by include/config_uncmd_spl.h

Quoted 9 lines
Quoted 8 lines

[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.

Quoted 3 lines

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Do you mean something like this?

U-boot proper :   common/.config +     .config
SPL           :   common/.config +  spl/.config
TPL           :   common/.config +  tpl/.config
Quoted 8 lines
Quoted 3 lines

[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.

It seems like the root cause of this sprinkling is wanting to use default y to avoid touching a bunch of defconfig files, but not wanting to do the default y at the toplevel Kconfig. Maybe better tooling for bulk defconfig updates would help.

Yes. If we could move the default settings into defconfig files (and defconfig is just for that purpose), this problem would go away. But, in the duscussion with Simon and Alexey, we understood maintaining many defconfigs in sync is a pain.

Quoted 3 lines

In any case, couldn't you do
CONFIG_SPL_DM currently, by making DM depend on "!SPL_BUILD || SPL_DM", without fundamentally changing the SPL kconfig infrastructure?

As for the Driver Model options, the dependency descriptions will get ugly, but we won't carry them so long.
In a long run, all the boards will be converted and eventually CONFIG_DM will bocome the default.

Quoted 2 lines

Why do symbols like LOCALVERSION and CC_OPTIMIZE_FOR_SIZE depend on ! SPL_BUILD?

These two options are used by the top-level Makefile and it is automatically propagated to spl/*.

It is harmless to define them again in spl/.config, but meaningless.

Quoted 11 lines
Quoted 10 lines

[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.

Quoted 5 lines

I had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Not all, but I expect some duplicated CONFIG_TPL_* such as CONFIG_TPL_TEXT_BASE.

Currently, U-Boot runs SPL, TPL, and U-Boot proper in this order, but in hindsight, it might have been better to run
TPL, SPL, and U-Boot proper, in this order.
In 4KB memory footprint, it is impossible to include Driver Model. It would be a really ad-hoc implementation.

In the former order, we need CONFIG_TPL_DM,
but in the latter, we can save it.

I know TPL means "Third Program Loader", but
can we perhaps swap the order
if we assume TPL is the abbreviation of "Tiny Program Loader" ?

Quoted 8 lines
Quoted 6 lines

- 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.

How is uncmd_spl better than "!SPL_BUILD"?

We can use Kconfig as it is in Linux.

Best Regards
Masahiro Yamada

#12 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

Quoted 41 lines · Masahiro Yamada

Hi Scott,

Quoted 12 lines · On Mon, 23 Feb 2015 19:22:51 -0600 Scott Wood <[email protected]> wrote:
Quoted 11 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:

Quoted 7 lines
Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

Yes, it can as for "make *_defconfig".

If we modify some options in .config for example by "make menuconfig", we also modify some in spl/.config correspondingly.

Users are responsible for configure .config and spl/.config in sync in the sane combination.

Quoted 4 lines

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

Quoted 5 lines

To have independent symboles coexist in a single .config, I can only suggest to duplicate options like CONFIG_FOO=0x100
CONFIG_SPL_FOO=0x200
CONFIG_TPL_FOO=0x300

What I meant was a way to keep the configs separate, but automatically import the CONFIG_FOO from the SPL .config as CONFIG_SPL_FOO (or some other prefix that doesn't conflict with SPL-specific options).

Quoted 6 lines
Quoted 3 lines

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

I guess it is possible for boolean options, but impossible to set hex/int options independently.

How many hex/int options are there, that need to be different in SPL versus the main U-Boot? Having a few CONFIG_SPL_xxx for those is better than having a bunch.

Quoted 1 line

BTW, Ian's idea had been already achieved by include/config_uncmd_spl.h

So, the answer is to avoid kconfig and go back to using the preprocessor for configuration? :-(

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

[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.

Quoted 8 lines
Quoted 3 lines

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Do you mean something like this?

U-boot proper :   common/.config +     .config
SPL           :   common/.config +  spl/.config
TPL           :   common/.config +  tpl/.config

No, I meant having a fragment containing only "+S:CONFIG_SPL_FEL" that could be merged into any other config.

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

[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.

It seems like the root cause of this sprinkling is wanting to use default y to avoid touching a bunch of defconfig files, but not wanting to do the default y at the toplevel Kconfig. Maybe better tooling for bulk defconfig updates would help.

Quoted 4 lines

Yes. If we could move the default settings into defconfig files (and defconfig is just for that purpose), this problem would go away. But, in the duscussion with Simon and Alexey, we understood maintaining many defconfigs in sync is a pain.

I think that's a problem that needs to be solved regardless of SPL.

Quoted 8 lines
Quoted 3 lines

In any case, couldn't you do
CONFIG_SPL_DM currently, by making DM depend on "!SPL_BUILD || SPL_DM", without fundamentally changing the SPL kconfig infrastructure?

As for the Driver Model options, the dependency descriptions will get ugly, but we won't carry them so long.
In a long run, all the boards will be converted and eventually CONFIG_DM will bocome the default.

...so it's not a very good example of why the current situation must change.

Quoted 7 lines
Quoted 2 lines

Why do symbols like LOCALVERSION and CC_OPTIMIZE_FOR_SIZE depend on ! SPL_BUILD?

These two options are used by the top-level Makefile and it is automatically propagated to spl/*.

It is harmless to define them again in spl/.config, but meaningless.

...so not all of the existing !SPL_BUILD instances in Kconfig need to be there.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

[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.

Quoted 7 lines
Quoted 5 lines

I had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Not all, but I expect some duplicated CONFIG_TPL_* such as CONFIG_TPL_TEXT_BASE.

I'm not talking about TEXT_BASE. I'm talking about stuff like this:

#ifdef CONFIG_TPL_BUILD
#define CONFIG_SPL_NAND_BOOT
#define CONFIG_SPL_FLUSH_IMAGE
#define CONFIG_SPL_ENV_SUPPORT
#define CONFIG_SPL_NAND_INIT
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_I2C_SUPPORT
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
#define CONFIG_SPL_COMMON_INIT_DDR
#define CONFIG_SPL_MAX_SIZE (128 << 10)
#define CONFIG_SPL_TEXT_BASE 0xf8f81000
#define CONFIG_SYS_MPC85XX_NO_RESETVEC

#define CONFIG_SYS_NAND_U_BOOT_SIZE     (832 << 10)
#define CONFIG_SYS_NAND_U_BOOT_DST      (0x11000000)
#define CONFIG_SYS_NAND_U_BOOT_START    (0x11000000)
#define CONFIG_SYS_NAND_U_BOOT_OFFS     ((128 + 128) << 10)

#elif defined(CONFIG_SPL_BUILD)
#define CONFIG_SPL_INIT_MINIMAL
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SPL_FLUSH_IMAGE

#define CONFIG_SPL_TEXT_BASE            0xff800000
#define CONFIG_SPL_MAX_SIZE             4096
#define CONFIG_SYS_NAND_U_BOOT_SIZE     (128 << 10)
#define CONFIG_SYS_NAND_U_BOOT_DST      0xf8f80000 
#define CONFIG_SYS_NAND_U_BOOT_START    0xf8f80000 
#define CONFIG_SYS_NAND_U_BOOT_OFFS     (128 << 10)

#endif

If symbols like CONFIG_SPL_I2C_SUPPORT or CONFIG_SPL_COMMON_INIT_DDR get kconfigized, how would you handle them being in TPL but not SPL?

Quoted 3 lines

Currently, U-Boot runs SPL, TPL, and U-Boot proper in this order, but in hindsight, it might have been better to run
TPL, SPL, and U-Boot proper, in this order.

TPL is just makefile infrastructure for inserting an extra stage. It doesn't refer to the contents.

Quoted 2 lines

In 4KB memory footprint, it is impossible to include Driver Model. It would be a really ad-hoc implementation.

"Is", not "would be". And this applies to some SPL targets without TPL as well.

Quoted 6 lines

In the former order, we need CONFIG_TPL_DM,
but in the latter, we can save it.

I know TPL means "Third Program Loader", but
can we perhaps swap the order
if we assume TPL is the abbreviation of "Tiny Program Loader" ?

If you redefine TPL to mean SPL that doesn't use certain code, you'll end up with targets that have TPL but no SPL. Are you sure this is simplifying anything?

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

- 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.

How is uncmd_spl better than "!SPL_BUILD"?

We can use Kconfig as it is in Linux.

Not after this patch.

-Scott

#13 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

Hi Scott,

Quoted 48 lines · On Tue, 24 Feb 2015 18:17:59 -0600 Scott Wood <[email protected]> wrote:
Quoted 41 lines · Masahiro Yamada

Hi Scott,

Quoted 12 lines · On Mon, 23 Feb 2015 19:22:51 -0600 Scott Wood <[email protected]> wrote:
Quoted 11 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:

Quoted 7 lines
Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

Yes, it can as for "make *_defconfig".

If we modify some options in .config for example by "make menuconfig", we also modify some in spl/.config correspondingly.

Users are responsible for configure .config and spl/.config in sync in the sane combination.

Quoted 4 lines

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

Quoted 5 lines

To have independent symboles coexist in a single .config, I can only suggest to duplicate options like CONFIG_FOO=0x100
CONFIG_SPL_FOO=0x200
CONFIG_TPL_FOO=0x300

Quoted 3 lines

What I meant was a way to keep the configs separate, but automatically import the CONFIG_FOO from the SPL .config as CONFIG_SPL_FOO (or some other prefix that doesn't conflict with SPL-specific options).

What is the benefit of doing this?

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

I guess it is possible for boolean options, but impossible to set hex/int options independently.

How many hex/int options are there, that need to be different in SPL versus the main U-Boot? Having a few CONFIG_SPL_xxx for those is better than having a bunch.

OK.
But, I do not think we need to tweak the Kconfig just for saving boolean options.

Quoted 4 lines
Quoted 1 line

BTW, Ian's idea had been already achieved by include/config_uncmd_spl.h

So, the answer is to avoid kconfig and go back to using the preprocessor for configuration? :-(

I am not saying I prefer the preprocessor.

Indeed, include/config_uncmd_spl.h is ugly,
so I'd like to propose a better solution.

If we introduce CONFIG_SPL_DM, for example, the ifdef conditional in source files will be like this:

   #if  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)) || \
              (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DM))

[Driver Model Code]

   #else
              [Non Driver Model Code]
   #endif

This is too ugly to be written in each conditional.

So, I want to describe like this:

    #if IS_ENABLED_CONFIG(DM)
          [Driver Model Code]
    #else
          [Non Driver Model Code]
    #endif

I will post some patches later on.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 8 lines

[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.

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Quoted 7 lines
Quoted 4 lines

Do you mean something like this?

U-boot proper :   common/.config +     .config
SPL           :   common/.config +  spl/.config
TPL           :   common/.config +  tpl/.config

No, I meant having a fragment containing only "+S:CONFIG_SPL_FEL" that could be merged into any other config.

So, the fragment is something like the _common_ .config, right?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

[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.

It seems like the root cause of this sprinkling is wanting to use default y to avoid touching a bunch of defconfig files, but not wanting to do the default y at the toplevel Kconfig. Maybe better tooling for bulk defconfig updates would help.

Quoted 6 lines
Quoted 4 lines

Yes. If we could move the default settings into defconfig files (and defconfig is just for that purpose), this problem would go away. But, in the duscussion with Simon and Alexey, we understood maintaining many defconfigs in sync is a pain.

I think that's a problem that needs to be solved regardless of SPL.

Agree.
I think we can live the defaults in Kconfig, but I am still searching for a different solution.

Quoted 11 lines
Quoted 8 lines
Quoted 3 lines

In any case, couldn't you do
CONFIG_SPL_DM currently, by making DM depend on "!SPL_BUILD || SPL_DM", without fundamentally changing the SPL kconfig infrastructure?

As for the Driver Model options, the dependency descriptions will get ugly, but we won't carry them so long.
In a long run, all the boards will be converted and eventually CONFIG_DM will bocome the default.

...so it's not a very good example of why the current situation must change.

Right, but we still have many other options that can be enabled on SPL.

Quoted 25 lines
Quoted 7 lines
Quoted 2 lines

Why do symbols like LOCALVERSION and CC_OPTIMIZE_FOR_SIZE depend on ! SPL_BUILD?

These two options are used by the top-level Makefile and it is automatically propagated to spl/*.

It is harmless to define them again in spl/.config, but meaningless.

...so not all of the existing !SPL_BUILD instances in Kconfig need to be there.

Quoted 14 lines
Quoted 14 lines
Quoted 10 lines

[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 had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Not all, but I expect some duplicated CONFIG_TPL_* such as CONFIG_TPL_TEXT_BASE.

I'm not talking about TEXT_BASE. I'm talking about stuff like this:

We have to add some CONFIG_TPL_*, but we will just have 20.

Quoted 30 lines

#ifdef CONFIG_TPL_BUILD
#define CONFIG_SPL_NAND_BOOT
#define CONFIG_SPL_FLUSH_IMAGE
#define CONFIG_SPL_ENV_SUPPORT
#define CONFIG_SPL_NAND_INIT
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_I2C_SUPPORT
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
#define CONFIG_SPL_COMMON_INIT_DDR
#define CONFIG_SPL_MAX_SIZE (128 << 10)
#define CONFIG_SPL_TEXT_BASE 0xf8f81000
#define CONFIG_SYS_MPC85XX_NO_RESETVEC

#define CONFIG_SYS_NAND_U_BOOT_SIZE     (832 << 10)
#define CONFIG_SYS_NAND_U_BOOT_DST      (0x11000000)
#define CONFIG_SYS_NAND_U_BOOT_START    (0x11000000)
#define CONFIG_SYS_NAND_U_BOOT_OFFS     ((128 + 128) << 10)

#elif defined(CONFIG_SPL_BUILD)
#define CONFIG_SPL_INIT_MINIMAL
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SPL_FLUSH_IMAGE

#define CONFIG_SPL_TEXT_BASE            0xff800000
#define CONFIG_SPL_MAX_SIZE             4096
#define CONFIG_SYS_NAND_U_BOOT_SIZE     (128 << 10)
#define CONFIG_SYS_NAND_U_BOOT_DST      0xf8f80000 
#define CONFIG_SYS_NAND_U_BOOT_START    0xf8f80000 
#define CONFIG_SYS_NAND_U_BOOT_OFFS     (128 << 10)
Quoted 4 lines

#endif

If symbols like CONFIG_SPL_I2C_SUPPORT or CONFIG_SPL_COMMON_INIT_DDR get kconfigized, how would you handle them being in TPL but not SPL?

We can add CONFIG_TPL_* if necessary.
As I said, if we swap the order of SPL and TPL, we will be able to save CONFIG_TPL_* defines.

Quoted 16 lines
Quoted 3 lines

Currently, U-Boot runs SPL, TPL, and U-Boot proper in this order, but in hindsight, it might have been better to run
TPL, SPL, and U-Boot proper, in this order.

TPL is just makefile infrastructure for inserting an extra stage. It doesn't refer to the contents.

Quoted 2 lines

In 4KB memory footprint, it is impossible to include Driver Model. It would be a really ad-hoc implementation.

"Is", not "would be". And this applies to some SPL targets without TPL as well.

Quoted 3 lines

In the former order, we need CONFIG_TPL_DM,
but in the latter, we can save it.

Quoted 7 lines
Quoted 3 lines

I know TPL means "Third Program Loader", but
can we perhaps swap the order
if we assume TPL is the abbreviation of "Tiny Program Loader" ?

If you redefine TPL to mean SPL that doesn't use certain code, you'll end up with targets that have TPL but no SPL. Are you sure this is simplifying anything?

Sorry, I can't get it.
What I expect is like follows:

CONFIG_TPL still depends on CONFIG_SPL.

We have three options for the boot procedure:

[1] U-Boot-proper (CONFIG_SPL is not defined)

[2] SPL + U-Boot-proper (CONFIG_SPL is defined)

[3] TPL + SPL + U-Boot-proper (CONFIG_SPL and CONFIG_TPL are defined)

The image size: TPL < SPL < U-Boot-proper

Driver Model and some other features are available on SPL if CONFIG_SPL_* is defined.

Almost no systematic infrastructure is available on TPL, so we will have
very small number of CONFIG_TPL_*.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

- 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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

How is uncmd_spl better than "!SPL_BUILD"?

We can use Kconfig as it is in Linux.

Not after this patch.

Right, I need to do more cleanups for that.

Best Regards
Masahiro Yamada

#14 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

Hi,

Quoted 105 lines · Masahiro Yamada

Hi Scott,

Quoted 48 lines · On Tue, 24 Feb 2015 18:17:59 -0600 Scott Wood <[email protected]> wrote:
Quoted 41 lines · Masahiro Yamada

Hi Scott,

Quoted 12 lines · On Mon, 23 Feb 2015 19:22:51 -0600 Scott Wood <[email protected]> wrote:
Quoted 11 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:

Quoted 7 lines
Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

Yes, it can as for "make *_defconfig".

If we modify some options in .config for example by "make menuconfig", we also modify some in spl/.config correspondingly.

Users are responsible for configure .config and spl/.config in sync in the sane combination.

Quoted 4 lines

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

Quoted 5 lines

To have independent symboles coexist in a single .config, I can only suggest to duplicate options like CONFIG_FOO=0x100
CONFIG_SPL_FOO=0x200
CONFIG_TPL_FOO=0x300

Quoted 3 lines

What I meant was a way to keep the configs separate, but automatically import the CONFIG_FOO from the SPL .config as CONFIG_SPL_FOO (or some other prefix that doesn't conflict with SPL-specific options).

What is the benefit of doing this?

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

I guess it is possible for boolean options, but impossible to set hex/int options independently.

How many hex/int options are there, that need to be different in SPL versus the main U-Boot? Having a few CONFIG_SPL_xxx for those is better than having a bunch.

OK.
But, I do not think we need to tweak the Kconfig just for saving boolean options.

Quoted 4 lines
Quoted 1 line

BTW, Ian's idea had been already achieved by include/config_uncmd_spl.h

So, the answer is to avoid kconfig and go back to using the preprocessor for configuration? :-(

I am not saying I prefer the preprocessor.

Indeed, include/config_uncmd_spl.h is ugly,
so I'd like to propose a better solution.

If we introduce CONFIG_SPL_DM, for example, the ifdef conditional in source files will be like this:

   #if  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)) || \
              (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DM))

[Driver Model Code]

   #else
              [Non Driver Model Code]
   #endif

This is too ugly to be written in each conditional.

So, I want to describe like this:

Quoted 7 lines
    #if IS_ENABLED_CONFIG(DM)
          [Driver Model Code]
    #else
          [Non Driver Model Code]
    #endif

I will post some patches later on.

BTW it would be nice if we could compile the code even if it is not included (e.g with the compile-time IS_ENABLED(CONFIG_...)). Also for driver model I would like it to be supported the same in both SPL and U-Boot proper, to avoid this sort of thing. We are very close to merging the driver model SPL support.

[snip]

Regards,
Simon

#15 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

In reply to Masahiro Yamada
Quoted 54 lines · Masahiro Yamada

Hi Scott,

Quoted 48 lines · On Tue, 24 Feb 2015 18:17:59 -0600 Scott Wood <[email protected]> wrote:
Quoted 46 lines · Masahiro Yamada

Hi Scott,

Quoted 12 lines · On Mon, 23 Feb 2015 19:22:51 -0600 Scott Wood <[email protected]> wrote:
Quoted 11 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:

Quoted 7 lines
Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

Yes, it can as for "make *_defconfig".

If we modify some options in .config for example by "make menuconfig", we also modify some in spl/.config correspondingly.

Users are responsible for configure .config and spl/.config in sync in the sane combination.

Quoted 4 lines

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

To have independent symboles coexist in a single .config, I can only suggest to duplicate options like CONFIG_FOO=0x100
CONFIG_SPL_FOO=0x200
CONFIG_TPL_FOO=0x300

Quoted 5 lines
Quoted 3 lines

What I meant was a way to keep the configs separate, but automatically import the CONFIG_FOO from the SPL .config as CONFIG_SPL_FOO (or some other prefix that doesn't conflict with SPL-specific options).

What is the benefit of doing this?

So that you can express dependencies in the main U-Boot on SPL symbols, which you said was one of the problems that motivated this change.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

I guess it is possible for boolean options, but impossible to set hex/int options independently.

Quoted 6 lines
Quoted 3 lines

How many hex/int options are there, that need to be different in SPL versus the main U-Boot? Having a few CONFIG_SPL_xxx for those is better than having a bunch.

OK.
But, I do not think we need to tweak the Kconfig just for saving boolean options.

Most options are boolean (especially if you ignore hardware description that isn't going to differ between SPL and non-SPL). I think it makes a lot of sense to not want to duplicate them, and especially to not complicate each place that ifdefs on the symbol by having to check for SPL.

Quoted 16 lines
Quoted 4 lines
Quoted 1 line

BTW, Ian's idea had been already achieved by include/config_uncmd_spl.h

So, the answer is to avoid kconfig and go back to using the preprocessor for configuration? :-(

I am not saying I prefer the preprocessor.

Indeed, include/config_uncmd_spl.h is ugly,
so I'd like to propose a better solution.

If we introduce CONFIG_SPL_DM, for example, the ifdef conditional in source files will be like this:

   #if  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)) || \
              (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DM))
Quoted 7 lines

[Driver Model Code]

   #else
              [Non Driver Model Code]
   #endif

This is too ugly to be written in each conditional.

That's not what I was suggesting.

I was suggesting something like:

config DM

	bool "Enable Driver Model"
	depends on !SPL_BUILD || SPL_DM
	...

Then the ifdef would just be

#ifdef CONFIG_DM
[Driver Model Code]
#else
[Non Driver Model Code]
#endif

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 9 lines
Quoted 8 lines

[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.

Quoted 3 lines

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Do you mean something like this?

U-boot proper :   common/.config +     .config
SPL           :   common/.config +  spl/.config
TPL           :   common/.config +  tpl/.config
Quoted 4 lines
Quoted 2 lines

No, I meant having a fragment containing only "+S:CONFIG_SPL_FEL" that could be merged into any other config.

So, the fragment is something like the _common_ .config, right?

The fragment would be part of a library of common config tweaks that users can apply -- providing similar convenience as _felconfig but with generic infrastructure.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 10 lines

[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 had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Not all, but I expect some duplicated CONFIG_TPL_* such as CONFIG_TPL_TEXT_BASE.

I'm not talking about TEXT_BASE. I'm talking about stuff like this:

We have to add some CONFIG_TPL_*, but we will just have 20.

Just? And how much makefile crud to check for those options when building? To achieve what?

Quoted 18 lines
Quoted 3 lines

If you redefine TPL to mean SPL that doesn't use certain code, you'll end up with targets that have TPL but no SPL. Are you sure this is simplifying anything?

Sorry, I can't get it.
What I expect is like follows:

CONFIG_TPL still depends on CONFIG_SPL.

We have three options for the boot procedure:

[1] U-Boot-proper (CONFIG_SPL is not defined)

[2] SPL + U-Boot-proper (CONFIG_SPL is defined)

[3] TPL + SPL + U-Boot-proper (CONFIG_SPL and CONFIG_TPL are defined)

Quoted 6 lines

The image size: TPL < SPL < U-Boot-proper

Driver Model and some other features are available on SPL if CONFIG_SPL_* is defined.

Almost no systematic infrastructure is available on TPL, so we will have
very small number of CONFIG_TPL_*.

So instead of CONFIG_TPL_* we'd have more hardcoded makefile hackery to disable things in TPL -- and we'd have to duplicate that hackery for SPLs that are just as small as what you're now calling TPL, if you're not going to allow TPL without SPL.

-Scott

#16 lore raw

PATCH v3 5/7 kconfig: switch to single .config configuration

In reply to Scott Wood

Hi Scott,

Quoted 62 lines · Scott Wood
Quoted 11 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:

Quoted 5 lines

[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.

Sharing can happen in the defconfig with "+S:"...

What sort of dependencies are people wanting? Would it be possible to modify kconfig to import SPL .config into the main config (or vice versa?) with a name prefix so that dependencies could happen, without sacrificing the ability to set symbols independently?

Or as Ian suggested, have only the main config be user-editable, but still let select/depends turn certain things on/off for the auto-generated SPL config.

Quoted 8 lines

[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.

How about defconfig fragments? Instead of having script infrastructure specifically for CONFIG_SPL_FEL, merge a fragment containing "+S:CONFIG_SPL_FEL".

Quoted 3 lines

[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.

It seems like the root cause of this sprinkling is wanting to use default y to avoid touching a bunch of defconfig files, but not wanting to do the default y at the toplevel Kconfig. Maybe better tooling for bulk defconfig updates would help. In any case, couldn't you do CONFIG_SPL_DM currently, by making DM depend on "!SPL_BUILD || SPL_DM", without fundamentally changing the SPL kconfig infrastructure?

Why do symbols like LOCALVERSION and CC_OPTIMIZE_FOR_SIZE depend on ! SPL_BUILD?

Quoted 5 lines

[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.

Quoted 8 lines
Quoted 5 lines

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 had been hoping that the split configs would let us get rid of many of the CONFIG_SPL_* options that we already have.

As Masahiro says this will happen as we remove one by one the various SPL special cases. For example, when driver model supports SPL and U-Boot then we won't need that option - you will either use driver model (or not) for both. I suspect other options will go the same way.

But if things are split into multiple configs it is really hard to compare them and keep them in sync.

Once the dust settles I will be sending a series to remove the special cases around CONFIG_SPL_DM.

Quoted 4 lines

How will TPL be handled? Are you going to duplicate all the SPL symbols? Or just avoid ever kconfigizing them?

Quoted 8 lines
Quoted 6 lines

- 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.

How is uncmd_spl better than "!SPL_BUILD"?

Regards,
Simon

#17 lore raw

PATCH v3 6/7 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 v3: None
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 bdaef56..a66a97f 100644
@@ -15,7 +15,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.
@@ -26,7 +25,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
@@ -47,7 +45,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
@@ -95,23 +92,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
@@ -135,7 +128,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 a3f5282..2003fc8 100644
@@ -28,22 +28,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
#18 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

+Stephen

Hi Masahiro,

Quoted 34 lines · Masahiro Yamada

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

---

Changes in v3: None
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(-)

[snip]

arch/arm/Kconfig config TEGRA · line 743

Quoted 13 lines
arch/arm/Kconfig +2 -3
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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

Regards,
Simon

#19 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Quoted 17 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 12 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -1
index 41f3220..700e2a8 100644
@@ -739,9 +739,8 @@ config TEGRA
         bool "NVIDIA Tegra"
         select SUPPORT_SPL
         select SPL
-       select OF_CONTROL if !SPL_BUILD
Quoted 8 lines

arch/arm/Kconfig config TEGRA · line 743

Quoted 4 lines
arch/arm/Kconfig +2 -2
-       select CPU_ARM720T if SPL_BUILD
-       select CPU_V7 if !SPL_BUILD
+       select OF_CONTROL
+       select CPU_V7

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

Yes, on Tegra SPL runs on an ARMv4t and main U-Boot on some ARMv7 CPU. The change above is actively incorrect.

The OF_CONTROL change is probably incorrect too; we certainly don't intend to use OF_CONTROL in the SPL (there's really nothing to control in the SPL) - I just don't know if enabling that feature will cause any issue. Things to look out for would be bloat of the SPL binary so that it didn't fit into the space before the main binary's TEXT_BASE, since the two get concatenated together into a single binary that's loaded into RAM, and XIP'd.

#20 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi,

Quoted 36 lines · Stephen Warren
Quoted 22 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 15 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -2
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
Quoted 8 lines

arch/arm/Kconfig config TEGRA · line 743

Quoted 3 lines
arch/arm/Kconfig +2 -1
-       select CPU_V7 if !SPL_BUILD
+       select OF_CONTROL
+       select CPU_V7

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

Yes, on Tegra SPL runs on an ARMv4t and main U-Boot on some ARMv7 CPU. The change above is actively incorrect.

Quoted 6 lines

The OF_CONTROL change is probably incorrect too; we certainly don't intend to use OF_CONTROL in the SPL (there's really nothing to control in the SPL)
- I just don't know if enabling that feature will cause any issue. Things to look out for would be bloat of the SPL binary so that it didn't fit into the space before the main binary's TEXT_BASE, since the two get concatenated together into a single binary that's loaded into RAM, and XIP'd.

This at least is not a problem with this patch.

I'll make some time to take a look at this in the next few days.

Regards,
Simon

#21 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Quoted 10 lines
Quoted 9 lines

Yes, on Tegra SPL runs on an ARMv4t and main U-Boot on some ARMv7 CPU. The change above is actively incorrect.

The OF_CONTROL change is probably incorrect too; we certainly don't intend to use OF_CONTROL in the SPL (there's really nothing to control in the SPL)
- I just don't know if enabling that feature will cause any issue. Things to look out for would be bloat of the SPL binary so that it didn't fit into the space before the main binary's TEXT_BASE, since the two get concatenated together into a single binary that's loaded into RAM, and XIP'd.

Quoted 4 lines

This at least is not a problem with this patch.

I'll make some time to take a look at this in the next few days.

As for CONFIG_OF_CONTROL, I think my answer is already in the git-description. I wrote as follows:

- 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.

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

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Masahiro,

Quoted 54 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

Quoted 5 lines

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Quoted 21 lines
Quoted 13 lines
Quoted 6 lines

Yes, on Tegra SPL runs on an ARMv4t and main U-Boot on some ARMv7 CPU. The change above is actively incorrect.

Quoted 6 lines

The OF_CONTROL change is probably incorrect too; we certainly don't intend to use OF_CONTROL in the SPL (there's really nothing to control in the SPL)
- I just don't know if enabling that feature will cause any issue. Things to look out for would be bloat of the SPL binary so that it didn't fit into the space before the main binary's TEXT_BASE, since the two get concatenated together into a single binary that's loaded into RAM, and XIP'd.

Quoted 4 lines

This at least is not a problem with this patch.

I'll make some time to take a look at this in the next few days.

As for CONFIG_OF_CONTROL, I think my answer is already in the git-description. I wrote as follows:

Quoted 6 lines

- 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.

So I thnk we are OK. I will give it all a test on Tegra.

Regards,
Simon

#23 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Simon,

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

Quoted 57 lines

Hi Masahiro,

Quoted 54 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

Quoted 8 lines
Quoted 5 lines

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

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

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Masahiro,

Quoted 63 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 59 lines

Hi Masahiro,

Quoted 56 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

I have pushed my tested tree to u-boot-x86 in branch single-kconfig-for-masahiro.

It contains only these patches:

ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value
kconfig: Adjust ordering so that defaults work as expected
kconfig: switch to single .config configuration
kconfig: remove unneeded dependency on !SPL_BUILD

Perhaps we can look at the others later once we get things moved over? I think the SYS_MALLOC_F thing is not that big a deal and not urgent to resolve if we still have a problem.

Regards,
Simon

#25 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Quoted 78 lines · Simon Glass

Hi Masahiro,

Quoted 63 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 59 lines

Hi Masahiro,

Quoted 56 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

Quoted 6 lines

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

Depending on the toolchain, we actively need USE_PRIVATE_LIBGCC for SPL, and don't /need/ it for non-SPL. However, enabling USE_PRIVATE_LIBGCC for non-SPL likely won't hurt.

The issue is that the libgcc bundled with most compilers is for ARMv7 (since we tend to use ARMv7 compilers, since the main U-boot is built for ARMv7). That bundled libgcc won't work on the ARMv4 that runs the SPL, so we need USE_PRIVATE_LIBGCC there. The private libgcc bundled with U-Boot should work fine when built for either CPU, so it is OK to always use it, rather than only use it when strictly needed.

#26 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Stephen,

Quoted 110 lines · Stephen Warren
Quoted 97 lines · Simon Glass

Hi Masahiro,

Quoted 82 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 77 lines

Hi Masahiro,

Quoted 71 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 44 lines

Hi,

Quoted 39 lines · Stephen Warren
Quoted 37 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 12 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the
SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only
reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Quoted 5 lines
Quoted 2 lines

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

Quoted 6 lines

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

Depending on the toolchain, we actively need USE_PRIVATE_LIBGCC for SPL, and don't /need/ it for non-SPL. However, enabling USE_PRIVATE_LIBGCC for non-SPL likely won't hurt.

Quoted 6 lines

The issue is that the libgcc bundled with most compilers is for ARMv7 (since we tend to use ARMv7 compilers, since the main U-boot is built for ARMv7). That bundled libgcc won't work on the ARMv4 that runs the SPL, so we need USE_PRIVATE_LIBGCC there. The private libgcc bundled with U-Boot should work fine when built for either CPU, so it is OK to always use it, rather than only use it when strictly needed.

Ah yes, I think I knew that once. So in short Masahiro's patch here should be fine.

Regards,
Simon

#27 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Hi Simon, Stephen,

Quoted 120 lines · On Mon, 23 Feb 2015 10:44:54 -0700 Simon Glass <[email protected]> wrote:

Hi Stephen,

Quoted 110 lines · Stephen Warren
Quoted 97 lines · Simon Glass

Hi Masahiro,

Quoted 82 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 77 lines

Hi Masahiro,

Quoted 71 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 44 lines

Hi,

Quoted 39 lines · Stephen Warren
Quoted 37 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 12 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the
SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only
reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Quoted 5 lines
Quoted 2 lines

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

Quoted 6 lines

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

Depending on the toolchain, we actively need USE_PRIVATE_LIBGCC for SPL, and don't /need/ it for non-SPL. However, enabling USE_PRIVATE_LIBGCC for non-SPL likely won't hurt.

Quoted 6 lines

The issue is that the libgcc bundled with most compilers is for ARMv7 (since we tend to use ARMv7 compilers, since the main U-boot is built for ARMv7). That bundled libgcc won't work on the ARMv4 that runs the SPL, so we need USE_PRIVATE_LIBGCC there. The private libgcc bundled with U-Boot should work fine when built for either CPU, so it is OK to always use it, rather than only use it when strictly needed.

Quoted 3 lines

Ah yes, I think I knew that once. So in short Masahiro's patch here should be fine.

Yes, Stephen explained all about my intention.

I think CONFIG_USE_PRIVATE_LIBGCC is also necessary for Raspberry Pi 1 for example.

Moreover, I had already posted this patch:
http://patchwork.ozlabs.org/patch/438360/

I'd like to expand the private library to all the ARM boards.

Linux Kernel includes the library in its source tree.

I think it is generally a good idea to reduce the depencendy on particular toolchains. Agree?

Best Regards
Masahiro Yamada

#28 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

Quoted 127 lines · Masahiro Yamada

Hi Simon, Stephen,

Quoted 120 lines · On Mon, 23 Feb 2015 10:44:54 -0700 Simon Glass <[email protected]> wrote:

Hi Stephen,

Quoted 116 lines · Stephen Warren
Quoted 97 lines · Simon Glass

Hi Masahiro,

Quoted 82 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 77 lines

Hi Masahiro,

Quoted 71 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 44 lines

Hi,

Quoted 39 lines · Stephen Warren
Quoted 37 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 12 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the
SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only
reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Quoted 5 lines
Quoted 2 lines

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

Quoted 6 lines

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

Depending on the toolchain, we actively need USE_PRIVATE_LIBGCC for SPL, and don't /need/ it for non-SPL. However, enabling USE_PRIVATE_LIBGCC for non-SPL likely won't hurt.

The issue is that the libgcc bundled with most compilers is for ARMv7 (since we tend to use ARMv7 compilers, since the main U-boot is built for ARMv7). That bundled libgcc won't work on the ARMv4 that runs the SPL, so we need USE_PRIVATE_LIBGCC there. The private libgcc bundled with U-Boot should work fine when built for either CPU, so it is OK to always use it, rather than only use it when strictly needed.

Quoted 8 lines
Quoted 3 lines

Ah yes, I think I knew that once. So in short Masahiro's patch here should be fine.

Yes, Stephen explained all about my intention.

I think CONFIG_USE_PRIVATE_LIBGCC is also necessary for Raspberry Pi 1 for example.

I can't remember if it's already set for the Pi. If not, the toolchains I use happen not to need it:-)

Quoted 10 lines

Moreover, I had already posted this patch:
http://patchwork.ozlabs.org/patch/438360/

I'd like to expand the private library to all the ARM boards.

Linux Kernel includes the library in its source tree.

I think it is generally a good idea to reduce the depencendy on particular toolchains. Agree?

I tend to agree. However, in the past, Wolfgang Denk has argued against (ever?) using that option, claiming people should just use the correct toolchain.

#29 lore raw

PATCH v3 6/7 kconfig: remove unneeded dependency on !SPL_BUILD

In reply to Simon Glass

Hi Simon,

Quoted 90 lines · On Mon, 23 Feb 2015 07:02:25 -0700 Simon Glass <[email protected]> wrote:

Hi Masahiro,

Quoted 63 lines · Masahiro YAMADA

Hi Simon,

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

Quoted 59 lines

Hi Masahiro,

Quoted 56 lines · Masahiro YAMADA

Hi Simon, Stephen,

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

Quoted 34 lines

Hi,

Quoted 31 lines · Stephen Warren
Quoted 30 lines · Simon Glass

+Stephen

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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

arch/arm/Kconfig +0 -0
index 41f3220..700e2a8 100644

arch/arm/Kconfig config TEGRA · line 743

Quoted 8 lines
arch/arm/Kconfig +2 -3
@@ -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

Sorry if I have missed something here. On Tegra most unfortunately the SPL uses ARMv4t and U-Boot proper uses ARMv7. In fact that is the only reason that Tegra has SPL. Doesn't this change with this commit?

No. I think behavior is still the same as before.

In a single .config, we cannot define two CPUs in Kconfig.

So, we only define CPU_V7, for the main processors.

For SPL, we override the "CPU" in config.mk

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif

I know what you might be saying is, this is too ugly. Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I think we can do a little better with further rafactoring, but the basic idea is, SPL of Tegra is a special case.

Yes I saw that, I understand now. So SPL_BUILD is no longer available in Kconfig, but is still available in Makefiles, right?

Yes, exactly!

This all works fine on Tegra for me. However I like to suggest dropping a few patches in this series.

I don't think it is worth using ARCH_MALLOC_F_LEN. In fact for me the Tegra defconfig looks OK and SPL is built correctly.

My remaining question is about that Tegra seems to want USE_PRIVATE_LIBGCC for SPL but not for U-Boot. I'm not sure why, nor whether it matters. It seems to work find using it for both.

I have pushed my tested tree to u-boot-x86 in branch single-kconfig-for-masahiro.

It contains only these patches:

Quoted 8 lines

ARM: UniPhier: set CONFIG_SYS_MALLOC_F to the global default value
kconfig: Adjust ordering so that defaults work as expected
kconfig: switch to single .config configuration
kconfig: remove unneeded dependency on !SPL_BUILD

Perhaps we can look at the others later once we get things moved over? I think the SYS_MALLOC_F thing is not that big a deal and not urgent to resolve if we still have a problem.

OK. Let's go with these four.

Including SYS_MALLOC_F things makes the point of this series blurred.

I have just posted v5.

Mashiro Yamada

#30 lore raw

PATCH v3 7/7 malloc_f: enable SYS_MALLOC_F by default if DM is on

In reply to Masahiro Yamada

To use Derive Model before relocation, CONFIG_SYS_MALLOC_F must be enabled. This should probably be a common requirement for all the boards with Driver Model implementation. Let's handle it globally rather than per-SoC or per-board.

---

Changes in v3:
- Newly added

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 | 3 ---
 arch/arm/cpu/armv7/uniphier/Kconfig     | 3 ---
 arch/x86/Kconfig                        | 3 ---
 board/amcc/canyonlands/Kconfig          | 4 ----
 board/ti/am335x/Kconfig                 | 3 ---
 8 files changed, 1 insertion(+), 22 deletions(-)
Kconfig +1 -0
index a66a97f..2ddec81 100644
@@ -54,6 +54,7 @@ config CC_OPTIMIZE_FOR_SIZE
 
 config SYS_MALLOC_F
 	bool "Enable malloc() pool before relocation"
+	default y if DM
 	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 9e47ed3..bd7540a 100644
@@ -80,9 +80,6 @@ config DM_SPI_FLASH
 config DM_GPIO
 	default y
 
-config SYS_MALLOC_F
-	default y
-
 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 b3d5ef3..a38d471 100644
@@ -102,9 +102,6 @@ config DM_GPIO
 config DM_SERIAL
 	default y if DM
 
-config SYS_MALLOC_F
-	default y if DM
-
 config SYS_SOC
 	default "omap3"
 
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -3
index 2003fc8..b1c4f2a 100644
@@ -17,9 +17,6 @@ config TEGRA124
 
 endchoice
 
-config SYS_MALLOC_F
-	default y
-
 config ARCH_MALLOC_F_LEN
 	hex
 	default 0x1800
arch/arm/cpu/armv7/uniphier/Kconfig +0 -3
index b6dc75f..20e20a5 100644
@@ -48,9 +48,6 @@ config DCC_MICRO_SUPPORT_CARD
 
 endchoice
 
-config SYS_MALLOC_F
-	default y
-
 config CMD_PINMON
 	bool "Enable boot mode pins monitor command"
 	default y
arch/x86/Kconfig +0 -3
index 0e49dd3..46caa6d 100644
@@ -76,9 +76,6 @@ config DM_GPIO
 config DM_SERIAL
 	default y
 
-config SYS_MALLOC_F
-	default y
-
 config ARCH_MALLOC_F_LEN
 	hex
 	default 0x800
board/amcc/canyonlands/Kconfig +0 -4
index c0dbd18..46efa7a 100644
@@ -39,8 +39,4 @@ config DM
 config DM_SERIAL
 	default y
 
-config SYS_MALLOC_F
-	bool
-	default y
-
 endif
board/ti/am335x/Kconfig +0 -3
index 8c45892..7cb006f 100644
@@ -47,7 +47,4 @@ config DM_GPIO
 config DM_SERIAL
 	default y if DM
 
-config SYS_MALLOC_F
-	default y if DM
-
 endif
Signature · 1 line
1.9.1
#31 lore raw

PATCH v3 7/7 malloc_f: enable SYS_MALLOC_F by default if DM is on

Hi Masahiro,

Quoted 1 line · Masahiro Yamada

To use Derive Model before relocation, CONFIG_SYS_MALLOC_F

Driver

Quoted 3 lines

must be enabled. This should probably be a common requirement for all the boards with Driver Model implementation. Let's handle it globally rather than per-SoC or per-board.

This seems reasonable to me.

Quoted 127 lines

---

Changes in v3:
- Newly added

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 | 3 ---
 arch/arm/cpu/armv7/uniphier/Kconfig     | 3 ---
 arch/x86/Kconfig                        | 3 ---
 board/amcc/canyonlands/Kconfig          | 4 ----
 board/ti/am335x/Kconfig                 | 3 ---
 8 files changed, 1 insertion(+), 22 deletions(-)
Kconfig +1 -0
index a66a97f..2ddec81 100644
@@ -54,6 +54,7 @@ config CC_OPTIMIZE_FOR_SIZE
 
 config SYS_MALLOC_F
        bool "Enable malloc() pool before relocation"
+       default y if DM
        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 9e47ed3..bd7540a 100644
@@ -80,9 +80,6 @@ config DM_SPI_FLASH
 config DM_GPIO
        default y
 
-config SYS_MALLOC_F
-       default y
-
 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 b3d5ef3..a38d471 100644
@@ -102,9 +102,6 @@ config DM_GPIO
 config DM_SERIAL
        default y if DM
 
-config SYS_MALLOC_F
-       default y if DM
-
 config SYS_SOC
        default "omap3"
 
arch/arm/cpu/armv7/tegra-common/Kconfig +0 -3
index 2003fc8..b1c4f2a 100644
@@ -17,9 +17,6 @@ config TEGRA124
 
 endchoice
 
-config SYS_MALLOC_F
-       default y
-
 config ARCH_MALLOC_F_LEN
        hex
        default 0x1800
arch/arm/cpu/armv7/uniphier/Kconfig +0 -3
index b6dc75f..20e20a5 100644
@@ -48,9 +48,6 @@ config DCC_MICRO_SUPPORT_CARD
 
 endchoice
 
-config SYS_MALLOC_F
-       default y
-
 config CMD_PINMON
        bool "Enable boot mode pins monitor command"
        default y
arch/x86/Kconfig +0 -3
index 0e49dd3..46caa6d 100644
@@ -76,9 +76,6 @@ config DM_GPIO
 config DM_SERIAL
        default y
 
-config SYS_MALLOC_F
-       default y
-
 config ARCH_MALLOC_F_LEN
        hex
        default 0x800
board/amcc/canyonlands/Kconfig +0 -4
index c0dbd18..46efa7a 100644
@@ -39,8 +39,4 @@ config DM
 config DM_SERIAL
        default y
 
-config SYS_MALLOC_F
-       bool
-       default y
-
 endif
board/ti/am335x/Kconfig +0 -4
index 8c45892..7cb006f 100644
@@ -47,7 +47,4 @@ config DM_GPIO
 config DM_SERIAL
        default y if DM
 
-config SYS_MALLOC_F
-       default y if DM
-
 endif
--
Quoted 2 lines

1.9.1

Regards,
Simon