[PATCH v2 3/4] env: Add support for storing env variables in SCSI devices

neil.armstrong at linaro.org neil.armstrong at linaro.org
Tue May 6 09:40:03 CEST 2025


On 06/05/2025 09:24, Varadarajan Narayanan wrote:
> Allow SCSI to be able to store environment variables.
> 
> Signed-off-by: Varadarajan Narayanan <quic_varada at quicinc.com>
> ---
>   env/Kconfig            |  15 +++++-
>   env/Makefile           |   1 +
>   env/env.c              |   3 ++
>   env/scsi.c             | 115 +++++++++++++++++++++++++++++++++++++++++
>   include/env_internal.h |   1 +
>   5 files changed, 134 insertions(+), 1 deletion(-)
>   create mode 100644 env/scsi.c
> 
> diff --git a/env/Kconfig b/env/Kconfig
> index 9f5ec44601e..9496975f212 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -74,7 +74,7 @@ config ENV_IS_DEFAULT
>   		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
>   		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
>   		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
> -		     !ENV_IS_IN_UBI && !ENV_IS_IN_MTD
> +		     !ENV_IS_IN_UBI && !ENV_IS_IN_MTD && !ENV_IS_IN_SCSI
>   	select ENV_IS_NOWHERE
>   
>   config ENV_IS_NOWHERE
> @@ -297,6 +297,13 @@ config ENV_IS_IN_NAND
>   	  Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
>   	  using CONFIG_ENV_OFFSET_OOB.
>   
> +config ENV_IS_IN_SCSI
> +	bool "Environment in an SCSI device"
> +	depends on SCSI
> +	help
> +	  Define this if you have an SCSI device which you want to use for the
> +	  environment.
> +
>   config ENV_RANGE
>   	hex "Length of the region in which the environment can be written"
>   	depends on ENV_IS_IN_NAND
> @@ -731,6 +738,12 @@ config ENV_MMC_USE_DT
>   	  The 2 defines CONFIG_ENV_OFFSET, CONFIG_ENV_OFFSET_REDUND
>   	  are not used as fallback.
>   
> +config SCSI_ENV_PART

This should be SCSI_ENV_PART_UUID

> +	string "SCSI partition UUID for saving environment"
> +	depends on ENV_IS_IN_SCSI
> +	help
> +	  UUID of the SCSI partition that you want to store the environment in.
> +
>   config USE_DEFAULT_ENV_FILE
>   	bool "Create default environment from file"

<snip>

> +};
> diff --git a/include/env_internal.h b/include/env_internal.h
> index ee939ba4293..75b46d0bcb0 100644
> --- a/include/env_internal.h
> +++ b/include/env_internal.h
> @@ -115,6 +115,7 @@ enum env_location {
>   	ENVL_SPI_FLASH,
>   	ENVL_MTD,
>   	ENVL_UBI,
> +	ENVL_SCSI,
>   	ENVL_NOWHERE,
>   
>   	ENVL_COUNT,

Wider question, what is specific to scsi here ? it could work with any block device.

Neil


More information about the U-Boot mailing list