public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] imls: Add support to list images in NAND device
Date: Wed, 20 Feb 2013 12:12:23 -0600	[thread overview]
Message-ID: <1361383943.31212.3@snotra> (raw)
In-Reply-To: <512444F3.6010109@st.com> (from vipin.kumar@st.com on Tue Feb 19 21:37:23 2013)

On 02/19/2013 09:37:23 PM, Vipin Kumar wrote:
> On 2/20/2013 6:45 AM, Scott Wood wrote:
>> On 12/17/2012 02:32:48 AM, Vipin Kumar wrote:
>>> +#if defined(CONFIG_CMD_IMLS_NAND)
>>> +static int nand_imls_legacyimage(nand_info_t *nand, int nand_dev,
>>> loff_t off,
>>> +		size_t len)
>>> +{
>>> +	void *imgdata;
>>> +	int ret;
>>> +
>>> +	imgdata = malloc(len);
>>> +	if (!imgdata) {
>>> +		printf("May be a Legacy Image at NAND device %d offset
>>> %08llX:\n",
>>> +				nand_dev, off);
>>> +		printf("   Low memory(cannot allocate memory for
>>> image)\n");
>>> +		return -ENOMEM;
>>> +	}
>> 
>> So, it looks like any reasonably-sized kernel image is going to hit
>> this out-of-memory condition given how unreasonably small U-Boot  
>> malloc
>> heaps generally are.
>> 
> 
> Yes, that's right. And it is a pity

I think I'll apply this anyway, as it is still helpful, but a future  
enhancement could be to do a streaming read of the image to verify the  
CRC.

>> As a side note, running this showed U-Boot itself as "may be a legacy
>> image"... it seems that for some reason all the ppc arches start with
>> the uImage header, but otherwise aren't valid uImages.
> 
> This "may be a legacy image" print is when we have successfully  
> copied and validated the 64 byte mkimage header and are not able to  
> allocate the memory from heap for the image data. What it means is  
> that although the whole image might be a good "Legacy image" but we  
> can not guarantee because we have not yet validated the dcrc.
> 
> Thats why this print "May be a legacy image"

Sure, that comment was meant as "hmm, powerpc is doing something weird"  
rather than anything wrong with this patch.

-Scott

  reply	other threads:[~2013-02-20 18:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17  8:32 [U-Boot] [PATCH v4] imls: Add support to list images in NAND device Vipin Kumar
2013-02-20  1:15 ` Scott Wood
2013-02-20  3:37   ` Vipin Kumar
2013-02-20 18:12     ` Scott Wood [this message]
2013-02-22 22:57 ` [U-Boot] [U-Boot, " Scott Wood

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=1361383943.31212.3@snotra \
    --to=scottwood@freescale.com \
    --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