[PATCH] SPL: Do not allow enabling SPL symbols for non-SPL builds

Pali Rohár pali at kernel.org
Mon May 9 20:53:50 CEST 2022


It does not make sense to enable SPL options when not building SPL binary.

So disallow selecting SPL options for non-SPL builds.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 arch/arm/Kconfig                |  6 +++++-
 arch/arm/cpu/armv8/Kconfig      |  2 ++
 common/Kconfig                  |  5 +++++
 common/spl/Kconfig              |  4 ++--
 drivers/firmware/Kconfig        |  1 +
 drivers/gpio/Kconfig            |  1 +
 drivers/misc/Kconfig            |  1 +
 drivers/mmc/Kconfig             |  5 +++++
 drivers/mtd/spi/Kconfig         |  1 +
 drivers/power/Kconfig           |  1 +
 drivers/power/acpi_pmc/Kconfig  |  1 +
 drivers/power/regulator/Kconfig |  1 +
 fs/cbfs/Kconfig                 |  1 +
 lib/Kconfig                     | 10 +++++++++-
 14 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0afec5155b1b..e4b2b76650fe 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -985,7 +985,7 @@ config ARCH_MX6
 	imply SYS_THUMB_BUILD
 	imply SPL_SEPARATE_BSS
 
-if ARCH_MX6
+if ARCH_MX6 && SPL
 config SPL_LDSCRIPT
 	default "arch/arm/mach-omap2/u-boot-spl.lds"
 endif
@@ -2343,7 +2343,11 @@ source "arch/arm/Kconfig.debug"
 
 endmenu
 
+if SPL
+
 config SPL_LDSCRIPT
 	default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK
 	default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
 	default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
+
+endif
diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig
index 09f3f50fa22f..0476446bc5ba 100644
--- a/arch/arm/cpu/armv8/Kconfig
+++ b/arch/arm/cpu/armv8/Kconfig
@@ -76,6 +76,7 @@ config ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 	bool "Enable ARMv8 secure monitor firmware framework support for SPL"
+	depends on SPL
 	select SPL_FIT
 	select SPL_OF_LIBFDT
 	help
@@ -83,6 +84,7 @@ config SPL_ARMV8_SEC_FIRMWARE_SUPPORT
 
 config SPL_RECOVER_DATA_SECTION
 	bool "save/restore SPL data section"
+	depends on SPL
 	help
 	  Say Y here to save SPL data section for cold boot, and restore
 	  at warm boot in SPL phase.
diff --git a/common/Kconfig b/common/Kconfig
index a96842a5c11d..8e59dcef4b8b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -81,10 +81,14 @@ config LOGLEVEL
 	    8 - debug content
 	    9 - debug hardware I/O
 
+if SPL
+
 config SPL_LOGLEVEL
 	int
 	default LOGLEVEL
 
+endif
+
 config TPL_LOGLEVEL
 	int
 	default LOGLEVEL
@@ -241,6 +245,7 @@ config SYS_STDIO_DEREGISTER
 
 config SPL_SYS_STDIO_DEREGISTER
 	bool "Allow deregistering stdio devices in SPL"
+	depends on SPL
 	help
 	  Generally there is no need to deregister stdio devices since they
 	  are never deactivated. But if a stdio device is used which can be
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 84f2847c724b..3cfb19331272 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -19,6 +19,8 @@ config SPL
 	help
 	  If you want to build SPL as well as the normal image, say Y.
 
+if SPL
+
 config SPL_FRAMEWORK
 	bool "Support SPL based upon the common SPL framework"
 	depends on SPL
@@ -150,8 +152,6 @@ config HANDOFF
 	  in boot. It is available in gd->handoff. The state state is set up
 	  in SPL (or TPL if that is being used).
 
-if SPL
-
 config SPL_HANDOFF
 	bool "Pass hand-off information from SPL to U-Boot proper"
 	depends on HANDOFF && SPL_BLOBLIST
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index ef958b3a7a4e..55069e395ff2 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -3,6 +3,7 @@ config FIRMWARE
 
 config SPL_FIRMWARE
 	bool "Enable Firmware driver support in SPL"
+	depends on SPL
 	depends on FIRMWARE
 
 config SPL_ARM_PSCI_FW
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 149a62ffe611..3ba97515b718 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -490,6 +490,7 @@ config DM_PCA953X
 
 config SPL_DM_PCA953X
 	bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports in SPL"
+	depends on SPL
 	depends on DM_GPIO
 	help
 	  Say yes here to provide access to several register-oriented
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 9af806a20ae9..b99e7c25b807 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -492,6 +492,7 @@ config FS_LOADER
 
 config SPL_FS_LOADER
 	bool "Enable loader driver for file system"
+	depends on SPL
 	help
 	  This is file system generic loader which can be used to load
 	  the file image from the storage into target such as memory.
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..a3f0cd00ed74 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -123,6 +123,7 @@ config MMC_IO_VOLTAGE
 
 config SPL_MMC_IO_VOLTAGE
 	bool "Support IO voltage configuration in SPL"
+	depends on SPL
 	help
 	  IO voltage configuration allows selecting the voltage level of the IO
 	  lines (not the level of main supply). This is required for UHS
@@ -153,6 +154,7 @@ config MMC_HS400_ES_SUPPORT
 
 config SPL_MMC_HS400_ES_SUPPORT
 	bool "enable HS400 Enhanced Strobe support in SPL"
+	depends on SPL
 	help
 	  The HS400 Enhanced Strobe mode is support by some eMMC. The bus
 	  frequency is up to 200MHz. This mode does not tune the IO.
@@ -166,6 +168,7 @@ config MMC_HS400_SUPPORT
 
 config SPL_MMC_HS400_SUPPORT
 	bool "enable HS400 support in SPL"
