public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: Fix bug in size calculation in fdt_resize() with initrd use
Date: Mon, 09 Aug 2010 01:11:00 +0200	[thread overview]
Message-ID: <20100808231100.6C520207@gemini.denx.de> (raw)
In-Reply-To: <1280845363-23197-1-git-send-email-sr@denx.de>

Dear Stefan Roese,

In message <1280845363-23197-1-git-send-email-sr@denx.de> you wrote:
> From: Feng Wang <fwang02@harris.com>
> 
> Original bug description from Feng (fdt_resize() bug caused "WARNING:
> could not set linux, initrd-start FDT_ERR_NOSPACE."):
> 
> What I got is an error: "WARNING: could not set linux,initrd-start
> FDT_ERR_NOSPACE." after loading Device Tree blob. This in turn caused
> linux to miss init part.
> 
> After some digging, I found out the reason for this error, it is caused
> by fdt_resize().
> 
> FDT blob got resized after filling in all board specific information of
> PowerPC. (in boot_body_linux()). It reduced blob size with only extra
> space for two fdt_reserve_entry, one for fdt itself, and one for initrd.
> Then it's aligned to a 0x1000 page boundary. However, later in
> fdt_initrd(), it could add two more properties, initrd-start AND
> initrd-end, each one needs at least two fdt_reserve_entry sizes done by
> _fdt_add_property() (name and value). Thus, the two fdt_reserve_entry
> extra space is not sufficient.
> 
> So for some specific fdt size which is just under the page boundary
> after resizing, this will cause an error of FDT_ERR_NOSPACE in
> fdt_initrd() when setting those two properties, and failed to pass
> initrd information to linux.
> 
> My fix is in fdt_resize(), leave at least 4 fdt_reserve_entry for
> initrd. So instead of 2*sizeof(struct fdt_reserve_entry) for
> actual_totalsize, use 5*sizeof(struc fdt_reserve_entry).
> 
> Stefan: I got this same error on katmai, when trying to boot with
> initrd (run flash_self). This patch fixes this issue.
> 
> Signed-off-by: Feng Wang <fwang02@harris.com>
> Tested-by: Stefan Roese <sr@denx.de>
> Cc: Jerry Van Baren <gvb.uboot@gmail.com>
> ---
>  common/fdt_support.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wisdom is one of the few things that looks bigger the further away it
is.                               - Terry Pratchett, _Witches Abroad_

      parent reply	other threads:[~2010-08-08 23:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 14:22 [U-Boot] [PATCH] fdt: Fix bug in size calculation in fdt_resize() with initrd use Stefan Roese
2010-08-08 17:59 ` Jerry Van Baren
2010-08-08 23:11   ` Wolfgang Denk
2010-08-08 23:11 ` Wolfgang Denk [this message]

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=20100808231100.6C520207@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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