From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] BOOT: Add RAW ramdisk support to bootz
Date: Fri, 16 Mar 2012 22:30:09 +0100 [thread overview]
Message-ID: <201203162230.09522.marex@denx.de> (raw)
In-Reply-To: <4F636229.8080603@gmail.com>
Dear Rob Herring,
> On 03/16/2012 09:02 AM, Marek Vasut 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
> >
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Tom Warren <TWarren@nvidia.com>
> > Cc: albert.u.boot at aribaud.net
> > Cc: afleming at gmail.com,
> > Cc: Simon Glass <sjg@chromium.org>,
> > Cc: Stephen Warren <swarren@nvidia.com>
> > Cc: Nicolas Pitre <nico@fluxnic.net>
> > Cc: Wolfgang Denk <wd@denx.de>
> > Cc: Detlev Zundel <dzu@denx.de>
> > ---
> >
> > README | 5 +++++
> > common/cmd_bootm.c | 6 ++++--
> > common/image.c | 31 +++++++++++++++++++++++++++----
> > 3 files changed, 36 insertions(+), 6 deletions(-)
> >
> > V2: Make this feature configurable
> >
> > Document this feature
> >
> > diff --git a/README b/README
> > index b273070..43fa160 100644
> > --- a/README
> > +++ b/README
> > @@ -4422,6 +4422,11 @@ On some platforms, it's possible to boot Linux
> > zImage. This is done
> >
> > using the "bootz" command. The syntax of "bootz" command is the same
> > as the syntax of "bootm" command.
> >
> > +Note, defining the CONFIG_SUPPORT_INITRD_RAW allows user to supply
> > +kernel with raw initrd images. The syntax is slightly different, the
> > +address of the initrd must be augmented by it's size, in the following
> > +format: "<initrd addres>:<initrd size>".
> > +
> >
> > Standalone HOWTO:
> > =================
> >
> > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> > index 9efac8b..872a49c 100644
> > --- a/common/cmd_bootm.c
> > +++ b/common/cmd_bootm.c
> > @@ -1628,9 +1628,11 @@ static int do_bootz(cmd_tbl_t *cmdtp, int flag,
> > int argc, char * const argv[])
> >
> > U_BOOT_CMD(
> >
> > bootz, CONFIG_SYS_MAXARGS, 1, do_bootz,
> > "boot Linux zImage image from memory",
> >
> > - "[addr [initrd] [fdt]]\n - boot Linux zImage stored in memory\n"
> > + "[addr [initrd[:size]] [fdt]]\n"
> > + " - boot Linux zImage stored in memory\n"
> >
> > "\tThe argument 'initrd' is optional and specifies the address\n"
> >
> > - "\tof the initrd in memory.\n"
> > + "\tof the initrd in memory. The optional argument ':size' allows\n"
> > + "\tspecifying the size of RAW initrd.\n"
> >
> > #if defined(CONFIG_OF_LIBFDT)
> >
> > "\tWhen booting a Linux kernel which requires a flat device-tree\n"
> > "\ta third argument is required which is the address of the\n"
> >
> > diff --git a/common/image.c b/common/image.c
> > index 95c7a15..1908df6 100644
> > --- 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,21 @@ 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);
>
> V1 did not work for me and it looks like V2 has the same problem. You'll
> never get to this else because of the call to fit_parse_subimage above:
>
> * fit_parse_subimage() expects subimage spec in the for of
> * [<addr>]:<subimage>, where <addr> is a FIT image address that contains
> * subimage with a <subimg> unit name.
>
>
> With debug turned on, it thinks my size is the sub-image name:
>
> * ramdisk: subimage '3DC72E' from image at 0x01000000
> ramdisk start = 0x1ff912fc, ramdisk end = 0x3fe98ab4
Good catch, thanks for testing ... will poke around further. But if you have any
suggestions now that you dug in it, they're welcome :)
>
> Rob
>
> > debug("* ramdisk: cmdline image address = "
> >
> > "0x%08lx\n",
> > rd_addr);
> >
> > +
> > +#ifdef CONFIG_SUPPORT_RAW_INITRD
> > + if (end[0] == ':') {
> > + rd_len = simple_strtoul(++end,
> > + NULL, 16);
> > + debug("* ramdisk: cmdline image "
> > + "length = 0x%08lx\n",
> > + rd_len);
> > + }
> > +#endif
> > +
> >
> > }
> >
> > #if defined(CONFIG_FIT)
> >
> > } else {
> >
> > @@ -990,9 +1002,20 @@ int boot_get_ramdisk(int argc, char * const argv[],
> > bootm_headers_t *images,
> >
> > break;
> >
> > #endif
> >
> > default:
> > - puts("Wrong Ramdisk Image Format\n");
> > - rd_data = rd_len = rd_load = 0;
> > - return 1;
> > +#ifdef CONFIG_SUPPORT_RAW_INITRD
> > + /*
> > + * Check if rd_len was manually overridden, if it was,
> > + * we're loading RAW ramdisk.
> > + */
> > + if (rd_len != 0) {
> > + rd_data = rd_addr;
> > + } else
> > +#endif
> > + {
> > + puts("Wrong Ramdisk Image Format\n");
> > + rd_data = rd_len = rd_load = 0;
> > + return 1;
> > + }
> >
> > }
> >
> > } else if (images->legacy_hdr_valid &&
> >
> > image_check_type(&images->legacy_hdr_os_copy,
next prev parent reply other threads:[~2012-03-16 21:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Message-Id: <1331857196-29512-1-git-send-email-marex@denx.de>
2012-03-16 14:02 ` [U-Boot] [PATCH V2] BOOT: Add RAW ramdisk support to bootz Marek Vasut
2012-03-16 15:54 ` Rob Herring
2012-03-16 21:30 ` Marek Vasut [this message]
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=201203162230.09522.marex@denx.de \
--to=marek.vasut@gmail.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