+	depends on SPL
 	select SPL_MMC_HS200_SUPPORT
 	help
 	  The HS400 mode is support by some eMMC. The bus frequency is up to
@@ -179,6 +182,7 @@ config MMC_HS200_SUPPORT
 
 config SPL_MMC_HS200_SUPPORT
 	bool "enable HS200 support in SPL"
+	depends on SPL
 	help
 	  The HS200 mode is support by some eMMC. The bus frequency is up to
 	  200MHz. This mode requires tuning the IO.
@@ -478,6 +482,7 @@ config MMC_SDHCI_ADMA
 
 config SPL_MMC_SDHCI_ADMA
 	bool "Support SDHCI ADMA2 in SPL"
+	depends on SPL
 	depends on MMC_SDHCI
 	select MMC_SDHCI_ADMA_HELPERS
 	help
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index f350c7e5dc21..eed51bb22b09 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -248,6 +248,7 @@ config SPI_FLASH_MTD
 
 config SPL_SPI_FLASH_MTD
 	bool "SPI flash MTD support for SPL"
+	depends on SPL
 	depends on SPI_FLASH
 	help
           Enable the MTD support for the SPI flash layer in SPL.
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 2c20dc7c8318..1d184b285875 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -29,6 +29,7 @@ config POWER_LEGACY
 
 config SPL_POWER_LEGACY
 	bool "Legacy power support in SPL"
+	depends on SPL
 	default y if POWER_LEGACY
 	help
 	  Note: This is a legacy option. Use SPL_DM_PMIC instead.
diff --git a/drivers/power/acpi_pmc/Kconfig b/drivers/power/acpi_pmc/Kconfig
index fcd50e36cad4..8b712abc41e9 100644
--- a/drivers/power/acpi_pmc/Kconfig
+++ b/drivers/power/acpi_pmc/Kconfig
@@ -8,6 +8,7 @@ config ACPI_PMC
 
 config SPL_ACPI_PMC
 	bool "Power Manager (x86 PMC) support in SPL"
+	depends on SPL
 	default y if ACPI_PMC
 	help
 	  Enable support for an x86-style power-management controller which
diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index cd253b95f2f0..dde694a5c44b 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -148,6 +148,7 @@ config DM_REGULATOR_FIXED
 
 config SPL_DM_REGULATOR_FIXED
 	bool "Enable Driver Model for REGULATOR Fixed value in SPL"
+	depends on SPL_DM_REGULATOR
 	depends on DM_REGULATOR_FIXED
 	select SPL_DM_REGULATOR_COMMON
 	---help---
diff --git a/fs/cbfs/Kconfig b/fs/cbfs/Kconfig
index 03980d830d30..b6639928f4af 100644
--- a/fs/cbfs/Kconfig
+++ b/fs/cbfs/Kconfig
@@ -9,6 +9,7 @@ config FS_CBFS
 
 config SPL_FS_CBFS
 	bool "Enable CBFS (Coreboot Filesystem) in SPL"
+	depends on SPL
 	help
 	  Define this to enable support for reading from a Coreboot
 	  filesystem. This is a ROM-based filesystem used for accessing files
diff --git a/lib/Kconfig b/lib/Kconfig
index acc0ac081a44..299381ac80d5 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -239,6 +239,7 @@ config GENERATE_ACPI_TABLE
 
 config SPL_TINY_MEMSET
 	bool "Use a very small memset() in SPL"
+	depends on SPL
 	help
 	  The faster memset() is the arch-specific one (if available) enabled
 	  by CONFIG_USE_ARCH_MEMSET. If that is not enabled, we can still get
@@ -556,6 +557,7 @@ config MD5
 
 config SPL_MD5
 	bool "Support MD5 algorithm in SPL"
+	depends on SPL
 	help
 	  This option enables MD5 support in SPL. MD5 is an algorithm designed
 	  in 1991 that produces a 16-byte digest (or checksum) from its input
@@ -642,6 +644,7 @@ config ZSTD
 
 config SPL_LZ4
 	bool "Enable LZ4 decompression support in SPL"
+	depends on SPL
 	help
 	  This enables support for the LZ4 decompression algorithm in SPL. LZ4
 	  is a lossless data compression algorithm that is focused on
@@ -650,6 +653,7 @@ config SPL_LZ4
 
 config SPL_LZMA
 	bool "Enable LZMA decompression support for SPL build"
+	depends on SPL
 	help
 	  This enables support for LZMA compression algorithm for SPL boot.
 
@@ -661,22 +665,26 @@ config VPL_LZMA
 
 config SPL_LZO
 	bool "Enable LZO decompression support in SPL"
+	depends on SPL
 	help
 	  This enables support for LZO compression algorithm in the SPL.
 
 config SPL_GZIP
 	bool "Enable gzip decompression support for SPL build"
+	depends on SPL
 	select SPL_ZLIB
 	help
 	  This enables support for the GZIP compression algorithm for SPL boot.
 
 config SPL_ZLIB
 	bool
+	depends on SPL
 	help
 	  This enables compression lib for SPL boot.
 
 config SPL_ZSTD
 	bool "Enable Zstandard decompression support in SPL"
+	depends on SPL
 	select XXHASH
 	help
 	  This enables Zstandard decompression library in the SPL.
@@ -749,7 +757,7 @@ config SPL_OF_LIBFDT
 
 config SPL_OF_LIBFDT_ASSUME_MASK
 	hex "Mask of conditions to assume for libfdt"
-	depends on SPL_OF_LIBFDT || FIT
+	depends on SPL_OF_LIBFDT || (SPL && FIT)
 	default 0xff
 	help
 	  Use this to change the assumptions made by libfdt in SPL about the
-- 
2.20.1



More information about the U-Boot mailing list