diff mbox

[U-Boot] BOOT: Add RAW ramdisk support to bootz

Message ID 1332107278-24123-1-git-send-email-robherring2@gmail.com
State Accepted
Commit 017e1f3f9fc8745cc12bbd924b0cbc4d6ee5dbf8
Headers show

Commit Message

Rob Herring March 18, 2012, 9:47 p.m. UTC
From: Marek Vasut <marek.vasut@gmail.com>

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>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Tom Warren <TWarren@nvidia.com>
Cc: albert.u.boot@aribaud.net
Cc: afleming@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>
---
V3:
- fix operation when CONFIG_FIT is enabled as FIT images use 
  <addr>[:<subimage>]

 README             |    5 +++++
 common/cmd_bootm.c |    6 ++++--
 common/image.c     |   15 ++++++++++++---
 3 files changed, 21 insertions(+), 5 deletions(-)

Comments

Marek Vasut March 22, 2012, 9:10 a.m. UTC | #1
Dear Rob Herring,

> From: Marek Vasut <marek.vasut@gmail.com>
> 
> 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>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Tom Warren <TWarren@nvidia.com>
> Cc: albert.u.boot@aribaud.net
> Cc: afleming@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>

Doesn't this still colide with CONFIG_FIT? Aka. in case of CONFIG_FIT enabled, 
you can't use raw ramdisk?

btw. maybe we should use "@" instead of ":" and be done with it?

