[U-Boot,2/3] pico-imx7d: Support distro boot for FIT image case
diff mbox series

Message ID 1563262978-6855-3-git-send-email-jun.nie@linaro.org
State New
Delegated to: Stefano Babic
Headers show
Series
  • Support distro boot in pico-imx7d BL33 case
Related show

Commit Message

Jun Nie July 16, 2019, 7:42 a.m. UTC
Support distro boot for pico imx7d in FIT image case.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
 include/configs/pico-imx7d.h | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)

Comments

Joris Offouga July 17, 2019, 5:42 a.m. UTC | #1
Hi Jun,

Le mar. 16 juil. 2019 à 09:48, Jun Nie <jun.nie@linaro.org> a écrit :

> Support distro boot for pico imx7d in FIT image case.
>
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  include/configs/pico-imx7d.h | 37 +++++++++++--------------------------
>  1 file changed, 11 insertions(+), 26 deletions(-)
>
> diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
> index 9101540..7b2bd00 100644
> --- a/include/configs/pico-imx7d.h
> +++ b/include/configs/pico-imx7d.h
> @@ -55,17 +55,17 @@
>  /* When booting with FIT specify the node entry containing boot.scr */
>  #if defined(CONFIG_FIT)
>  #define PICO_BOOT_ENV \
> -       "bootscr_fitimage_name=bootscr\0" \
> -       "bootscriptaddr=0x83200000\0" \
> -       "fdtovaddr=0x83100000\0" \
> -       "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
> -       "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
> -       "mmcargs=setenv bootargs console=${console},${baudrate} " \
> -               "rootwait rw;\0" \
> -       "loadbootscript=" \
> -               "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr}
> ${script};\0" \
> -       "bootscript=echo Running bootscript from mmc ...; " \
> -       "source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
> +       BOOTENV                                                         \
> +       "fdtovaddr=0x83100000\0"                                        \
> +       "scriptaddr=0x83200000\0"                                       \
> +       "mmcargs=setenv bootargs console=${console},${baudrate} "       \
> +               "rootwait rw\0"                                         \
> +       "boot_a_script="                                                \
> +               "load ${devtype} ${devnum}:${distro_bootpart} "         \
> +                       "${scriptaddr} ${prefix}${script}; "            \
> +               "iminfo ${scriptaddr};"                                 \
> +               "if test $? -eq 1; then hab_failsafe; fi;"              \
> +               "source ${scriptaddr}:bootscr\0"
>  #else
>  #define PICO_BOOT_ENV \
>         "bootmenu_0=Boot using PICO-Hobbit baseboard=" \
> @@ -107,21 +107,6 @@
>         "setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \
>         PICO_BOOT_ENV
>
> -#if defined(CONFIG_FIT)
> -#define CONFIG_BOOTCOMMAND \
> -       "mmc dev ${mmcdev};" \
> -       "mmc dev ${mmcdev}; if mmc rescan; then " \
> -               "if run loadbootscript; then " \
> -                       "iminfo ${bootscriptaddr};" \
> -                       "if test $? -eq 1; then hab_failsafe; fi;" \
> -                       "run bootscript; " \
> -               "else " \
> -                       "echo Fail to load fitImage with boot script;" \
> -                       "hab_failsafe;" \
> -               "fi; " \
> -       "fi"
> -#endif
> -
>  #define BOOT_TARGET_DEVICES(func) \
>         func(MMC, mmc, 0) \
>         func(USB, usb, 0) \
> --
> 2.7.4
>
> It's work from my side
for my setup i disable iminfo and hab_failsafe

See log:

run bootcmd
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
245 bytes read in 8 ms (29.3 KiB/s)
Unknown command 'iminfo' - try 'help'
Unknown command 'hab_failsafe' - try 'help'
## Executing script at 83200000
8961308 bytes read in 217 ms (39.4 MiB/s)
## Loading kernel from FIT Image at 86000000 ...
   Using 'conf@imx7d-pico-pi.dtb' configuration
   Trying 'kernel@1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x86000114
     Data Size:    8925040 Bytes = 8.5 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80008000
     Entry Point:  0x80008000
     Hash algo:    sha1
     Hash value:   7d8af1016b4cf8ea90fa1a767bfbeda052043f6c
   Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 86000000 ...
   Using 'conf@imx7d-pico-pi.dtb' configuration
   Trying 'fdt@imx7d-pico-pi.dtb' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x86883188
     Data Size:    34325 Bytes = 33.5 KiB
     Architecture: ARM
     Hash algo:    sha1
     Hash value:   75c81556e9bb9681cd14c96c4627da04205b2583
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x86883188
   Loading Kernel Image ... OK
   Using Device Tree in place at 86883188, end 8688e79c

Starting kernel ...

Tested-by: Joris Offouga <offougajoris@gmail.com>

Best Regards,
Joris Offouga

> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>

Patch
diff mbox series

diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 9101540..7b2bd00 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -55,17 +55,17 @@ 
 /* When booting with FIT specify the node entry containing boot.scr */
 #if defined(CONFIG_FIT)
 #define PICO_BOOT_ENV \
-	"bootscr_fitimage_name=bootscr\0" \
-	"bootscriptaddr=0x83200000\0" \
-	"fdtovaddr=0x83100000\0" \
-	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
-	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
-	"mmcargs=setenv bootargs console=${console},${baudrate} " \
-		"rootwait rw;\0" \
-	"loadbootscript=" \
-		"load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
-	"bootscript=echo Running bootscript from mmc ...; " \
-	"source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
+	BOOTENV								\
+	"fdtovaddr=0x83100000\0"					\
+	"scriptaddr=0x83200000\0"					\
+	"mmcargs=setenv bootargs console=${console},${baudrate} "	\
+		"rootwait rw\0"						\
+	"boot_a_script="						\
+		"load ${devtype} ${devnum}:${distro_bootpart} "		\
+			"${scriptaddr} ${prefix}${script}; "		\
+		"iminfo ${scriptaddr};"					\
+		"if test $? -eq 1; then hab_failsafe; fi;"		\
+		"source ${scriptaddr}:bootscr\0"
 #else
 #define PICO_BOOT_ENV \
 	"bootmenu_0=Boot using PICO-Hobbit baseboard=" \
@@ -107,21 +107,6 @@ 
 	"setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \
 	PICO_BOOT_ENV
 
-#if defined(CONFIG_FIT)
-#define CONFIG_BOOTCOMMAND \
-	"mmc dev ${mmcdev};" \
-	"mmc dev ${mmcdev}; if mmc rescan; then " \
-		"if run loadbootscript; then " \
-			"iminfo ${bootscriptaddr};" \
-			"if test $? -eq 1; then hab_failsafe; fi;" \
-			"run bootscript; " \
-		"else " \
-			"echo Fail to load fitImage with boot script;" \
-			"hab_failsafe;" \
-		"fi; " \
-	"fi"
-#endif
-
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 0) \
 	func(USB, usb, 0) \