5a84598f90114c4c4a7cd9c1583a9ef953af2070
[openwrt/staging/981213.git] /
1 From 5f2d5915f8ea4785bc2b8a26955e176a7898c15b Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Tue, 12 Apr 2022 21:00:43 +0100
4 Subject: [PATCH] image-fdt: save name of FIT configuration in '/chosen' node
5
6 It can be useful for the OS (Linux) to know which configuration has
7 been chosen by U-Boot when launching a FIT image.
8 Store the name of the FIT configuration node used in a new string
9 property called 'u-boot,bootconf' in the '/chosen' node in device tree.
10
11 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
12 Reviewed-by: Tom Rini <trini@konsulko.com>
13 ---
14 boot/image-fdt.c | 6 ++++++
15 1 file changed, 6 insertions(+)
16
17 --- a/boot/image-fdt.c
18 +++ b/boot/image-fdt.c
19 @@ -636,6 +636,12 @@ int image_setup_libfdt(struct bootm_head
20 images->fit_uname_cfg,
21 strlen(images->fit_uname_cfg) + 1, 1);
22
23 + /* Store name of configuration node as u-boot,bootconf in /chosen node */
24 + if (images->fit_uname_cfg)
25 + fdt_find_and_setprop(blob, "/chosen", "u-boot,bootconf",
26 + images->fit_uname_cfg,
27 + strlen(images->fit_uname_cfg) + 1, 1);
28 +
29 /* Update ethernet nodes */
30 fdt_fixup_ethernet(blob);
31 #if CONFIG_IS_ENABLED(CMD_PSTORE)