Patchwork [U-Boot,3/3] bootm: Add the missing PREP stage to bootz

login
register
mail settings
Submitter robertcnelson@gmail.com
Date July 3, 2013, 2:57 p.m.
Message ID <CAOCHtYjzRRirJ+FF5SYB_s_48_avyYxSJb=D3A94nm7eeLqxqg@mail.gmail.com>
Download mbox | patch
Permalink /patch/256673/
State Not Applicable
Delegated to: Tom Rini
Headers show

Comments

robertcnelson@gmail.com - July 3, 2013, 2:57 p.m.
On Wed, Jul 3, 2013 at 9:46 AM, Robert Nelson <robertcnelson@gmail.com> wrote:
> On Wed, Jul 3, 2013 at 9:12 AM, Simon Glass <sjg@chromium.org> wrote:
>> In the recent bootm refactor, the PREP stage was missing in the bootz
>> command. This causes unpredictable behaviour on platforms which need
>> this stage to operate correctly (e.g. ARM).
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>  common/cmd_bootm.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
>> index 401055d..26ed7d8 100644
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>> @@ -1794,7 +1794,8 @@ int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>         bootm_disable_interrupts();
>>
>>         ret = do_bootm_states(cmdtp, flag, argc, argv,
>> -                             BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO,
>> +                             BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
>> +                             BOOTM_STATE_OS_GO,
>>                               &images, 1);
>>
>>         return ret;
>> --
>> 1.8.3
>
>
> Still no dice.. v2013.07-rc2 + these 3 + Tom's "cmd_bootm.c: Correct
> check/return for unsupported sub-command"
>
> Tested with the Panda/Wand..
>
> Panda: bootz test:
> load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage
> run mmcargs
> bootz ${loadaddr}
>
>
> Panda: bootm test: (this still works fine..)
> load mmc ${mmcdev}:${mmcpart} ${loadaddr} uImage
> run mmcargs
> bootm ${loadaddr}
>
> U-Boot SPL 2013.07-rc2-00004-gb3e6fff-dirty (Jul 03 2013 - 09:33:36)
> OMAP4430 ES2.1
> OMAP SD/MMC: 0
> reading u-boot.img
> reading u-boot.img
>
>
> U-Boot 2013.07-rc2-00004-gb3e6fff-dirty (Jul 03 2013 - 09:33:36)
>
> CPU  : OMAP4430 ES2.1
> Board: OMAP4 Panda
> I2C:   ready
> DRAM:  1 GiB
> MMC:   OMAP SD/MMC: 0
> Using default environment
>
> In:    serial
> Out:   serial
> Err:   serial
> Net:   No ethernet found.
> Hit any key to stop autoboot:  0
> Panda # load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage
> reading zImage
> 3413152 bytes read in 160 ms (20.3 MiB/s)
> Panda # run mmcargs
> Panda # bootz ${loadaddr}
> prefetch abort
> pc : [<10da7a5c>]          lr : [<bff813f1>]
> sp : bfefdba0  ip : 7fe00fa8     fp : 00000000
> r10: bfefe6a0  r9 : 00000002     r8 : bfefdf38
> r7 : 80000000  r6 : 00000700     r5 : 10da7a5a  r4 : bfefdc18
> r3 : bfefdc18  r2 : bfefe6a0     r1 : 00000002  r0 : 00000100
> Flags: NzCv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
>
> resetting ...

Okay, so my quick hack from yesterday now works on top of these 3
patches for the Panda case:

U-Boot SPL 2013.07-rc2-00005-g8d900ea-dirty (Jul 03 2013 - 09:52:08)
OMAP4430 ES2.1
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img


U-Boot 2013.07-rc2-00005-g8d900ea-dirty (Jul 03 2013 - 09:52:08)

CPU  : OMAP4430 ES2.1
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Panda # load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage
reading zImage
3413152 bytes read in 159 ms (20.5 MiB/s)
Panda # run mmcargs
Panda # bootz ${loadaddr}

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.7.10-x12 (root@imx6q-sabrelite-1gb-0)
(gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Sun Jun 9 03:19:23 UTC
2013





So I'm going to quickly re-test the wand, which is a device tree:
'bootz zImage - ftd" boot...

Regards,
robertcnelson@gmail.com - July 3, 2013, 3:06 p.m.
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index 7b3e459..5749057 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -1758,6 +1758,10 @@ static int bootz_start(cmd_tbl_t *cmdtp, int
> flag, int argc,
>         int ret;
>         void *zi_start, *zi_end;
>
> +       memset(images, 0, sizeof(bootm_headers_t));
> +       boot_start_lmb(images);
> +       images->os.os = IH_OS_LINUX;
> +
>         ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
>                               images, 1);
>
>
>
> So I'm going to quickly re-test the wand, which is a device tree:
> 'bootz zImage - ftd" boot...

Nope close half way there.. Still broken on Wand (device tree)

Board file boot fine..

bootz zImage
bootz zImage initrd.img


The device tree cases, lock up..
bootz zImage - device.dtb
bootz zImage initrd.img device.dtb

Environment size: 2316/8188 bytes
=> load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage
4109672 bytes read in 310 ms (12.6 MiB/s)
=> load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /dtbs/${fdt_file}
22150 bytes read in 259 ms (83 KiB/s)
=> run mmcargs
=> bootz ${loadaddr} - ${fdt_addr}

Starting kernel ...

Regards,
Simon Glass - July 4, 2013, 8:14 p.m.
Hi Robert,

On Thu, Jul 4, 2013 at 12:06 AM, Robert Nelson <robertcnelson@gmail.com>wrote:

> > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> > index 7b3e459..5749057 100644
> > --- a/common/cmd_bootm.c
> > +++ b/common/cmd_bootm.c
> > @@ -1758,6 +1758,10 @@ static int bootz_start(cmd_tbl_t *cmdtp, int
> > flag, int argc,
> >         int ret;
> >         void *zi_start, *zi_end;
> >
> > +       memset(images, 0, sizeof(bootm_headers_t));
> > +       boot_start_lmb(images);
> > +       images->os.os = IH_OS_LINUX;
> > +
> >         ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
> >                               images, 1);
> >
> >
> >
> > So I'm going to quickly re-test the wand, which is a device tree:
> > 'bootz zImage - ftd" boot...
>
> Nope close half way there.. Still broken on Wand (device tree)
>
> Board file boot fine..
>
> bootz zImage
> bootz zImage initrd.img
>
>
> The device tree cases, lock up..
> bootz zImage - device.dtb
> bootz zImage initrd.img device.dtb
>
> Environment size: 2316/8188 bytes
> => load mmc ${mmcdev}:${mmcpart} ${loadaddr} zImage
> 4109672 bytes read in 310 ms (12.6 MiB/s)
> => load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /dtbs/${fdt_file}
> 22150 bytes read in 259 ms (83 KiB/s)
> => run mmcargs
> => bootz ${loadaddr} - ${fdt_addr}
>
> Starting kernel ...
>

I hope to be able to test this on an ARM platform tomorrow (unfortunately I
am travelling and don't have the right setup).

In the meantime I have done some testing with sandbox and will send out
some v2 patches which correct two more errors. I finally realised that when
I tested this I was probably using zboot instead of bootz. Despite the
obvious difference it somehow escaped me.

Regards,
Simon

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 7b3e459..5749057 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1758,6 +1758,10 @@  static int bootz_start(cmd_tbl_t *cmdtp, int
flag, int argc,
        int ret;
        void *zi_start, *zi_end;

+       memset(images, 0, sizeof(bootm_headers_t));
+       boot_start_lmb(images);
+       images->os.os = IH_OS_LINUX;
+
        ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
                              images, 1);