[PATCH v3] commands: of_dump switch to get fixed devictree
Sascha Hauer
s.hauer at pengutronix.de
Mon Sep 1 03:38:33 PDT 2014
On Thu, Aug 21, 2014 at 01:26:19PM +0200, Jan Weitzel wrote:
> Add a switch to get the devicetree processed by the registered fixups.
> This is also whats the kernel gets.
>
> Signed-off-by: Jan Weitzel <j.weitzel at phytec.de>
> ---
> v3: create a copy of the internal devicetree before use of_fix_tree
>
> commands/of_dump.c | 31 +++++++++++++++++++++++++++++--
> 1 files changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/commands/of_dump.c b/commands/of_dump.c
> index cafde07..f82f0fd 100644
> --- a/commands/of_dump.c
> +++ b/commands/of_dump.c
> @@ -34,16 +34,20 @@ static int do_of_dump(int argc, char *argv[])
> {
> int opt;
> int ret;
> + int fix = 0;
> struct device_node *root = NULL, *node, *of_free = NULL;
> char *dtbfile = NULL;
> size_t size;
> const char *nodename;
>
> - while ((opt = getopt(argc, argv, "f:")) > 0) {
> + while ((opt = getopt(argc, argv, "Ff:")) > 0) {
> switch (opt) {
> case 'f':
> dtbfile = optarg;
> break;
> + case 'F':
> + fix = 1;
> + break;
> default:
> return COMMAND_ERROR_USAGE;
> }
> @@ -75,6 +79,28 @@ static int do_of_dump(int argc, char *argv[])
> of_free = root;
> } else {
> root = of_get_root_node();
> +
> + if (fix) {
> + /* create a copy of internal devicetree */
> + void *fdt;
> + fdt = of_flatten_dtb(root);
> + root = of_unflatten_dtb(fdt);
That's really a creative way to make a copy of the device tree ;)
Ok, I'll close both eyes while applying it.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list