diff mbox

[U-Boot,1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc

Message ID 1373398497-4658-1-git-send-email-trini@ti.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Tom Rini July 9, 2013, 7:34 p.m. UTC
Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
state functions will work.

Signed-off-by: Tom Rini <trini@ti.com>
---
 common/cmd_bootm.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Comments

Stephen Warren July 10, 2013, 4:59 a.m. UTC | #1
On 07/09/2013 01:34 PM, Tom Rini wrote:
> Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
> state functions will work.

I found that the Raspberry Pi was randomly crashing with recent
u-boot/master (bisect points at/near commit 35fc84f "Refactor the bootm
command to reduce code duplication"; there is some slight variation in
symptoms around there), or sometimes just spewing errors from bootz. I
found the following commits on the mailing list:

> e1ec5e0 cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself
> c83a89d cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
> d18cab6 bootm: Add the missing PREP stage to bootz and correct image handling
> 4766b32 bootm: Clean up bootz_setup() function
> f65d734 bootm: Require boot function only if it is about to be used
> bf6f341 bootm: Disable interrupts only when loading
> a01d5e4 bootm: Handle errors consistently

... and the combination of all 7 of them (but not just Simon's 5
patches) seems to solve this, so,

Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Simon Glass July 10, 2013, 9:53 a.m. UTC | #2
On Tue, Jul 9, 2013 at 9:59 PM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> On 07/09/2013 01:34 PM, Tom Rini wrote:
> > Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
> > state functions will work.
>
> I found that the Raspberry Pi was randomly crashing with recent
> u-boot/master (bisect points at/near commit 35fc84f "Refactor the bootm
> command to reduce code duplication"; there is some slight variation in
> symptoms around there), or sometimes just spewing errors from bootz. I
> found the following commits on the mailing list:
>
> > e1ec5e0 cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself
> > c83a89d cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
> > d18cab6 bootm: Add the missing PREP stage to bootz and correct image
> handling
> > 4766b32 bootm: Clean up bootz_setup() function
> > f65d734 bootm: Require boot function only if it is about to be used
> > bf6f341 bootm: Disable interrupts only when loading
> > a01d5e4 bootm: Handle errors consistently
>
> ... and the combination of all 7 of them (but not just Simon's 5
> patches) seems to solve this, so,
>
> Tested-by: Stephen Warren <swarren@wwwdotorg.org>
>
>
Thanks Stephen. Is this with an attached dtb or not? What 'bootz' command
line are you testing here? I just want to make sure we are covering all the
options

Regards,
Simon
Tom Rini July 10, 2013, 1:19 p.m. UTC | #3
On Tue, Jul 09, 2013 at 03:34:56PM -0400, Tom Rini wrote:

> Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
> state functions will work.
> 
> Signed-off-by: Tom Rini <trini@ti.com>

This and 2/2 have now been applied to u-boot/master.
Stephen Warren July 10, 2013, 3:38 p.m. UTC | #4
On 07/10/2013 03:53 AM, Simon Glass wrote:
> On Tue, Jul 9, 2013 at 9:59 PM, Stephen Warren <swarren@wwwdotorg.org
> <mailto:swarren@wwwdotorg.org>> wrote:
> 
>     On 07/09/2013 01:34 PM, Tom Rini wrote:
>     > Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
>     > state functions will work.
> 
>     I found that the Raspberry Pi was randomly crashing with recent
>     u-boot/master (bisect points at/near commit 35fc84f "Refactor the bootm
>     command to reduce code duplication"; there is some slight variation in
>     symptoms around there), or sometimes just spewing errors from bootz. I
>     found the following commits on the mailing list:
> 
>     > e1ec5e0 cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself
>     > c83a89d cmd_bootm.c: Make bootz consume 'bootz' from argv,
>     decrement argc
>     > d18cab6 bootm: Add the missing PREP stage to bootz and correct
>     image handling
>     > 4766b32 bootm: Clean up bootz_setup() function
>     > f65d734 bootm: Require boot function only if it is about to be used
>     > bf6f341 bootm: Disable interrupts only when loading
>     > a01d5e4 bootm: Handle errors consistently
> 
>     ... and the combination of all 7 of them (but not just Simon's 5
>     patches) seems to solve this, so,
> 
>     Tested-by: Stephen Warren <swarren@wwwdotorg.org
> 
> Thanks Stephen. Is this with an attached dtb or not? What 'bootz'
> command line are you testing here? I just want to make sure we are
> covering all the options

This is a separate kernel and DTB; the command-line is roughly:

bootz addr_of_zimage - addr_of_dtb
diff mbox

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d0ad80f..3a899bc 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1763,12 +1763,12 @@  static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
 			      images, 1);
 
 	/* Setup Linux kernel zImage entry point */
-	if (argc < 2) {
+	if (!argc) {
 		images->ep = load_addr;
 		debug("*  kernel: default image load address = 0x%08lx\n",
 				load_addr);
 	} else {
-		images->ep = simple_strtoul(argv[1], NULL, 16);
+		images->ep = simple_strtoul(argv[0], NULL, 16);
 		debug("*  kernel: cmdline image address = 0x%08lx\n",
 			images->ep);
 	}
@@ -1779,16 +1779,24 @@  static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	lmb_reserve(&images->lmb, images->ep, zi_end - zi_start);
 
-	ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_FINDOTHER,
-			      images, 1);
+	if (bootm_find_ramdisk(flag, argc, argv))
+		return 1;
 
-	return ret;
+#if defined(CONFIG_OF_LIBFDT)
+	if (bootm_find_fdt(flag, argc, argv))
+		return 1;
+#endif
+
+	return 0;
 }
 
 int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int ret;
 
+	/* Consume 'bootz' */
+	argc--; argv++;
+
 	if (bootz_start(cmdtp, flag, argc, argv, &images))
 		return 1;