mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alex Vazquez <avazquez.dev@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: Fwd: boot kernel with append device tree
Date: Tue, 8 Nov 2016 08:29:36 +0100	[thread overview]
Message-ID: <20161108072936.beuncvhpwxuhumkg@pengutronix.de> (raw)
In-Reply-To: <CAOTEMURrS==8jFv=K4s_puQKxK+27fJ3PyMV05j5XWoyJPucPg@mail.gmail.com>

On Mon, Nov 07, 2016 at 12:01:25PM +0100, Alex Vazquez wrote:
> > Is CONFIG_OFTREE enabled in your build?
> Yes.

Ok, could you please try the following patch? Another possibility would
be to disable CONFIG_OFTREE, but it would be good if you could test the
patch anyway since the same bug is still present in current master.

Sascha

----------------------------------8<--------------------------------

From 500e5f87f9943958fa4662e29261a0abb4df24d9 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Tue, 8 Nov 2016 08:23:17 +0100
Subject: [PATCH] ARM: Fix appended device tree when CONFIG_OFTREE is enabled

When CONFIG_OFTREE is enabled the appended device tree is unflattened
and put into data->of_root_node, but there it is never used again.
To actually use the appended device tree put it into data->oftree
instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib/bootm.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 28b4f4a..8977d08 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -244,12 +244,21 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
 	}
 
 	if (IS_BUILTIN(CONFIG_OFTREE)) {
-		data->of_root_node = of_unflatten_dtb(oftree);
-		if (!data->of_root_node) {
+		struct device_node *root;
+
+		root = of_unflatten_dtb(oftree);
+		if (!root) {
 			pr_err("unable to unflatten devicetree\n");
 			ret = -EINVAL;
 			goto err_free;
 		}
+		data->oftree = of_get_fixed_tree(root);
+		if (!data->oftree) {
+			pr_err("Unable to get fixed tree\n");
+			ret = -EINVAL;
+			goto err_free;
+		}
+
 		free(oftree);
 	} else {
 		data->oftree = oftree;
-- 
2.10.1

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-11-08  7:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOTEMUR=FtB_Ox++XPvomyHXsk5Jcm7CG7aEM6WmN++t0211Aw@mail.gmail.com>
     [not found] ` <CAOTEMUQt95XDorid8sj9FHkpCpUJYnqNeRbBU+33aLYz2oM+gw@mail.gmail.com>
2016-11-07  7:49   ` Sascha Hauer
2016-11-07  8:25     ` Alex Vazquez
2016-11-07  9:48       ` Sascha Hauer
2016-11-07 11:01         ` Alex Vazquez
2016-11-08  7:29           ` Sascha Hauer [this message]
2016-11-09  8:41             ` Alex Vazquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161108072936.beuncvhpwxuhumkg@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=avazquez.dev@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox