*** boot: Add Kconfig options for script-based boot parameters ***
cover *** boot: Add Kconfig options for script-based boot parameters ***
This series introduces new Kconfig options to configure default environment variables used in script-based boot scenarios. Specifically, it allows setting the following standard boot environment variables:
- boot_script_dhcp via BOOTSCRIPT_DHCP
- script_offset_f and script_size_f via USE_SPI_FLASH_SCRIPT and related options
These changes make it possible to define standard boot environment variables directly via Kconfig, allowing higher-level build systems like Yocto to set them at build time. This avoids the need for post-build environment patches or runtime overrides, improving reproducibility and simplifying integration in automated firmware build workflows.
Wadim Egorov (2):
boot: Add BOOTSCRIPT_DHCP Kconfig option for boot_script_dhcp env
mtd: bootdev: Add Kconfig option for defining script parameters
boot/Kconfig | 18 ++++++++++++++++++ drivers/mtd/spi/Kconfig | 26 ++++++++++++++++++++++++++ include/env_default.h | 7 +++++++ 3 files changed, 51 insertions(+)
Signature · 1 line
2.34.1
PATCH 1/2 boot: Add BOOTSCRIPT_DHCP Kconfig option for boot_script_dhcp env
Introduce a new Kconfig option BOOTSCRIPT_DHCP to allow setting a value for boot_script_dhcp in the default environment.
--- boot/Kconfig | 18 ++++++++++++++++++ include/env_default.h | 3 +++ 2 files changed, 21 insertions(+)
boot/Kconfig +18 -0
@@ -875,6 +875,24 @@ config BOOTMETH_SCRIPT This provides a way to try out standard boot on an existing boot flow. It is not enabled by default to save space. +config USE_BOOTSCRIPT_DHCP + bool "Enable default DHCP boot script filename" + depends on BOOTMETH_SCRIPT + help + Enable this option if you want to set a default value for the + 'boot_script_dhcp' environment variable, which is used to fetch a + boot script via TFTP over the network. + + If unsure, say N. + +config BOOTSCRIPT_DHCP + string "Default boot script filename (boot_script_dhcp)" + depends on USE_BOOTSCRIPT_DHCP + help + This option sets the default value for the 'boot_script_dhcp' environment + variable, which is used to fetch a boot script over the network via TFTP. + The script must reside in the top-level directory of the TFTP server. + config UPL bool "upl - Universal Payload Specification" imply CMD_UPL
include/env_default.h +3 -0
@@ -124,6 +124,9 @@ const char default_environment[] = {#ifdef CONFIG_MTDPARTS_DEFAULT "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"#endif +#ifdef CONFIG_BOOTSCRIPT_DHCP + "boot_script_dhcp=" CONFIG_BOOTSCRIPT_DHCP "\0" +#endif #ifdef CONFIG_EXTRA_ENV_TEXT /* This is created in the Makefile */ CONFIG_EXTRA_ENV_TEXT
Signature · 1 line
2.34.1
PATCH 2/2 mtd: bootdev: Add Kconfig option for defining script parameters
In reply to Wadim EgorovIntroduce 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.
--- drivers/mtd/spi/Kconfig | 26 ++++++++++++++++++++++++++ include/env_default.h | 4 ++++ 2 files changed, 30 insertions(+)
drivers/mtd/spi/Kconfig +26 -0
@@ -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
include/env_default.h +4 -0
@@ -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 #ifdef CONFIG_EXTRA_ENV_TEXT /* This is created in the Makefile */ CONFIG_EXTRA_ENV_TEXT
Signature · 1 line
2.34.1