Skip to contentSkip to conversation

Allow defconfigs defined from fragments

RFC PATCH In review Andrew Davis 4 participants 10 messages Aug 29, 2023 – Aug 31, 2023 Kconfig

lore
Share & tools
lore
#0 lore raw

cover Allow defconfigs defined from fragments

Hello all,

For context see thread ending here[0].

Thanks,
Andrew

[0] https://marc.info/?l=u-boot&m=169333616210919&w=2

Andrew Davis (2):
Makefile: Run defconfig files through the C preprocessor
configs: Add am62x_beagleplay_* defconfigs

 configs/am62x_beagleplay_a53_defconfig | 3 +++
 configs/am62x_beagleplay_r5_defconfig  | 3 +++
 scripts/kconfig/Makefile               | 3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 configs/am62x_beagleplay_a53_defconfig
 create mode 100644 configs/am62x_beagleplay_r5_defconfig
Signature · 1 line
2.39.2
#1 lore raw

RFC PATCH 1/2 Makefile: Run defconfig files through the C preprocessor

This allows us to use some of the normal preprocessor directives inside defconfig files. Such as #define and #include.

---
 scripts/kconfig/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/Makefile +2 -1
index 12e525ee31f..16db9b7cf60 100644
@@ -93,7 +93,8 @@ endif
 endif
 
 %_defconfig: $(obj)/conf
-	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+	$(Q)$(CPP) -nostdinc -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
+	$(Q)$< $(silent) --defconfig=generated_defconfig $(Kconfig)
 
 # Added for U-Boot (backward compatibility)
 %_config: %_defconfig
Signature · 1 line
2.39.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [RFC PATCH 1/2] Makefile: Run defconfig files through the C preprocessor

Hi Andrew,

Quoted 24 lines · Andrew Davis

This allows us to use some of the normal preprocessor directives inside defconfig files. Such as #define and #include.

---
 scripts/kconfig/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/Makefile +2 -2
index 12e525ee31f..16db9b7cf60 100644
@@ -93,7 +93,8 @@ endif
 endif
 
 %_defconfig: $(obj)/conf
-       $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+       $(Q)$(CPP) -nostdinc -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
+       $(Q)$< $(silent) --defconfig=generated_defconfig $(Kconfig)
 
 # Added for U-Boot (backward compatibility)
 %_config: %_defconfig
--
Quoted 2 lines

2.39.2

Can you please check what happens if the file has an error flagged by CPP? Is it obvious what is wrong?

Regards,
Simon

#3 lore raw

RFC PATCH 2/2 configs: Add am62x_beagleplay_* defconfigs

In reply to Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 configs/am62x_beagleplay_r5_defconfig  | 3 +++
 2 files changed, 6 insertions(+)
 create mode 100644 configs/am62x_beagleplay_a53_defconfig
 create mode 100644 configs/am62x_beagleplay_r5_defconfig
configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2
#4 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

Quoted 36 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 configs/am62x_beagleplay_r5_defconfig  | 3 +++
 2 files changed, 6 insertions(+)
 create mode 100644 configs/am62x_beagleplay_a53_defconfig
 create mode 100644 configs/am62x_beagleplay_r5_defconfig
configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

This information can be in a single txt file Rather than have a defconfig file for each combination.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#5 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

Quoted 41 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
 configs/am62x_beagleplay_a53_defconfig | 3 +++
 configs/am62x_beagleplay_r5_defconfig  | 3 +++
 2 files changed, 6 insertions(+)
 create mode 100644 configs/am62x_beagleplay_a53_defconfig
 create mode 100644 configs/am62x_beagleplay_r5_defconfig
configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

Quoted 8 lines

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

This information can be in a single txt file Rather than have a defconfig file for each combination.

I know Andrew is trying to do what Simon's asked. But yes, this is why I don't think the right approach is to have some file that says "here are all of the valid combinations". We aren't going to be breaking "make am62x_beagleplay_r5_dfu_defconfig local-fragment.config" in the above example. And we don't need every possible combination in CI, we just need to make sure unique paths are tested. So long as something builds all of the dts files, the Tegra example in-tree now is fine because we're checking all of those. The beagle examples here too should be fine.

Signature · 1 line
Tom
#6 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

In reply to Nishanth Menon
Quoted 41 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
  configs/am62x_beagleplay_a53_defconfig | 3 +++
  configs/am62x_beagleplay_r5_defconfig  | 3 +++
  2 files changed, 6 insertions(+)

create mode 100644 configs/am62x_beagleplay_a53_defconfig create mode 100644 configs/am62x_beagleplay_r5_defconfig

configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

Quoted 9 lines

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

This information can be in a single txt file Rather than have a defconfig file for each combination.

Having every combination in a text file vs in a directory of files doesn't seem like much difference to me. cat combinations.txt vs ls -l configs/. But using a file would mean extra tooling and non-standard usage.

Let's simply try to avoid these combinatorial problems by avoiding adding too many fragments that apply broadly. That adds testing burden. When features need added/removed, folks can use menuconfig or similar. We shouldn't need a defconfig fragment for DFU..

Andrew

#7 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

Quoted 48 lines · Andrew Davis
Quoted 47 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
  configs/am62x_beagleplay_a53_defconfig | 3 +++
  configs/am62x_beagleplay_r5_defconfig  | 3 +++
  2 files changed, 6 insertions(+)

create mode 100644 configs/am62x_beagleplay_a53_defconfig create mode 100644 configs/am62x_beagleplay_r5_defconfig

configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

Quoted 7 lines
Quoted 3 lines

This information can be in a single txt file Rather than have a defconfig file for each combination.

Having every combination in a text file vs in a directory of files doesn't seem like much difference to me. cat combinations.txt vs ls -l configs/. But using a file would mean extra tooling and non-standard usage.

