[PATCH v2 37/45] vbe: Drop the U-Boot prefix from the version
Simon Glass
sjg at chromium.org
Thu Oct 13 14:29:19 CEST 2022
We don't need the U-Boot prefix on the version and in fact it is harmful
since pytest gets confused seeing the U-Boot banner bring displayed when
the version is printed.
Drop the prefix from the string.
We could produce an entirely new string from the component parts, but this
adds to the rodata size and would break the use of version_string as the
only thing which holds this information.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
boot/vbe_simple_os.c | 9 +++++++--
test/boot/vbe_simple.c | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c
index 7761b9ef656..058db6154b0 100644
--- a/boot/vbe_simple_os.c
+++ b/boot/vbe_simple_os.c
@@ -18,7 +18,7 @@
int vbe_simple_fixup_node(ofnode node, struct simple_state *state)
{
- char *version;
+ const char *version, *str;
int ret;
version = strdup(state->fw_version);
@@ -31,7 +31,12 @@ int vbe_simple_fixup_node(ofnode node, struct simple_state *state)
ret = ofnode_write_u32(node, "cur-vernum", state->fw_vernum);
if (ret)
return log_msg_ret("num", ret);
- ret = ofnode_write_string(node, "bootloader-version", version_string);
+
+ /* Drop the 'U-Boot ' at the start */
+ str = version_string;
+ if (!strncmp("U-Boot ", str, 7))
+ str += 7;
+ ret = ofnode_write_string(node, "bootloader-version", str);
if (ret)
return log_msg_ret("bl", ret);
diff --git a/test/boot/vbe_simple.c b/test/boot/vbe_simple.c
index faba9e8f90b..a50785dbbf6 100644
--- a/test/boot/vbe_simple.c
+++ b/test/boot/vbe_simple.c
@@ -77,7 +77,7 @@ static int vbe_simple_test_base(struct unit_test_state *uts)
bl_version = ofnode_read_string(node, "bootloader-version");
ut_assertnonnull(bl_version);
- ut_asserteq_str(version_string, bl_version);
+ ut_asserteq_str(version_string + 7, bl_version);
return 0;
}
--
2.38.0.rc1.362.ged0d419d3c-goog
More information about the U-Boot
mailing list