[v3,09/10] vexpress64: juno: add alternate kernel and device tree filenames

Message ID 1443721416-725-10-git-send-email-ryan.harkin@linaro.org
State Superseded
Headers show

Commit Message

Ryan Harkin Oct. 1, 2015, 5:43 p.m.
The default Juno firmware has renamed the kernel and device tree
filenames to norkern and board.dtb.

Rather than change the default configuration to use the new names,
breaking those with the old firmware, attempt to load the existing
filename first.  If that fails, attempt to load the alternate filename.

I've echo'd that we are loading the alternate file to counter the
output from "afs load" when the first load attempt fails.  For example,
I see this output on my Juno board:

    image "Image" not found in flash
    Loading norkern instead of Image
    loaded region 0 from 08500000 to 80000000, 00AB6318 bytes
    image "juno" not found in flash
    Loading board.dtb instead of juno
    loaded region 0 from 0A000000 to 83000000, 00003188 bytes

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
CC: David Feng <fenghua@phytium.com.cn>
CC: Bhupesh Sharma <bhupesh.sharma@freescale.com>
CC: Linus Walleij <linus.walleij@linaro.org>
---
 include/configs/vexpress_aemv8a.h | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Liviu Dudau Oct. 2, 2015, 1:21 p.m. | #1
Hi Ryan,

On Thu, Oct 01, 2015 at 06:43:35PM +0100, Ryan Harkin wrote:
> The default Juno firmware has renamed the kernel and device tree
> filenames to norkern and board.dtb.
> 
> Rather than change the default configuration to use the new names,
> breaking those with the old firmware, attempt to load the existing
> filename first.  If that fails, attempt to load the alternate filename.

How about future proofing this and add a board.scr image in Juno firmware
where a script can be stored (can the image be used by UEFI as well?).

Now that you are adding support for testing if an image is present we can
then source the script at boot.scr. That would allow Juno r1 for example
to have a different boot script than r0 (smc911x ethernet port was designed
as a backup solution until PCIe was functional, so one might not want to
use it for booting).

Thoughts?

Best regards,
Liviu

> 
> I've echo'd that we are loading the alternate file to counter the
> output from "afs load" when the first load attempt fails.  For example,
> I see this output on my Juno board:
> 
>     image "Image" not found in flash
>     Loading norkern instead of Image
>     loaded region 0 from 08500000 to 80000000, 00AB6318 bytes
>     image "juno" not found in flash
>     Loading board.dtb instead of juno
>     loaded region 0 from 0A000000 to 83000000, 00003188 bytes
> 
> Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> CC: David Feng <fenghua@phytium.com.cn>
> CC: Bhupesh Sharma <bhupesh.sharma@freescale.com>
> CC: Linus Walleij <linus.walleij@linaro.org>
> ---
>  include/configs/vexpress_aemv8a.h | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
> index c62c3ac..192568a 100644
> --- a/include/configs/vexpress_aemv8a.h
> +++ b/include/configs/vexpress_aemv8a.h
> @@ -185,11 +185,13 @@
>   * be copied into DRAM
>   */
>  #define CONFIG_EXTRA_ENV_SETTINGS	\
> -				"kernel_name=Image\0"	\
> +				"kernel_name=norkern\0"	\
> +				"kernel_alt_name=Image\0"	\
>  				"kernel_addr=0x80000000\0" \
>  				"initrd_name=ramdisk.img\0"	\
>  				"initrd_addr=0x84000000\0"	\
> -				"fdt_name=juno\0" \
> +				"fdt_name=board.dtb\0" \
> +				"fdt_alt_name=juno\0" \
>  				"fdt_addr=0x83000000\0" \
>  				"fdt_high=0xffffffffffffffff\0" \
>  				"initrd_high=0xffffffffffffffff\0" \
> @@ -205,7 +207,17 @@
>  
>  /* Copy the kernel and FDT to DRAM memory and boot */
>  #define CONFIG_BOOTCOMMAND	"afs load ${kernel_name} ${kernel_addr} ; " \
> +				"if test $? -eq 1; then "\
> +				"  echo Loading ${kernel_alt_name} instead of "\
> +				"${kernel_name}; "\
> +				"  afs load ${kernel_alt_name} ${kernel_addr};"\
> +				"fi ; "\
>  				"afs load  ${fdt_name} ${fdt_addr} ; " \
> +				"if test $? -eq 1; then "\
> +				"  echo Loading ${fdt_alt_name} instead of "\
> +				"${fdt_name}; "\
> +				"  afs load ${fdt_alt_name} ${fdt_addr}; "\
> +				"fi ; "\
>  				"fdt addr ${fdt_addr}; fdt resize; " \
>  				"if afs load  ${initrd_name} ${initrd_addr} ; "\
>  				"then "\
> -- 
> 2.1.0
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Ryan Harkin Oct. 2, 2015, 2:12 p.m. | #2
Hi Liviu,

On 2 October 2015 at 14:21, Liviu Dudau <liviu@dudau.co.uk> wrote:

> Hi Ryan,
>
> On Thu, Oct 01, 2015 at 06:43:35PM +0100, Ryan Harkin wrote:
> > The default Juno firmware has renamed the kernel and device tree
> > filenames to norkern and board.dtb.
> >
> > Rather than change the default configuration to use the new names,
> > breaking those with the old firmware, attempt to load the existing
> > filename first.  If that fails, attempt to load the alternate filename.
>
> How about future proofing this and add a board.scr image in Juno firmware
> where a script can be stored (can the image be used by UEFI as well?).
>
> Now that you are adding support for testing if an image is present we can
> then source the script at boot.scr. That would allow Juno r1 for example
> to have a different boot script than r0 (smc911x ethernet port was designed
> as a backup solution until PCIe was functional, so one might not want to
> use it for booting).
>
> Thoughts?
>

