[PATCH 2/8] part_find: Enable for sandbox and correct radix and calls

Simon Glass sjg at chromium.org
Mon Dec 9 17:27:55 CET 2024


Enable this command for sandbox and the EFI app.

Recent work removed the if_type member. Update the code to use the new
method for obtaining the interface type.

Use hex so that large partition numbers (>=10) work correctly.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 cmd/Kconfig     | 1 +
 cmd/part_find.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 8fc76778d87..c8ca55194c0 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1552,6 +1552,7 @@ config CMD_PART
 config CMD_PART_FIND
 	bool "part_find"
 	depends on PARTITIONS
+	default y if SANDBOX || EFI_APP
 	select HAVE_BLOCK_DEVICE
 	select PARTITION_UUIDS
 	select PARTITION_TYPE_GUID
diff --git a/cmd/part_find.c b/cmd/part_find.c
index 8c071d3c374..38919935641 100644
--- a/cmd/part_find.c
+++ b/cmd/part_find.c
@@ -107,7 +107,7 @@ static int part_find(int argc, char *const argv[])
 								   &loader_part_no)) {
 						char env[256];
 
-						ret = snprintf(env, sizeof(env), "%s %d:%d", blk_get_if_type_name(desc->if_type), desc->devnum, loader_part_no);
+						ret = snprintf(env, sizeof(env), "%s %x:%x", blk_get_if_type_name(desc->if_type), desc->devnum, loader_part_no);
 						if (ret < 0 || ret == sizeof(env))
 							return CMD_RET_FAILURE;
 						if (env_set("target_part", env))
@@ -123,7 +123,7 @@ static int part_find(int argc, char *const argv[])
 						break;
 					if (strcasecmp(argv[1], info.type_guid) == 0) {
 						char env[256];
-						ret = snprintf(env, sizeof(env), "%s %d:%d", blk_get_if_type_name(desc->if_type), desc->devnum, i);
+						ret = snprintf(env, sizeof(env), "%s %x:%x", blk_get_uclass_name(desc->uclass_id), desc->devnum, i);
 						if (ret < 0 || ret == sizeof(env))
 							return CMD_RET_FAILURE;
 						env_set("target_part", env);
-- 
2.34.1



More information about the U-Boot mailing list