[PATCH v4 5/8] env: scsi: Add partition type GUID support and choice-based selection
Balaji Selvanathan
balaji.selvanathan at oss.qualcomm.com
Tue Apr 28 09:31:47 CEST 2026
Add support for locating SCSI environment partition using GPT type
GUID.
Introduce a Kconfig choice statement to select between three
mutually exclusive partition lookup methods: UUID-based (default),
type GUID-based, and hardware partition number.
Reorganize existing configs to depend on their respective choice
options. Update ENV_IS_IN_SCSI help text to document the
new configuration structure.
Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Balaji Selvanathan <balaji.selvanathan at oss.qualcomm.com>
---
Changes in v4:
- Has only changes related to introducing choice configs
Changes in v3:
- Introduce a new choice config: ENV_SCSI_PART_USE_HW for
ENV_SCSI_HW_PARTITION
- Refactor env_scsi_get_part and env_scsi_load functions based
on the choice configs
Changes in v2:
- Introduce a Kconfig choice config to select between UUID-based
and type GUID-based partition lookup methods.
---
env/Kconfig | 68 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 54 insertions(+), 14 deletions(-)
diff --git a/env/Kconfig b/env/Kconfig
index 71a27894f90..f59b2acb7e6 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -299,16 +299,20 @@ config ENV_IS_IN_SCSI
The size of the partition where the environment is stored in bytes. Must
be a multiple of the partition block size.
- - CONFIG_ENV_SCSI_HW_PARTITION:
+ The partition selection method is configured via a choice statement:
- Specifies which SCSI partition the environment is stored in. If not
- set, defaults to partition 0, the user area. Common values might be
- 1 (first SCSI boot partition), 2 (second SCSI boot partition). Ignored
- if CONFIG_ENV_SCSI_PART_UUID is set to non-empty string.
+ - ENV_SCSI_PART_USE_UUID: Use the partition's unique UUID to identify
+ the SCSI partition for environment storage.
- - CONFIG_ENV_SCSI_PART_UUID:
+ - ENV_SCSI_PART_USE_TYPE_GUID: Use the partition type GUID to identify
+ the SCSI partition for environment storage. The first partition
+ matching the specified type GUID will be used.
- UUID of the SCSI partition where the environment is stored.
+ - ENV_SCSI_PART_USE_HW: Use the hardware device number to identify
+ the SCSI device for environment storage. Specifies which SCSI
+ partition the environment is stored in. If not set, defaults to
+ partition 0, the user area. Common values might be 1 (first SCSI
+ boot partition), 2 (second SCSI boot partition).
config ENV_RANGE
@@ -780,9 +784,51 @@ config ENV_MMC_USE_DT
The 2 defines CONFIG_ENV_OFFSET, CONFIG_ENV_OFFSET_REDUND
are not used as fallback.
+choice
+ prompt "SCSI partition selection method"
+ depends on ENV_IS_IN_SCSI
+ default ENV_SCSI_PART_USE_UUID
+ help
+ Select the method to identify the SCSI partition for environment storage.
+
+config ENV_SCSI_PART_USE_UUID
+ bool "Use partition UUID"
+ help
+ Use the partition's unique UUID to identify the SCSI partition
+ for environment storage.
+
+config ENV_SCSI_PART_USE_TYPE_GUID
+ bool "Use partition type GUID"
+ select PARTITION_TYPE_GUID
+ help
+ Use the partition type GUID to identify the SCSI partition
+ for environment storage. The first partition matching the
+ specified type GUID will be used.
+
+config ENV_SCSI_PART_USE_HW
+ bool "Use hardware partition number"
+ help
+ Use the hardware device number to identify the SCSI device
+ for environment storage.
+
+endchoice
+
+config ENV_SCSI_PART_UUID
+ string "SCSI partition UUID for saving environment"
+ depends on ENV_SCSI_PART_USE_UUID
+ help
+ UUID of the SCSI partition that you want to store the environment in.
+
+config ENV_SCSI_PART_TYPE_GUID
+ string "SCSI partition type GUID for saving environment"
+ depends on ENV_SCSI_PART_USE_TYPE_GUID
+ help
+ Type GUID of the SCSI partition to store the environment in.
+ Uses the first partition matching this type GUID.
+
config ENV_SCSI_HW_PARTITION
string "SCSI hardware partition number"
- depends on ENV_IS_IN_SCSI
+ depends on ENV_SCSI_PART_USE_HW
default "0"
help
SCSI hardware partition device number on the platform where the
@@ -791,12 +837,6 @@ config ENV_SCSI_HW_PARTITION
partition 0 or the first boot partition, which is 1 or some other defined
partition.
-config ENV_SCSI_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 ENV_USE_DEFAULT_ENV_TEXT_FILE
bool "Create default environment from file"
depends on !COMPILE_TEST
--
2.34.1
More information about the U-Boot
mailing list