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] BOOT: Add RAW ramdisk support to bootz
Date: Fri, 16 Mar 2012 08:30:26 +0100	[thread overview]
Message-ID: <20120316073026.EC79F202BBA@gemini.denx.de> (raw)
In-Reply-To: <1331857196-29512-1-git-send-email-marex@denx.de>

Dear Marek Vasut,

In message <1331857196-29512-1-git-send-email-marex@denx.de> you wrote:
> This patch allows loading RAW ramdisk via bootz command. The raw ramdisk is
> loaded only in case it's size is specified:
> 
>   bootz <kernel addr> <ramdisk addr>:<ramdisk size> <fdt addr>
> 
> For example:
> 
>   bootz 0x42000000 0x43000000:0x12345 0x44000000
...
> --- a/common/image.c
> +++ b/common/image.c
> @@ -797,6 +797,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
>  	ulong rd_addr, rd_load;
>  	ulong rd_data, rd_len;
>  	const image_header_t *rd_hdr;
> +	char *end;
>  #if defined(CONFIG_FIT)
>  	void		*fit_hdr;
>  	const char	*fit_uname_config = NULL;
> @@ -845,10 +846,18 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
>  			} else
>  #endif
>  			{
> -				rd_addr = simple_strtoul(argv[2], NULL, 16);
> +				rd_addr = simple_strtoul(argv[2], &end, 16);
>  				debug("*  ramdisk: cmdline image address = "
>  						"0x%08lx\n",
>  						rd_addr);
> +
> +				if (end[0] == ':') {
> +					rd_len = simple_strtoul(++end,
> +								NULL, 16);
> +					debug("*  ramdisk: cmdline image "
> +						"length = 0x%08lx\n",
> +						rd_len);
> +				}

This is common code, which gets used not only for bootz.

I see a number of problems:

- You add code size even for systems which don't enable "bootz"
  support.

- You change the syntax of all boot related commands where a ramdisk
  address may be passed (i. e. "bootm") without documenting it.

- Using this syntax with a mkimage wrapped ramdisk image will cause
  bad things to happen, even if you specific the correct size.  The
  API should be more robust.

> +			/*
> +			 * Check if rd_len was manually overridden, if it was,
> +			 * we're loading RAW ramdisk.
> +			 */

This is undocumented policy, and I dislike such a side-effect based
design (if we have a size parameter, it must be a raw image).

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
Do you suppose the reason the ends of the `Intel Inside'  logo  don't
match up is that it was drawn on a Pentium?

  reply	other threads:[~2012-03-16  7:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16  0:19 [U-Boot] [PATCH] BOOT: Add RAW ramdisk support to bootz Marek Vasut
2012-03-16  7:30 ` Wolfgang Denk [this message]
2012-03-16  8:45   ` Marek Vasut
2012-03-16 11:09     ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2012-03-16 21:30 [U-Boot] [PATCH V2] " Marek Vasut
2012-03-18 21:47 ` [U-Boot] [PATCH] " Rob Herring
2012-03-22  9:10   ` Marek Vasut
2012-03-22 12:14     ` Rob Herring
2012-03-22 12:45       ` Marek Vasut
2012-03-22 13:33         ` Wolfgang Denk
2012-03-22 16:45           ` Marek Vasut
2012-03-22 23:04             ` Wolfgang Denk
2012-03-23  8:36               ` Marek Vasut
2012-03-28 20:54                 ` Marek Vasut
2012-03-30 21:01   ` Wolfgang Denk
2012-03-30 21:12   ` Wolfgang Denk

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=20120316073026.EC79F202BBA@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