summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Dolcini <francesco.dolcini@toradex.com>2022-05-19 16:22:26 +0200
committerFrancesco Dolcini <francesco.dolcini@toradex.com>2022-06-07 16:50:03 +0200
commitf56d94cfea251108c841fdfacfdb0befe900e5c1 (patch)
tree7fbd64ffc579d9eff295782563df91261e6ea345
parentfef4b016a4189ed147d1bdbe29bc93ca41cad40c (diff)
fdt: Add U-Boot version to chosen node
commit 622ecee93a604c017aca23906c5cc903b4002b78 upstream. 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 <francesco.dolcini@toradex.com> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--common/fdt_support.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 02cf5c6241..5a1c5c7378 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -17,6 +17,7 @@
#include <fdt_support.h>
#include <exports.h>
#include <fdtdec.h>
+#include <version.h>
/**
* fdt_getprop_u32_default_node - Return a node's property or a default
@@ -300,6 +301,15 @@ int fdt_chosen(void *fdt)
}
}
+ /* 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);
}