summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Nie <jun.nie@linaro.org>2019-01-27 22:01:45 +0800
committerJun Nie <jun.nie@linaro.org>2019-02-18 17:08:47 +0800
commit80d412780fee6715d0434b3af6812dedcd4f0c5b (patch)
tree01693284a1e86cd44d543a11393608580fd30216
parent8db2fed815c32ed09a5ac76d3e73307c7cbfc36b (diff)
pico: convert uboot to support fit image
Convert uboot to support fit image with changing boot script behavior and enable fit image related commands. Signed-off-by: Jun Nie <jun.nie@linaro.org>
-rw-r--r--configs/pico-pi-imx7d_defconfig2
-rw-r--r--include/configs/pico-imx7d.h30
2 files changed, 30 insertions, 2 deletions
diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig
index 5bd1352532..45422362e7 100644
--- a/configs/pico-pi-imx7d_defconfig
+++ b/configs/pico-pi-imx7d_defconfig
@@ -14,8 +14,6 @@ CONFIG_DEFAULT_FDT_FILE="imx7d-pico-pi.dtb"
CONFIG_HUSH_PARSER=y
# CONFIG_CMD_BOOTD is not set
CONFIG_CMD_BOOTZ=y
-# CONFIG_CMD_IMI is not set
-# CONFIG_CMD_XIMG is not set
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_DFU=y
CONFIG_CMD_GPIO=y
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 0e770bf41f..4d82fb9e2c 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -61,8 +61,17 @@
#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
+/* When booting with FIT specify the node entry containing boot.scr */
+#if defined(CONFIG_FIT)
+#define BOOT_SCR_STRING "source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
+#else
+#define BOOT_SCR_STRING "source ${bootscriptaddr}\0"
+#endif
+
#define CONFIG_EXTRA_ENV_SETTINGS \
"script=boot.scr\0" \
+ "bootscr_fitimage_name=bootscr\0" \
+ "bootscriptaddr=0x83200000\0" \
"image=zImage\0" \
"console=ttymxc4\0" \
"fdt_high=0xffffffff\0" \
@@ -71,11 +80,20 @@
BOOTMENU_ENV \
"fdt_addr=0x83000000\0" \
"fdt_addr_r=0x83000000\0" \
+ "fdtovaddr=0x83100000\0" \
"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"ramdisk_addr_r=0x83000000\0" \
"ramdiskaddr=0x83000000\0" \
+ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+ "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+ "mmcargs=setenv bootargs console=${console},${baudrate} " \
+ "rootwait rw;\0" \
+ "loadbootscript=" \
+ "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
+ "bootscript=echo Running bootscript from mmc ...; " \
+ BOOT_SCR_STRING \
CONFIG_DFU_ENV_SETTINGS \
"findfdt=" \
"if test $fdtfile = ask ; then " \
@@ -90,6 +108,18 @@
"setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \
BOOTENV
+#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;" \
+ "fi; " \
+ "fi"
+
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
func(DHCP, dhcp, na)