> ---
> V3:
> - fix operation when CONFIG_FIT is enabled as FIT images use
>   <addr>[:<subimage>]
> 
>  README             |    5 +++++
>  common/cmd_bootm.c |    6 ++++--
>  common/image.c     |   15 ++++++++++++---
>  3 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/README b/README
> index 5141751..068ec71 100644
> --- a/README
> +++ b/README
> @@ -4330,6 +4330,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 b49d4f7..2f9b214 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -1634,9 +1634,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 77ca6e4..2a25f5f 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -796,6 +796,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;
> @@ -989,9 +990,17 @@ 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
> +			if (argc >= 3 && (end = strchr(argv[2], ':'))) {
> +				rd_len = simple_strtoul(++end, NULL, 16);
> +				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,

Best regards,
Marek Vasut
Rob Herring March 22, 2012, 12:14 p.m. UTC | #2
On 03/22/2012 04:10 AM, Marek Vasut wrote:
> Dear Rob Herring,
> 
>> From: Marek Vasut <marek.vasut@gmail.com>
>>
>> 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>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> Cc: Tom Warren <TWarren@nvidia.com>
>> Cc: albert.u.boot@aribaud.net
>> Cc: afleming@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>
> 
> Doesn't this still colide with CONFIG_FIT? Aka. in case of CONFIG_FIT enabled, 
> you can't use raw ramdisk?

No. All the parsing now is done after trying to read the image type.
Only if a valid legacy or FIT uImage is not found, do we hit the raw
image code and parse the size. I tested both with and without CONFIG_FIT
enabled.

> 
> btw. maybe we should use "@" instead of ":" and be done with it?

Sub images will have an @ in the name. I thought about parsing for that,
but DT has no requirement that you have to have an @ in the node name
and it's not clear to me if u-boot convention requires it or not. Then I
came up with the current patch, so it doesn't matter.

Rob

> 
>> ---
>> V3:
>> - fix operation when CONFIG_FIT is enabled as FIT images use
>>   <addr>[:<subimage>]
>>
>>  README             |    5 +++++
>>  common/cmd_bootm.c |    6 ++++--
>>  common/image.c     |   15 ++++++++++++---
>>  3 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/README b/README
>> index 5141751..068ec71 100644
>> --- a/README
>> +++ b/README
>> @@ -4330,6 +4330,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 b49d4f7..2f9b214 100644
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>> @@ -1634,9 +1634,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 77ca6e4..2a25f5f 100644
>> --- a/common/image.c
>> +++ b/common/image.c
>> @@ -796,6 +796,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;
>> @@ -989,9 +990,17 @@ 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
>> +			if (argc >= 3 && (end = strchr(argv[2], ':'))) {
>> +				rd_len = simple_strtoul(++end, NULL, 16);
>> +				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,
> 
> Best regards,
> Marek Vasut
Marek Vasut March 22, 2012, 12:45 p.m. UTC | #3
Dear Rob Herring,

> On 03/22/2012 04:10 AM, Marek Vasut wrote:
> > Dear Rob Herring,
> > 
> >> From: Marek Vasut <marek.vasut@gmail.com>
> >> 
> >> 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>
> >> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> >> Cc: Tom Warren <TWarren@nvidia.com>
> >> Cc: albert.u.boot@aribaud.net
> >> Cc: afleming@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>
> > 
> > Doesn't this still colide with CONFIG_FIT? Aka. in case of CONFIG_FIT
> > enabled, you can't use raw ramdisk?
> 
> No. All the parsing now is done after trying to read the image type.
> Only if a valid legacy or FIT uImage is not found, do we hit the raw
> image code and parse the size. I tested both with and without CONFIG_FIT
> enabled.
> 
> > btw. maybe we should use "@" instead of ":" and be done with it?
> 
> Sub images will have an @ in the name. I thought about parsing for that,
> but DT has no requirement that you have to have an @ in the node name
> and it's not clear to me if u-boot convention requires it or not. Then I
> came up with the current patch, so it doesn't matter.

Dear Wolfgang Denk, are we OK with applying this and bootz patch please? Can we 
get it into .04 release please?

> 
> Rob
> 
> >> ---
> >> V3:
> >> - fix operation when CONFIG_FIT is enabled as FIT images use
> >> 
> >>   <addr>[:<subimage>]
> >>  
> >>  README             |    5 +++++
> >>  common/cmd_bootm.c |    6 ++++--
> >>  common/image.c     |   15 ++++++++++++---
> >>  3 files changed, 21 insertions(+), 5 deletions(-)
> >> 
> >> diff --git a/README b/README
> >> index 5141751..068ec71 100644
> >> --- a/README
> >> +++ b/README
> >> @@ -4330,6 +4330,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 b49d4f7..2f9b214 100644
> >> --- a/common/cmd_bootm.c
> >> +++ b/common/cmd_bootm.c
> >> @@ -1634,9 +1634,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 77ca6e4..2a25f5f 100644
> >> --- a/common/image.c
> >> +++ b/common/image.c
> >> @@ -796,6 +796,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;
> >> 
> >> @@ -989,9 +990,17 @@ 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
> >> +			if (argc >= 3 && (end = strchr(argv[2], ':'))) {
> >> +				rd_len = simple_strtoul(++end, NULL, 16);
> >> +				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,
> > 
> > Best regards,
> > Marek Vasut

Best regards,
Marek Vasut
Wolfgang Denk March 22, 2012, 1:33 p.m. UTC | #4
Dear Marek,

In message <201203221345.55217.marek.vasut@gmail.com> you wrote:
> 
> > Sub images will have an @ in the name. I thought about parsing for that,
> > but DT has no requirement that you have to have an @ in the node name
> > and it's not clear to me if u-boot convention requires it or not. Then I
> > came up with the current patch, so it doesn't matter.
> 
> Dear Wolfgang Denk, are we OK with applying this and bootz patch please? Can we 
> get it into .04 release please?

"this" - which patch version exactly are you referring to?

In any case this has been submitted long after the close of the MW, so
this is stuff for "next".

Best regards,

Wolfgang Denk
Marek Vasut March 22, 2012, 4:45 p.m. UTC | #5
Dear Wolfgang Denk,

> Dear Marek,
> 
> In message <201203221345.55217.marek.vasut@gmail.com> you wrote:
> > > Sub images will have an @ in the name. I thought about parsing for
> > > that, but DT has no requirement that you have to have an @ in the node
> > > name and it's not clear to me if u-boot convention requires it or not.
> > > Then I came up with the current patch, so it doesn't matter.
> > 
> > Dear Wolfgang Denk, are we OK with applying this and bootz patch please?
> > Can we get it into .04 release please?
> 
> "this" - which patch version exactly are you referring to?

Revision V6.
> 
> In any case this has been submitted long after the close of the MW, so
> this is stuff for "next".

I believe this patch is quite important to the linux-arm people and early 
adoption of this stuff would be very beneficial. Also, there are other patches 
that were applied after the MW was closed. Finally, this patch started long 
before .04 release cycle.

> 
> Best regards,
> 
> Wolfgang Denk

Best regards,
Marek Vasut
Wolfgang Denk March 22, 2012, 11:04 p.m. UTC | #6
Dear Marek Vasut,

In message <201203221745.16226.marek.vasut@gmail.com> you wrote:
> 
> > > Dear Wolfgang Denk, are we OK with applying this and bootz patch please?
> > > Can we get it into .04 release please?
> > 
> > "this" - which patch version exactly are you referring to?
> 
> Revision V6.

Could you please be a bit more specific?  Like posting a link to the
respective message on gmane, or in patchwork?

The Subject: of this message is "BOOT: Add RAW ramdisk support to
bootz", but I have not seen any V6 for this patch.  Ican only guess
that you might be referring to [PATCH V6] BOOT: Add "bootz" command to
boot Linux zImage on ARM - but I'd rather be sure. 

> I believe this patch is quite important to the linux-arm people and early 
> adoption of this stuff would be very beneficial. Also, there are other patches 
> that were applied after the MW was closed. Finally, this patch started long 
> before .04 release cycle.

Where/when?

Best regards,

Wolfgang Denk
Marek Vasut March 23, 2012, 8:36 a.m. UTC | #7
Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <201203221745.16226.marek.vasut@gmail.com> you wrote:
> > > > Dear Wolfgang Denk, are we OK with applying this and bootz patch
> > > > please? Can we get it into .04 release please?
> > > 
> > > "this" - which patch version exactly are you referring to?
> > 
> > Revision V6.
> 
> Could you please be a bit more specific?  Like posting a link to the
> respective message on gmane, or in patchwork?

http://patchwork.ozlabs.org/patch/146848/
http://patchwork.ozlabs.org/patch/147440/

> 
> The Subject: of this message is "BOOT: Add RAW ramdisk support to
> bootz", but I have not seen any V6 for this patch.  Ican only guess
> that you might be referring to [PATCH V6] BOOT: Add "bootz" command to
> boot Linux zImage on ARM - but I'd rather be sure.

Yes, see above two links please.

> 
> > I believe this patch is quite important to the linux-arm people and early
> > adoption of this stuff would be very beneficial. Also, there are other
> > patches that were applied after the MW was closed. Finally, this patch
> > started long before .04 release cycle.
> 
> Where/when?

If you mean the patch, here:
http://patchwork.ozlabs.org/patch/125318/

If you talk about accepting patches way past MW, almost all the time, at least 
in the ARM stuffs. And this works OK so far I believe, I see no breakage. Also, 
we didn't reach the RC phase yet either. Lastly, this change is not intrusive in 
any way.

> 
> Best regards,
> 
> Wolfgang Denk

Best regards,
Marek Vasut
Marek Vasut March 28, 2012, 8:54 p.m. UTC | #8
Dear Wolfgang Denk,

> > Dear Marek Vasut,
> > 
> > In message <201203221745.16226.marek.vasut@gmail.com> you wrote:
> > > > > Dear Wolfgang Denk, are we OK with applying this and bootz patch
> > > > > please? Can we get it into .04 release please?
> > > > 
> > > > "this" - which patch version exactly are you referring to?
> > > 
> > > Revision V6.
> > 
> > Could you please be a bit more specific?  Like posting a link to the
> > respective message on gmane, or in patchwork?
> 
> http://patchwork.ozlabs.org/patch/146848/
> http://patchwork.ozlabs.org/patch/147440/
> 
> > The Subject: of this message is "BOOT: Add RAW ramdisk support to
> > bootz", but I have not seen any V6 for this patch.  Ican only guess
> > that you might be referring to [PATCH V6] BOOT: Add "bootz" command to
> > boot Linux zImage on ARM - but I'd rather be sure.
> 
> Yes, see above two links please.
> 
> > > I believe this patch is quite important to the linux-arm people and
> > > early adoption of this stuff would be very beneficial. Also, there are
> > > other patches that were applied after the MW was closed. Finally, this
> > > patch started long before .04 release cycle.
> > 
> > Where/when?
> 
> If you mean the patch, here:
> http://patchwork.ozlabs.org/patch/125318/
> 
> If you talk about accepting patches way past MW, almost all the time, at
> least in the ARM stuffs. And this works OK so far I believe, I see no
> breakage. Also, we didn't reach the RC phase yet either. Lastly, this
> change is not intrusive in any way.
> 
> > Best regards,
> > 
> > Wolfgang Denk

Did you made up your mind on this patch please?

Best regards,
Marek Vasut
Wolfgang Denk March 30, 2012, 9:01 p.m. UTC | #9
Dear Rob Herring,

In message <1332107278-24123-1-git-send-email-robherring2@gmail.com> you wrote:
> From: Marek Vasut <marek.vasut@gmail.com>
> 
> 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>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Tom Warren <TWarren@nvidia.com>
> Cc: albert.u.boot@aribaud.net
> Cc: afleming@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>
> ---
> V3:
> - fix operation when CONFIG_FIT is enabled as FIT images use 
>   <addr>[:<subimage>]
> 
>  README             |    5 +++++
>  common/cmd_bootm.c |    6 ++++--
>  common/image.c     |   15 ++++++++++++---
>  3 files changed, 21 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Wolfgang Denk March 30, 2012, 9:12 p.m. UTC | #10
Dear Rob & Marek,

In message <1332107278-24123-1-git-send-email-robherring2@gmail.com> you wrote:
> From: Marek Vasut <marek.vasut@gmail.com>
> 
> 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>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> Cc: Tom Warren <TWarren@nvidia.com>
> Cc: albert.u.boot@aribaud.net
> Cc: afleming@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>
> ---
> V3:
> - fix operation when CONFIG_FIT is enabled as FIT images use 
>   <addr>[:<subimage>]

Argh...

This causes build warnings:

+ ./MAKEALL TQM860L
Configuring for TQM860L board...
image.c: In function 'boot_get_ramdisk':
image.c:800: warning: unused variable 'end'


Why do I get this at all?  I did not enable any of the related bootz
stuff on my board!

Please fix!

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/README b/README
index 5141751..068ec71 100644
--- a/README
+++ b/README
@@ -4330,6 +4330,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 b49d4f7..2f9b214 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1634,9 +1634,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 77ca6e4..2a25f5f 100644
--- a/common/image.c
+++ b/common/image.c
@@ -796,6 +796,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;
@@ -989,9 +990,17 @@  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
+			if (argc >= 3 && (end = strchr(argv[2], ':'))) {
+				rd_len = simple_strtoul(++end, NULL, 16);
+				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,