Sounds like a good idea.  I'll have a play with it here and see what I can
come up with.


>
> Best regards,
> Liviu
>
> >
> > I've echo'd that we are loading the alternate file to counter the
> > output from "afs load" when the first load attempt fails.  For example,
> > I see this output on my Juno board:
> >
> >     image "Image" not found in flash
> >     Loading norkern instead of Image
> >     loaded region 0 from 08500000 to 80000000, 00AB6318 bytes
> >     image "juno" not found in flash
> >     Loading board.dtb instead of juno
> >     loaded region 0 from 0A000000 to 83000000, 00003188 bytes
> >
> > Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> > CC: David Feng <fenghua@phytium.com.cn>
> > CC: Bhupesh Sharma <bhupesh.sharma@freescale.com>
> > CC: Linus Walleij <linus.walleij@linaro.org>
> > ---
> >  include/configs/vexpress_aemv8a.h | 16 ++++++++++++++--
> >  1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/configs/vexpress_aemv8a.h
> b/include/configs/vexpress_aemv8a.h
> > index c62c3ac..192568a 100644
> > --- a/include/configs/vexpress_aemv8a.h
> > +++ b/include/configs/vexpress_aemv8a.h
> > @@ -185,11 +185,13 @@
> >   * be copied into DRAM
> >   */
> >  #define CONFIG_EXTRA_ENV_SETTINGS    \
> > -                             "kernel_name=Image\0"   \
> > +                             "kernel_name=norkern\0" \
> > +                             "kernel_alt_name=Image\0"       \
> >                               "kernel_addr=0x80000000\0" \
> >                               "initrd_name=ramdisk.img\0"     \
> >                               "initrd_addr=0x84000000\0"      \
> > -                             "fdt_name=juno\0" \
> > +                             "fdt_name=board.dtb\0" \
> > +                             "fdt_alt_name=juno\0" \
> >                               "fdt_addr=0x83000000\0" \
> >                               "fdt_high=0xffffffffffffffff\0" \
> >                               "initrd_high=0xffffffffffffffff\0" \
> > @@ -205,7 +207,17 @@
> >
> >  /* Copy the kernel and FDT to DRAM memory and boot */
> >  #define CONFIG_BOOTCOMMAND   "afs load ${kernel_name} ${kernel_addr} ;
> " \
> > +                             "if test $? -eq 1; then "\
> > +                             "  echo Loading ${kernel_alt_name} instead
> of "\
> > +                             "${kernel_name}; "\
> > +                             "  afs load ${kernel_alt_name}
> ${kernel_addr};"\
> > +                             "fi ; "\
> >                               "afs load  ${fdt_name} ${fdt_addr} ; " \
> > +                             "if test $? -eq 1; then "\
> > +                             "  echo Loading ${fdt_alt_name} instead of
> "\
> > +                             "${fdt_name}; "\
> > +                             "  afs load ${fdt_alt_name} ${fdt_addr}; "\
> > +                             "fi ; "\
> >                               "fdt addr ${fdt_addr}; fdt resize; " \
> >                               "if afs load  ${initrd_name}
> ${initrd_addr} ; "\
> >                               "then "\
> > --
> > 2.1.0
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
>
> --
> -------------------
>    .oooO
>    (   )
>     \ (  Oooo.
>      \_) (   )
>           ) /
>          (_/
>
>  One small step
>    for me ...
>

Patch

diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
index c62c3ac..192568a 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -185,11 +185,13 @@ 
  * be copied into DRAM
  */
 #define CONFIG_EXTRA_ENV_SETTINGS	\
-				"kernel_name=Image\0"	\
+				"kernel_name=norkern\0"	\
+				"kernel_alt_name=Image\0"	\
 				"kernel_addr=0x80000000\0" \
 				"initrd_name=ramdisk.img\0"	\
 				"initrd_addr=0x84000000\0"	\
-				"fdt_name=juno\0" \
+				"fdt_name=board.dtb\0" \
+				"fdt_alt_name=juno\0" \
 				"fdt_addr=0x83000000\0" \
 				"fdt_high=0xffffffffffffffff\0" \
 				"initrd_high=0xffffffffffffffff\0" \
@@ -205,7 +207,17 @@ 
 
 /* Copy the kernel and FDT to DRAM memory and boot */
 #define CONFIG_BOOTCOMMAND	"afs load ${kernel_name} ${kernel_addr} ; " \
+				"if test $? -eq 1; then "\
+				"  echo Loading ${kernel_alt_name} instead of "\
+				"${kernel_name}; "\
+				"  afs load ${kernel_alt_name} ${kernel_addr};"\
+				"fi ; "\
 				"afs load  ${fdt_name} ${fdt_addr} ; " \
+				"if test $? -eq 1; then "\
+				"  echo Loading ${fdt_alt_name} instead of "\
+				"${fdt_name}; "\
+				"  afs load ${fdt_alt_name} ${fdt_addr}; "\
+				"fi ; "\
 				"fdt addr ${fdt_addr}; fdt resize; " \
 				"if afs load  ${initrd_name} ${initrd_addr} ; "\
 				"then "\