From afe3065206081ecaa73bac92f79a444d7543b79e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 30 May 2013 20:07:15 +0200 Subject: [PATCH 1/6] of: do not scan aliases when no root node present Signed-off-by: Sascha Hauer --- drivers/of/base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 3b9cc65d7..3cedd8b01 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -145,6 +145,9 @@ static void of_alias_scan(void) INIT_LIST_HEAD(&aliases_lookup); + if (!root_node) + return; + of_aliases = of_find_node_by_path(root_node, "/aliases"); if (!of_aliases) return; From 08d78d50aed76a8a9ad043b18cd361b99b01dbe5 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 28 May 2013 08:28:44 +0200 Subject: [PATCH 2/6] of: Also print disabled nodes It's confusing to set the status of a node to disabled and afterwards it's invisible. Similarly it's confusing to be able to enable invisible nodes. Also print disabled nodes. Signed-off-by: Sascha Hauer --- drivers/of/base.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 3cedd8b01..1db8db59a 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -681,9 +681,6 @@ void of_print_nodes(struct device_node *node, int indent) if (!node) return; - if (of_node_disabled(node)) - return; - for (i = 0; i < indent; i++) printf("\t"); From a872dc166ad6cd4c7f7e809ba4cb315b1614ff04 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 28 May 2013 14:38:38 +0200 Subject: [PATCH 3/6] of: remove unused define Signed-off-by: Sascha Hauer --- common/oftree.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/oftree.c b/common/oftree.c index 776d30118..19fed6b0b 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -160,12 +160,6 @@ int of_fix_tree(struct device_node *node) return 0; } -/* - * The size by which we increase the dtb to have space for additional - * fixups. Ideally this would be done by libfdt automatically - */ -#define OFTREE_SIZE_INCREASE 0x8000 - /* * Get the fixed fdt. This function uses the fdt input pointer * if provided or the barebox internal devicetree if not. From 08026afdeb1276163b8e99cb85c1e56779ff5c2f Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 28 May 2013 14:56:00 +0200 Subject: [PATCH 4/6] bootm: make sure to print fixed oftree when doing bootm -v -v we dumped the original tree to the console. Make sure to print the fixed tree instead so that the fixups can be examined. Signed-off-by: Sascha Hauer --- arch/arm/lib/bootm.c | 2 ++ commands/bootm.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index e7a0625d3..133e04da0 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -91,6 +91,8 @@ static int __do_bootm_linux(struct image_data *data, int swap) of_add_reserve_entry(initrd_start, initrd_end); data->oftree = of_get_fixed_tree(data->of_root_node); fdt_add_reserve_map(data->oftree); + if (bootm_verbose(data) > 1) + of_print_nodes(data->of_root_node, 0); } if (bootm_verbose(data)) { diff --git a/commands/bootm.c b/commands/bootm.c index 5dd170353..3976eb49b 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -398,10 +398,6 @@ static int do_bootm(int argc, char *argv[]) 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; From b5167ee51ca21195aff4707f1a503708febe51c3 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 28 May 2013 14:57:29 +0200 Subject: [PATCH 5/6] bootm: print Kernel commandline in verbose mode Without devicetree support we print the Kernel commandline in verbose mode. Do the same with devicetree boot aswell. Signed-off-by: Sascha Hauer --- arch/arm/lib/bootm.c | 2 ++ common/oftree.c | 15 +++++++++++++++ include/of.h | 1 + 3 files changed, 18 insertions(+) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 133e04da0..ee27e34d4 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -91,6 +91,8 @@ static int __do_bootm_linux(struct image_data *data, int swap) of_add_reserve_entry(initrd_start, initrd_end); data->oftree = of_get_fixed_tree(data->of_root_node); fdt_add_reserve_map(data->oftree); + if (bootm_verbose(data)) + of_print_cmdline(data->of_root_node); if (bootm_verbose(data) > 1) of_print_nodes(data->of_root_node, 0); } diff --git a/common/oftree.c b/common/oftree.c index 19fed6b0b..475d41884 100644 --- a/common/oftree.c +++ b/common/oftree.c @@ -98,6 +98,21 @@ void of_print_property(const void *data, int len) } } +void of_print_cmdline(struct device_node *root) +{ + struct device_node *node = of_find_node_by_path(root, "/chosen"); + const char *cmdline; + + if (!node) { + printf("commandline: no /chosen node\n"); + return; + } + + cmdline = of_get_property(node, "bootargs", NULL); + + printf("commandline: %s\n", cmdline); +} + static int of_fixup_bootargs(struct device_node *root) { struct device_node *node; diff --git a/include/of.h b/include/of.h index 3f64667b6..d7bed7cc5 100644 --- a/include/of.h +++ b/include/of.h @@ -138,6 +138,7 @@ int of_get_named_gpio(struct device_node *np, struct device_node *of_find_node_by_phandle(phandle phandle); void of_print_property(const void *data, int len); +void of_print_cmdline(struct device_node *root); int of_device_is_compatible(const struct device_node *device, const char *compat); From 5d308ce6400678239248c54d565bf385bbadbb42 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 31 May 2013 16:14:35 +0200 Subject: [PATCH 6/6] bootm: Print internal devicetree information without verbose It's a precious information that barebox will boot the kernel with the internal devicetree, so print it even in non verbose mode. Signed-off-by: Sascha Hauer --- commands/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/bootm.c b/commands/bootm.c index 3976eb49b..6ce2ca989 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -395,7 +395,7 @@ static int do_bootm(int argc, char *argv[]) goto err_out; } else { data.of_root_node = of_get_root_node(); - if (bootm_verbose(&data) && data.of_root_node) + if (data.of_root_node) printf("using internal devicetree\n"); } #endif