[PATCH 2/2] bootm: fix printing kernel command line

Sascha Hauer s.hauer at pengutronix.de
Thu Sep 21 04:04:57 PDT 2023


Since af084cae41ce ("of: never fixup internal live tree")
of_get_fixed_tree() no longer fixes the tree passed into the function, but a copy thereof
instead. in bootm this has the side effect that data->of_root_node
will no longer contain a fixed tree, but the original tree instead.
data->of_root_node is used later for printing the kernel command line
and it's also printed with bootm -vv, so this pointer should really
hold a fixed tree.
Fix this by not using of_get_fixed_tree() but open coding it.

Fixes: af084cae41ce ("of: never fixup internal live tree")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/bootm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 27ada61f4e..2469d43441 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -421,7 +421,9 @@ void *bootm_get_devicetree(struct image_data *data)
 		of_add_reserve_entry(data->initrd_res->start, data->initrd_res->end);
 	}
 
-	oftree = of_get_fixed_tree(data->of_root_node);
+	of_fix_tree(data->of_root_node);
+
+	oftree = of_flatten_dtb(data->of_root_node);
 	if (!oftree)
 		return ERR_PTR(-EINVAL);
 
-- 
2.39.2




More information about the barebox mailing list