Skip to contentSkip to conversation

Kconfig: Add COMPILE_TEST option

PATCH In review Tom Rini 1 participant 3 messages Jul 4, 2025 – Jul 11, 2025 I2C

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 Kconfig: Add COMPILE_TEST option

Take the COMPILE_TEST option from the Linux Kernel v6.15 and since the wording there is OK for us too, use it verbatim. Also update the default for WERROR to be COMPILE_TEST which again matches the Linux Kernel.

This is the first big step needed to allow for "allyesconfig" to be possible as it then lets us then disable things that aren't valid for a compile only test.

---
 Kconfig | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Kconfig +14 -0
index 05b7f410fa59..3571f5214e67 100644
@@ -27,8 +27,22 @@ config DEPRECATED
 	  code that relies on deprecated features that will be removed and
 	  the conversion deadline has passed.
 
+config COMPILE_TEST
+	bool "Compile also drivers which will not load"
+	help
+	  Some drivers can be compiled on a different platform than they are
+	  intended to be run on. Despite they cannot be loaded there (or even
+	  when they load they cannot be used due to missing HW support),
+	  developers still, opposing to distributors, might want to build such
+	  drivers to compile-test them.
+
+	  If you are a developer and want to build everything available, say Y
+	  here. If you are a user/distributor, say N here to exclude useless
+	  drivers to be distributed.
+
 config WERROR
 	bool "Compile U-Boot with warnings as errors"
+	default COMPILE_TEST
 	help
 	  A U-Boot build should not cause any compiler warnings, and this
 	  enables the '-Werror' flag to enforce that rule.
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 Kconfig: Test for !COMPILE_TEST in some locations

We have a few options that we cannot enable in a "allyesconfig" type build because we cannot use zero as a default value.

- The logic around HAS_BOARD_SIZE_LIMIT assumes that if we have set this then we compare with it. Similarly, we need to set SPL_NO_BSS_LIMIT as the default there.
- Both SYS_CUSTOM_LDSCRIPT and ENV_USE_DEFAULT_ENV_TEXT_FILE then prompt for a file name to use.
- The SYS_I2C_SOFT driver is a legacy driver which requires a lot of configuration within the board config. file instead, so disable it.

---
 Kconfig             | 2 ++
 common/spl/Kconfig  | 1 +
 drivers/i2c/Kconfig | 1 +
 env/Kconfig         | 1 +
 4 files changed, 5 insertions(+)
Kconfig +2 -0
index 3571f5214e67..c883f1154595 100644
@@ -537,6 +537,7 @@ config BUILD_TARGET
 
 config HAS_BOARD_SIZE_LIMIT
 	bool "Define a maximum size for the U-Boot image"
+	depends on !COMPILE_TEST
 	default y if RCAR_32 || RCAR_64
 	help
 	  In some cases, we need to enforce a hard limit on how big the U-Boot
@@ -555,6 +556,7 @@ config BOARD_SIZE_LIMIT
 
 config SYS_CUSTOM_LDSCRIPT
 	bool "Use a custom location for the U-Boot linker script"
+	depends on !COMPILE_TEST
 	help
 	  Normally when linking U-Boot we will look in the board directory,
 	  the CPU directory and finally the "cpu" directory of the architecture
common/spl/Kconfig +1 -0
index 9a17ccb2d3d4..5b520e6f62e9 100644
@@ -132,6 +132,7 @@ config SPL_BSS_START_ADDR
 choice
 	prompt "Enforce SPL BSS limit"
 	depends on !PPC
+	default SPL_NO_BSS_LIMIT if COMPILE_TEST
 	default SPL_BSS_LIMIT
 	help
 	  In some platforms we only want to enforce a limit on the size of the
drivers/i2c/Kconfig +1 -0
index 9465e61a04c9..108b24b3dd23 100644
@@ -619,6 +619,7 @@ endif
 
 config SYS_I2C_SOFT
 	bool "Legacy software I2C interface"
+	depends on !COMPILE_TEST
 	help
 	  Enable the legacy software defined I2C interface
 
env/Kconfig +1 -0
index c30785de48b1..c667e8f2da19 100644
@@ -759,6 +759,7 @@ config SCSI_ENV_PART_UUID
 
 config ENV_USE_DEFAULT_ENV_TEXT_FILE
 	bool "Create default environment from file"
+	depends on !COMPILE_TEST
 	help
 	  Normally, the default environment is automatically generated
 	  based on the settings of various CONFIG_* options, as well
Signature · 1 line
2.43.0
author
#2 lore raw
In reply to Tom Rini
Quoted 9 lines · Tom Rini

Take the COMPILE_TEST option from the Linux Kernel v6.15 and since the wording there is OK for us too, use it verbatim. Also update the default for WERROR to be COMPILE_TEST which again matches the Linux Kernel.

This is the first big step needed to allow for "allyesconfig" to be possible as it then lets us then disable things that aren't valid for a compile only test.

[...]

Applied to u-boot/master, thanks!

[1/2] Kconfig: Add COMPILE_TEST option

      commit: 011079c375d029f47e91d57f84927f392ffd2d61
[2/2] Kconfig: Test for !COMPILE_TEST in some locations
      commit: 7adb9b03a6447a80925c6eb02fedb6b022ef6e14
Signature · 1 line
Tom