[PATCH 2/2] mtd: bootdev: Add Kconfig option for defining script parameters

Tom Rini trini at konsulko.com
Thu May 8 17:35:03 CEST 2025


On Thu, May 08, 2025 at 06:31:52PM +0300, Wadim Egorov wrote:
> Am 08.05.25 um 18:27 schrieb Tom Rini:
> > On Thu, May 08, 2025 at 03:16:41PM +0200, Wadim Egorov wrote:
> > > Introduce USE_SPI_FLASH_SCRIPT Kconfig option to enable setting default
> > > environment values for loading boot scripts from SPI flash. When enabled,
> > > SPI_FLASH_SCRIPT_OFFSET and SPI_FLASH_SCRIPT_SIZE define the default
> > > script_offset_f and script_size_f variables.
> > > 
> > > Signed-off-by: Wadim Egorov <w.egorov at phytec.de>
> > > ---
> > >   drivers/mtd/spi/Kconfig | 26 ++++++++++++++++++++++++++
> > >   include/env_default.h   |  4 ++++
> > >   2 files changed, 30 insertions(+)
> > > 
> > > diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
> > > index ca60a425ba3..fc154ec89d7 100644
> > > --- a/drivers/mtd/spi/Kconfig
> > > +++ b/drivers/mtd/spi/Kconfig
> > > @@ -89,6 +89,32 @@ config BOOTDEV_SPI_FLASH
> > >   	  If unsure, say N
> > > +config USE_SPI_FLASH_SCRIPT
> > > +	bool "Enable default SPI flash script parameters"
> > > +	depends on BOOTDEV_SPI_FLASH
> > > +	help
> > > +	  Enable this option to provide default values for SPI flash script loading.
> > > +	  These values will be assigned to the 'script_offset_f' and 'script_size_f'
> > > +	  environment variables at boot time if not already defined in the environment.
> > > +
> > > +	  If unsure, say N.
> > > +
> > > +config SPI_FLASH_SCRIPT_OFFSET
> > > +	hex "Offset for SPI flash script (script_offset_f)"
> > > +	depends on USE_SPI_FLASH_SCRIPT
> > > +	help
> > > +	  This option sets the default value for the 'script_offset_f' environment
> > > +	  variable. It specifies the offset (in bytes) in SPI flash from which
> > > +	  the boot script should be loaded.
> > > +
> > > +config SPI_FLASH_SCRIPT_SIZE
> > > +	hex "Size of SPI flash script (script_size_f)"
> > > +	depends on USE_SPI_FLASH_SCRIPT
> > > +	help
> > > +	  This option sets the default value for the 'script_size_f' environment
> > > +	  variable. It specifies the number of bytes to read from SPI flash to
> > > +	  load the boot script.
> > > +
> > >   config SPI_FLASH_SFDP_SUPPORT
> > >   	bool "SFDP table parsing support for SPI NOR flashes"
> > >   	depends on !SPI_FLASH_BAR
> > > diff --git a/include/env_default.h b/include/env_default.h
> > > index c72cf123004..9f2f222519d 100644
> > > --- a/include/env_default.h
> > > +++ b/include/env_default.h
> > > @@ -127,6 +127,10 @@ const char default_environment[] = {
> > >   #ifdef CONFIG_BOOTSCRIPT_DHCP
> > >   	"boot_script_dhcp="	CONFIG_BOOTSCRIPT_DHCP	"\0"
> > >   #endif
> > > +#ifdef USE_SPI_FLASH_SCRIPT
> > > +	"script_offset_f="	__stringify(CONFIG_SPI_FLASH_SCRIPT_OFFSET)"\0"
> > > +	"script_size_f="	__stringify(CONFIG_SPI_FLASH_SCRIPT_SIZE)"\0"
> > > +#endif
> > 
> > This should be CONFIG_... yes? Did that just get missed in uplifting
> > this from, I assume, an internal tree?
> > 
> 
> I will double check, test and resend a v2.
> 
> But is the general idea for defaulting standard boot environment variables
> in env_default.h okay?

That I am still thinking on. But I did want to be sure you're testing
the whole path out elsewhere and this was just a typo :)

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250508/4596a2c1/attachment.sig>


More information about the U-Boot mailing list