[PATCH v1] fdt: Add U-Boot version to chosen node
Francesco Dolcini
francesco.dolcini at toradex.com
Thu May 19 16:22:26 CEST 2022
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 at toradex.com>
---
common/fdt_support.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 7e9e6542041d..8c18af2ce156 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -19,6 +19,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
@@ -305,6 +306,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);
}
--
2.25.1
More information about the U-Boot
mailing list