[PATCH] gpt: allow spaces in partition list

Mikhail Kshevetskiy mikhail.kshevetskiy at iopsys.eu
Thu Jun 27 13:29:04 CEST 2024


This allows spliting partition list to several lines in environment file

ex:
--------------------
gpt_partition_list=
	name=boot1,size=5MiB,start=0x100000;
	name=boot2,size=5MiB;
	name=rootfs1,size=70MiB;
	name=rootfs2,size=70MiB;
	name=overlay1,size=20MiB;
	name=overlay2,size=20MiB;
	name=art,size=4MiB;

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy at iopsys.eu>
---
 cmd/gpt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 7aaf1889a5a..2b29ab98ccc 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -117,6 +117,7 @@ static char *extract_val(const char *str, const char *key)
 		k = strsep(&v, "=");
 		if (!k)
 			break;
+		k += strspn(k, " \t");
 		if  (strcmp(k, key) == 0) {
 			new = strdup(v);
 			break;
@@ -151,6 +152,7 @@ static bool found_key(const char *str, const char *key)
 		k = strsep(&s, ",");
 		if (!k)
 			break;
+		k += strspn(k, " \t");
 		if  (strcmp(k, key) == 0) {
 			result = true;
 			break;
-- 
2.43.0



More information about the U-Boot mailing list