The .config usage is a standard already in kernel - nothing new there.

What we are attempting to solve is CI build coverage and test aspect of things.

Thinking aloud here:
some sort of board/<vendor>/<board>/ci.conf yaml could probably be a better approach with description of build, automated test information, potentially board revisions etc.

Quoted 2 lines

Let's simply try to avoid these combinatorial problems by avoiding adding too many fragments that apply broadly. That adds testing burden. When features

The combinations will be valid since the intent is a supported configuration.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#8 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

Quoted 53 lines · Nishanth Menon
Quoted 52 lines · Andrew Davis
Quoted 50 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
   configs/am62x_beagleplay_a53_defconfig | 3 +++
   configs/am62x_beagleplay_r5_defconfig  | 3 +++
   2 files changed, 6 insertions(+)

create mode 100644 configs/am62x_beagleplay_a53_defconfig create mode 100644 configs/am62x_beagleplay_r5_defconfig

configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -0
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
Signature · 1 line
2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

This information can be in a single txt file Rather than have a defconfig file for each combination.

Quoted 9 lines
Quoted 3 lines

Having every combination in a text file vs in a directory of files doesn't seem like much difference to me. cat combinations.txt vs ls -l configs/. But using a file would mean extra tooling and non-standard usage.

The .config usage is a standard already in kernel - nothing new there.

What we are attempting to solve is CI build coverage and test aspect of things.

Exactly, when I say "standard" I mean CI standard, which is to take all the configs/* and build them. No parsing these new combination files needed. Just add a new configs/xx_defconfig for a combination you want to be CI tested and you are done.

Quoted 11 lines

Thinking aloud here:
some sort of board/<vendor>/<board>/ci.conf yaml could probably be a better approach with description of build, automated test information, potentially board revisions etc.

Quoted 2 lines

Let's simply try to avoid these combinatorial problems by avoiding adding too many fragments that apply broadly. That adds testing burden. When features

The combinations will be valid since the intent is a supported configuration.

In theory anything you do in menuconfig should result in a valid configuration (if we have our kconfig symbol dependencies in order). And randomconfig testing can handle that. The combinations we want always tested should be limited, and making each have a dedicated configs/ file does that.

Andrew

Reviewed-by
#9 lore raw

Re: [RFC PATCH 2/2] configs: Add am62x_beagleplay_* defconfigs

Hi,

Quoted 78 lines · Andrew Davis
Quoted 53 lines · Nishanth Menon
Quoted 52 lines · Andrew Davis
Quoted 50 lines · Nishanth Menon
Quoted 34 lines · Andrew Davis

Add am62x_beagleplay_r5_defconfig for R5 SPL and am62x_beagleplay_a53_defconfig for A53 SPL and U-Boot support.

These defconfigs are composite defconfigs built from the config fragment board/ti/am62x/beagleplay_*.config applied onto the base am62x_evm_*_defconfig.

---
   configs/am62x_beagleplay_a53_defconfig | 3 +++
   configs/am62x_beagleplay_r5_defconfig  | 3 +++
   2 files changed, 6 insertions(+)

create mode 100644 configs/am62x_beagleplay_a53_defconfig create mode 100644 configs/am62x_beagleplay_r5_defconfig

configs/am62x_beagleplay_a53_defconfig new file +3 -0
new file mode 100644
index 00000000000..ad708e15397
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for A53 core
+#include "configs/am62x_evm_a53_defconfig"
+#include "board/ti/am62x/beagleplay_a53.config"
configs/am62x_beagleplay_r5_defconfig new file +3 -1
new file mode 100644
index 00000000000..276b1f81a3e
@@ -0,0 +1,3 @@
+// The BeaglePlay defconfig for R5 core
+#include "configs/am62x_evm_r5_defconfig"
+#include "board/ti/am62x/beagleplay_r5.config"
--
Quoted 2 lines

2.39.2

my only complaint is that if we add lets say
board/ti/am62x/dfu.config, Then:

R5:
1. am62x_evm_r5_defconfig = am62x_evm_r5_defconfig
2. am62x_beagleplay_r5_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config
3. am62x_evm_r5_dfu_defconfig = am62x_evm_r5_defconfig + dfu.config
4. am62x_beagleplay_r5_dfu_defconfig = am62x_evm_r5_defconfig + beagleplay_r5.config + dfu.config

This information can be in a single txt file Rather than have a defconfig file for each combination.

Quoted 9 lines
Quoted 3 lines

Having every combination in a text file vs in a directory of files doesn't seem like much difference to me. cat combinations.txt vs ls -l configs/. But using a file would mean extra tooling and non-standard usage.

The .config usage is a standard already in kernel - nothing new there.

What we are attempting to solve is CI build coverage and test aspect of things.

Exactly, when I say "standard" I mean CI standard, which is to take all the configs/* and build them. No parsing these new combination files needed. Just add a new configs/xx_defconfig for a combination you want to be CI tested and you are done.

Quoted 8 lines

Thinking aloud here:
some sort of board/<vendor>/<board>/ci.conf yaml could probably be a better approach with description of build, automated test information, potentially board revisions etc.

Quoted 2 lines

Let's simply try to avoid these combinatorial problems by avoiding adding too many fragments that apply broadly. That adds testing burden. When features

Quoted 8 lines
Quoted 3 lines

The combinations will be valid since the intent is a supported configuration.

In theory anything you do in menuconfig should result in a valid configuration (if we have our kconfig symbol dependencies in order). And randomconfig testing can handle that. The combinations we want always tested should be limited, and making each have a dedicated configs/ file does that.

I think this is a reasonable solution to what I see as the problem (we don't know what we can build) but I am very open to others.

Regards,
Simon