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

Pali Rohár
2022-05-10T11:29:44Z

On Monday 09 May 2022 16:22:50 Tom Rini wrote:
> On Mon, May 09, 2022 at 08:53:50PM +0200, Pali Rohár wrote:
>
> > 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@kernel.org>
>
> Some of this makes sense, where you add SPL as an explicit dependency.
> But others:
>
> > 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
>
> Where it's like this and we're providing default values and the option
> itself is prompt'd elsewhere don't as it's not cluttering the resulting
> .config file.

Apparently it clutters the resulting .config file. Espressobin with
mvebu_espressobin-88f3720_defconfig has CONFIG_SPL_LDSCRIPT in .config
even there is no SPL for Espressobin.

> > 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.
>
> Most of these should all be under one big if SPL ... endif
>
> --
> Tom

Ok, I can change it.