All of lore.kernel.org
 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: Tue, 19 Feb 2013 19:15:28 -0600	[thread overview]
Message-ID: <1361322928.29654.13@snotra> (raw)
In-Reply-To: <a253f038cf01b628476cda8e41c26efd739834d7.1355732920.git.vipin.kumar@st.com> (from vipin.kumar@st.com on Mon Dec 17 02:32:48 2012)

On 12/17/2012 02:32:48 AM, Vipin Kumar wrote:
> This patch adds support to list images in NAND flash through imls
> 
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> ---
> Changes in v4
> - Keep stdout dumps in one line
> - Continue even after read errors for all the blocks
> 
>  README             |   3 +-
>  common/cmd_bootm.c | 167  
> ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 166 insertions(+), 4 deletions(-)
> 
> diff --git a/README b/README
> index 2077c3b..46fd21d 100644
> --- a/README
> +++ b/README
> @@ -831,7 +831,8 @@ The following options need to be configured:
>  		CONFIG_CMD_I2C		* I2C serial bus support
>  		CONFIG_CMD_IDE		* IDE harddisk support
>  		CONFIG_CMD_IMI		  iminfo
> -		CONFIG_CMD_IMLS		  List all found images
> +		CONFIG_CMD_IMLS		  List all images found in NOR  
> flash
> +		CONFIG_CMD_IMLS_NAND	  List all images found in NAND  
> flash
>  		CONFIG_CMD_IMMAP	* IMMR dump support
>  		CONFIG_CMD_IMPORTENV	* import an environment
>  		CONFIG_CMD_INI		* import data from an ini file  
> into the env
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index d256ddf..938e500 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -80,9 +80,15 @@ static int image_info(unsigned long addr);
>  #include <flash.h>
>  #include <mtd/cfi_flash.h>
>  extern flash_info_t flash_info[]; /* info for FLASH chips */
> +#endif
> +
> +#if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
>  static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char *  
> const argv[]);
>  #endif
> 
> +#include <linux/err.h>
> +#include <nand.h>
> +
>  #ifdef CONFIG_SILENT_CONSOLE
>  static void fixup_silent_linux(void);
>  #endif
> @@ -1175,7 +1181,7 @@ U_BOOT_CMD(
>  /* imls - list all images found in flash */
>  /*******************************************************************/
>  #if defined(CONFIG_CMD_IMLS)
> -static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char *  
> const argv[])
> +static int do_imls_nor(void)
>  {
>  	flash_info_t *info;
>  	int i, j;
> @@ -1224,6 +1230,161 @@ next_sector:		;
>  		}
>  next_bank:	;
>  	}
> +	return 0;
> +}
> +#endif
> +
> +#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.

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.

-Scott

  reply	other threads:[~2013-02-20  1:15 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 [this message]
2013-02-20  3:37   ` Vipin Kumar
2013-02-20 18:12     ` Scott Wood
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=1361322928.29654.13@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.