From 068edc9ca986b587d98697c02aa8b9ea782be062 Mon Sep 17 00:00:00 2001 From: Francesco Dolcini Date: Thu, 19 May 2022 16:22:26 +0200 Subject: [PATCH] uboot-mtk-20220606: fdt: Add U-Boot version to chosen node Add a new device tree property "u-boot,version" in the chosen node to pass the U-Boot version to the operating system. This can be useful to implement a firmware upgrade procedure from the operating system. Signed-off-by: Francesco Dolcini Reviewed-by: Tom Rini --- uboot-mtk-20220606/common/fdt_support.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/uboot-mtk-20220606/common/fdt_support.c b/uboot-mtk-20220606/common/fdt_support.c index 8fc010b4e..3eb91a47b 100644 --- a/uboot-mtk-20220606/common/fdt_support.c +++ b/uboot-mtk-20220606/common/fdt_support.c @@ -19,6 +19,7 @@ #include #include #include +#include /** * fdt_getprop_u32_default_node - Return a node's property or a default @@ -309,6 +310,15 @@ int fdt_chosen(void *fdt) } #endif + /* add u-boot version */ + err = fdt_setprop(fdt, nodeoffset, "u-boot,version", PLAIN_VERSION, + strlen(PLAIN_VERSION) + 1); + if (err < 0) { + printf("WARNING: could not set u-boot,version %s.\n", + fdt_strerror(err)); + return err; + } + return fdt_fixup_stdout(fdt, nodeoffset); }