[PATCH] cmd: Remove default prompt from output

Daniel Schultz d.schultz at phytec.de
Fri Aug 15 18:06:35 CEST 2025


Some commands include the U-Boot prompt (=>) in their output,
which can interfere with tools like labgrid that rely on prompt
detection to determine when a command has completed. This may cause
such tools to misinterpret partial output.

To avoid this issue, it's better to update the command output itself
rather than modifying the actual U-Boot prompt. Changing the prompt
is not acceptable in many cases, as some boards have used the default
prompt (=>) for years, and altering it - especially just for testing -
could lead to inconsistencies or unintended side effects.
Instead, replace instances of the prompt that appear within command
output (not the real prompt) with an alternative like -> to ensure
correct parsing by tools that rely on prompt recognition.

Signed-off-by: Daniel Schultz <d.schultz at phytec.de>
---
 cmd/i2c.c      |  2 +-
 cmd/mtdparts.c | 12 ++++++------
 common/hash.c  |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cmd/i2c.c b/cmd/i2c.c
index e021067e68a..f7695047629 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -715,7 +715,7 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
 	 */
 	count = hextoul(argv[3], NULL);
 
-	printf ("CRC32 for %08lx ... %08lx ==> ", addr, addr + count - 1);
+	printf("CRC32 for %08lx ... %08lx --> ", addr, addr + count - 1);
 	/*
 	 * CRC a byte at a time.  This is going to be slooow, but hey, the
 	 * memories are small and slow too so hopefully nobody notices.
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 571b79f091d..48d06f2e000 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -242,7 +242,7 @@ static void index_partitions(void)
 			if (dev == current_mtd_dev) {
 				mtddevnum += current_mtd_partnum;
 				env_set_ulong("mtddevnum", mtddevnum);
-				debug("=> mtddevnum %d,\n", mtddevnum);
+				debug("-> mtddevnum %d,\n", mtddevnum);
 				break;
 			}
 			mtddevnum += dev->num_parts;
@@ -252,17 +252,17 @@ static void index_partitions(void)
 		if (part) {
 			env_set("mtddevname", part->name);
 
-			debug("=> mtddevname %s\n", part->name);
+			debug("-> mtddevname %s\n", part->name);
 		} else {
 			env_set("mtddevname", NULL);
 
-			debug("=> mtddevname NULL\n");
+			debug("-> mtddevname NULL\n");
 		}
 	} else {
 		env_set("mtddevnum", NULL);
 		env_set("mtddevname", NULL);
 
-		debug("=> mtddevnum NULL\n=> mtddevname NULL\n");
+		debug("-> mtddevnum NULL\n-> mtddevname NULL\n");
 	}
 }
 
@@ -282,12 +282,12 @@ static void current_save(void)
 		env_set("partition", buf);
 		strncpy(last_partition, buf, 16);
 
-		debug("=> partition %s\n", buf);
+		debug("-> partition %s\n", buf);
 	} else {
 		env_set("partition", NULL);
 		last_partition[0] = '\0';
 
-		debug("=> partition NULL\n");
+		debug("-> partition NULL\n");
 	}
 	index_partitions();
 }
diff --git a/common/hash.c b/common/hash.c
index 0c45992d5c7..07a4df963ad 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -535,7 +535,7 @@ static void hash_show(struct hash_algo *algo, ulong addr, ulong len, uint8_t *ou
 {
 	int i;
 
-	printf("%s for %08lx ... %08lx ==> ", algo->name, addr, addr + len - 1);
+	printf("%s for %08lx ... %08lx --> ", algo->name, addr, addr + len - 1);
 	for (i = 0; i < algo->digest_size; i++)
 		printf("%02x", output[i]);
 }
@@ -621,8 +621,8 @@ int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
 
 		crc = crc32_wd(0, (const uchar *)addr, len, CHUNKSZ_CRC32);
 
-		printf("CRC32 for %08lx ... %08lx ==> %08lx\n",
-				addr, addr + len - 1, crc);
+		printf("CRC32 for %08lx ... %08lx --> %08lx\n",
+		       addr, addr + len - 1, crc);
 
 		if (argc >= 3) {
 			ptr = (ulong *)hextoul(argv[0], NULL);
-- 
2.25.1



More information about the U-Boot mailing list