* [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
@ 2013-07-09 19:34 Tom Rini
2013-07-09 19:34 ` [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself Tom Rini
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Tom Rini @ 2013-07-09 19:34 UTC (permalink / raw)
To: u-boot
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(-)
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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself
2013-07-09 19:34 [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Tom Rini
@ 2013-07-09 19:34 ` Tom Rini
2013-07-10 4:59 ` [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Stephen Warren
2013-07-10 13:19 ` Tom Rini
2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2013-07-09 19:34 UTC (permalink / raw)
To: u-boot
As a zImage does not have a U-Boot header, we cannot really do what
BOOTM_STATE_FINDOTHER does, exactly. Break the ramdisk/fdt portions of
bootm_find_other into bootm_find_ramdisk/fdt which can be called in both
cases.
Signed-off-by: Tom Rini <trini@ti.com>
---
common/cmd_bootm.c | 56 +++++++++++++++++++++++++++++++++++++---------------
1 file changed, 40 insertions(+), 16 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 3a899bc..1498380 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -309,33 +309,53 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}
-static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
+static int bootm_find_ramdisk(int flag, int argc, char * const argv[])
+{
+ int ret;
+
+ /* find ramdisk */
+ ret = boot_get_ramdisk(argc, argv, &images, IH_INITRD_ARCH,
+ &images.rd_start, &images.rd_end);
+ if (ret) {
+ puts("Ramdisk image is corrupt or invalid\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+#if defined(CONFIG_OF_LIBFDT)
+static int bootm_find_fdt(int flag, int argc, char * const argv[])
{
int ret;
+ /* find flattened device tree */
+ ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
+ &images.ft_addr, &images.ft_len);
+ if (ret) {
+ puts("Could not find a valid device tree\n");
+ return 1;
+ }
+
+ set_working_fdt_addr(images.ft_addr);
+
+ return 0;
+}
+#endif
+
+static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
if (((images.os.type == IH_TYPE_KERNEL) ||
(images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
(images.os.type == IH_TYPE_MULTI)) &&
(images.os.os == IH_OS_LINUX)) {
- /* find ramdisk */
- ret = boot_get_ramdisk(argc, argv, &images, IH_INITRD_ARCH,
- &images.rd_start, &images.rd_end);
- if (ret) {
- puts("Ramdisk image is corrupt or invalid\n");
+ if (bootm_find_ramdisk(flag, argc, argv))
return 1;
- }
#if defined(CONFIG_OF_LIBFDT)
- /* find flattened device tree */
- ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
- &images.ft_addr, &images.ft_len);
- if (ret) {
- puts("Could not find a valid device tree\n");
+ if (bootm_find_fdt(flag, argc, argv))
return 1;
- }
-
- set_working_fdt_addr(images.ft_addr);
#endif
}
@@ -1779,6 +1799,10 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
lmb_reserve(&images->lmb, images->ep, zi_end - zi_start);
+ /*
+ * Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
+ * have a header that provide this informaiton.
+ */
if (bootm_find_ramdisk(flag, argc, argv))
return 1;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
2013-07-09 19:34 [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Tom Rini
2013-07-09 19:34 ` [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself Tom Rini
@ 2013-07-10 4:59 ` Stephen Warren
2013-07-10 9:53 ` Simon Glass
2013-07-10 13:19 ` Tom Rini
2 siblings, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2013-07-10 4:59 UTC (permalink / raw)
To: u-boot
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
2013-07-10 4:59 ` [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Stephen Warren
@ 2013-07-10 9:53 ` Simon Glass
2013-07-10 15:38 ` Stephen Warren
0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2013-07-10 9:53 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
2013-07-09 19:34 [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Tom Rini
2013-07-09 19:34 ` [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself Tom Rini
2013-07-10 4:59 ` [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Stephen Warren
@ 2013-07-10 13:19 ` Tom Rini
2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2013-07-10 13:19 UTC (permalink / raw)
To: u-boot
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.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130710/57347543/attachment.pgp>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
2013-07-10 9:53 ` Simon Glass
@ 2013-07-10 15:38 ` Stephen Warren
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2013-07-10 15:38 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-07-10 15:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09 19:34 [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Tom Rini
2013-07-09 19:34 ` [U-Boot] [PATCH 2/2] cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself Tom Rini
2013-07-10 4:59 ` [U-Boot] [PATCH 1/2] cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc Stephen Warren
2013-07-10 9:53 ` Simon Glass
2013-07-10 15:38 ` Stephen Warren
2013-07-10 13:19 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox