diff mbox series

[U-Boot,2/2] sysboot: Call bootm booti bootz then go on label_boot

Message ID 20180102212714.58450-2-manu@freebsd.org
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/2] cmd: go: Make do_go available to outside boot.c | expand

Commit Message

Emmanuel Vadot Jan. 2, 2018, 9:27 p.m. UTC
As do_bootm/do_booti/do_bootz will not return if the boot succeded, always
call them if enable by the config.
Also add a fallback to go if the binary is a raw one.

Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
---
 cmd/pxe.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Simon Glass Jan. 8, 2018, 4:39 a.m. UTC | #1
Hi Emmanuel,

On 2 January 2018 at 14:27, Emmanuel Vadot <manu@freebsd.org> wrote:
> As do_bootm/do_booti/do_bootz will not return if the boot succeded, always
> call them if enable by the config.
> Also add a fallback to go if the binary is a raw one.

Do we not know which type of binary it is? It seems like we should
have some error checking here.

>
> Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
> ---
>  cmd/pxe.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/cmd/pxe.c b/cmd/pxe.c
> index 7043ad11fd..0ca6a964bc 100644
> --- a/cmd/pxe.c
> +++ b/cmd/pxe.c
> @@ -796,12 +796,14 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
>                 do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
>  #ifdef CONFIG_CMD_BOOTI
>         /* Try booting an AArch64 Linux kernel image */
> -       else
> -               do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> -#elif defined(CONFIG_CMD_BOOTZ)
> +       do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> +#endif
> +#if defined(CONFIG_CMD_BOOTZ)
>         /* Try booting a Image */
> -       else
> -               do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> +       do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> +#endif
> +#if defined(CONFIG_CMD_GO)
> +       do_go(cmdtp, 0, bootm_argc, bootm_argv);
>  #endif
>         unmap_sysmem(buf);
>         return 1;
> --
> 2.15.1
>

Regards,
Simon
Emmanuel Vadot Jan. 8, 2018, 10:05 a.m. UTC | #2
On Sun, 7 Jan 2018 21:39:01 -0700
Simon Glass <sjg@chromium.org> wrote:

> Hi Emmanuel,
> 
> On 2 January 2018 at 14:27, Emmanuel Vadot <manu@freebsd.org> wrote:
> > As do_bootm/do_booti/do_bootz will not return if the boot succeded, always
> > call them if enable by the config.
> > Also add a fallback to go if the binary is a raw one.
> 
> Do we not know which type of binary it is? 

 For which case ?

> It seems like we should have some error checking here.

 Each bootX function check the header/magic/etc ...
 What kind of error checking do you want to add ?

> >
> > Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
> > ---
> >  cmd/pxe.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/cmd/pxe.c b/cmd/pxe.c
> > index 7043ad11fd..0ca6a964bc 100644
> > --- a/cmd/pxe.c
> > +++ b/cmd/pxe.c
> > @@ -796,12 +796,14 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
> >                 do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
> >  #ifdef CONFIG_CMD_BOOTI
> >         /* Try booting an AArch64 Linux kernel image */
> > -       else
> > -               do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> > -#elif defined(CONFIG_CMD_BOOTZ)
> > +       do_booti(cmdtp, 0, bootm_argc, bootm_argv);
> > +#endif
> > +#if defined(CONFIG_CMD_BOOTZ)
> >         /* Try booting a Image */
> > -       else
> > -               do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> > +       do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
> > +#endif
> > +#if defined(CONFIG_CMD_GO)
> > +       do_go(cmdtp, 0, bootm_argc, bootm_argv);
> >  #endif
> >         unmap_sysmem(buf);
> >         return 1;
> > --
> > 2.15.1
> >
> 
> Regards,
> Simon
Simon Glass Jan. 8, 2018, 10:11 p.m. UTC | #3
Hi Emmanuel,

On 8 January 2018 at 03:05, Emmanuel Vadot <manu@bidouilliste.com> wrote:
> On Sun, 7 Jan 2018 21:39:01 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
>> Hi Emmanuel,
>>
>> On 2 January 2018 at 14:27, Emmanuel Vadot <manu@freebsd.org> wrote:
>> > As do_bootm/do_booti/do_bootz will not return if the boot succeded, always
>> > call them if enable by the config.
>> > Also add a fallback to go if the binary is a raw one.
>>
>> Do we not know which type of binary it is?
>
>  For which case ?
>
>> It seems like we should have some error checking here.
>
>  Each bootX function check the header/magic/etc ...
>  What kind of error checking do you want to add ?

Well, it looks like you have a fallback so that if the image does not
pass any of the header/magic checks you just jump to it,. Won't that
crash if (e.g.) someone uses a valid image but one for which support
is turned off in the U-Boot build?

I'm not sure of the solution, but perhaps we should have a CONFIG
option to enable this fallback?

>
>> >
>> > Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
>> > ---
>> >  cmd/pxe.c | 12 +++++++-----
>> >  1 file changed, 7 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/cmd/pxe.c b/cmd/pxe.c
>> > index 7043ad11fd..0ca6a964bc 100644
>> > --- a/cmd/pxe.c
>> > +++ b/cmd/pxe.c
>> > @@ -796,12 +796,14 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
>> >                 do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
>> >  #ifdef CONFIG_CMD_BOOTI
>> >         /* Try booting an AArch64 Linux kernel image */
>> > -       else
>> > -               do_booti(cmdtp, 0, bootm_argc, bootm_argv);
>> > -#elif defined(CONFIG_CMD_BOOTZ)
>> > +       do_booti(cmdtp, 0, bootm_argc, bootm_argv);
>> > +#endif
>> > +#if defined(CONFIG_CMD_BOOTZ)
>> >         /* Try booting a Image */
>> > -       else
>> > -               do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
>> > +       do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
>> > +#endif
>> > +#if defined(CONFIG_CMD_GO)
>> > +       do_go(cmdtp, 0, bootm_argc, bootm_argv);
>> >  #endif
>> >         unmap_sysmem(buf);
>> >         return 1;
>> > --
>> > 2.15.1

Regards,
Simon
diff mbox series

Patch

diff --git a/cmd/pxe.c b/cmd/pxe.c
index 7043ad11fd..0ca6a964bc 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -796,12 +796,14 @@  static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
 		do_bootm(cmdtp, 0, bootm_argc, bootm_argv);
 #ifdef CONFIG_CMD_BOOTI
 	/* Try booting an AArch64 Linux kernel image */
-	else
-		do_booti(cmdtp, 0, bootm_argc, bootm_argv);
-#elif defined(CONFIG_CMD_BOOTZ)
+	do_booti(cmdtp, 0, bootm_argc, bootm_argv);
+#endif
+#if defined(CONFIG_CMD_BOOTZ)
 	/* Try booting a Image */
-	else
-		do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+	do_bootz(cmdtp, 0, bootm_argc, bootm_argv);
+#endif
+#if defined(CONFIG_CMD_GO)
+	do_go(cmdtp, 0, bootm_argc, bootm_argv);
 #endif
 	unmap_sysmem(buf);
 	return 1;