summaryrefslogtreecommitdiffstats
path: root/commands/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-03-03 14:04:57 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-06 11:41:29 +0100
commit6d6edfcf53be19efa040b3a6fcb7583ce1fca573 (patch)
tree0a3fc1ea02aec09c2459c5787f0731db06e8d6d9 /commands/bootm.c
parent0ba9a2347a747ae307e072030fc47fd684971249 (diff)
downloadbarebox-6d6edfcf53be19efa040b3a6fcb7583ce1fca573.tar.gz
barebox-6d6edfcf53be19efa040b3a6fcb7583ce1fca573.tar.xz
bootm: Pass unflattened devicetree to handlers
This makes it possible to modify the tree in the handlers. This is necessary because the initrd addresses are only known inside the handlers, but not to the generic bootm code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/bootm.c')
-rw-r--r--commands/bootm.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/commands/bootm.c b/commands/bootm.c
index 65a75e20ba..ea5a35b52a 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -138,9 +138,8 @@ static int bootm_open_initrd_uimage(struct image_data *data)
static int bootm_open_oftree(struct image_data *data, const char *oftree, int num)
{
enum filetype ft;
- struct fdt_header *fdt, *fixfdt;
+ struct fdt_header *fdt;
size_t size;
- struct device_node *node;
printf("Loading devicetree from '%s'\n", oftree);
@@ -188,23 +187,14 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
file_type_to_string(ft));
}
- node = of_unflatten_dtb(NULL, fdt);
- if (!node) {
+ data->of_root_node = of_unflatten_dtb(NULL, fdt);
+ if (!data->of_root_node) {
pr_err("unable to unflatten devicetree\n");
return -EINVAL;
}
- if (bootm_verbose(data) > 1)
- of_print_nodes(node, 0);
-
- fixfdt = of_get_fixed_tree(node);
- if (!fixfdt)
- return -EINVAL;
-
free(fdt);
- data->oftree = fixfdt;
-
return 0;
}
#endif
@@ -408,10 +398,14 @@ static int do_bootm(int argc, char *argv[])
if (ret)
goto err_out;
} else {
- data.oftree = of_get_fixed_tree(NULL);
- if (bootm_verbose(&data) && data.oftree)
+ data.of_root_node = of_get_root_node();
+ if (bootm_verbose(&data) && data.of_root_node)
printf("using internal devicetree\n");
}
+
+
+ if (bootm_verbose(&data) > 1 && data.of_root_node)
+ of_print_nodes(data.of_root_node, 0);
#endif
if (data.os_address == UIMAGE_SOME_ADDRESS)
data.os_address = UIMAGE_INVALID_ADDRESS;