[U-Boot] [PATCH v2 4/5] ARM: imx: Convert mccmon6 to use fitImage instead of uImage+DTB

Lukasz Majewski lukma at denx.de
Tue Oct 15 08:28:46 UTC 2019


This commit enabled support for fitImage on mccmon6 when we
switch to DT/DTS (including falcon mode).

Signed-off-by: Lukasz Majewski <lukma at denx.de>
---

 board/liebherr/mccmon6/spl.c  |  7 +++++
 configs/mccmon6_nor_defconfig |  8 ++++-
 configs/mccmon6_sd_defconfig  |  6 +++-
 include/configs/mccmon6.h     | 57 ++++++++++++++---------------------
 4 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/board/liebherr/mccmon6/spl.c b/board/liebherr/mccmon6/spl.c
index 4f1e24033d75..fc5f5e948c6f 100644
--- a/board/liebherr/mccmon6/spl.c
+++ b/board/liebherr/mccmon6/spl.c
@@ -332,6 +332,13 @@ void board_boot_order(u32 *spl_boot_list)
 	}
 }
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
diff --git a/configs/mccmon6_nor_defconfig b/configs/mccmon6_nor_defconfig
index 8a6cfc9fbe0a..0752ec949de6 100644
--- a/configs/mccmon6_nor_defconfig
+++ b/configs/mccmon6_nor_defconfig
@@ -11,12 +11,18 @@ CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_nor.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_SYS_OS_BASE=0x8180000
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x09600000
+CONFIG_CMD_SPL_WRITE_SIZE=0x20000
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -29,7 +35,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
diff --git a/configs/mccmon6_sd_defconfig b/configs/mccmon6_sd_defconfig
index 031a41372bc9..45aba4bb06eb 100644
--- a/configs/mccmon6_sd_defconfig
+++ b/configs/mccmon6_sd_defconfig
@@ -12,12 +12,16 @@ CONFIG_SPL=y
 CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_sd.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x09600000
+CONFIG_CMD_SPL_WRITE_SIZE=0x20000
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -30,7 +34,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
diff --git a/include/configs/mccmon6.h b/include/configs/mccmon6.h
index b25aacbf4104..c685de65516e 100644
--- a/include/configs/mccmon6.h
+++ b/include/configs/mccmon6.h
@@ -14,10 +14,6 @@
 
 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
-#define CONFIG_SPL_OS_BOOT
-#define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x180000)
-#define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x1980000)
-#define CONFIG_SYS_FDT_SIZE (48 * SZ_1K)
 #define CONFIG_SYS_SPL_ARGS_ADDR	0x18000000
 
 /*
@@ -28,8 +24,7 @@
 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
-#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
-#define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6q-mccmon.dtb"
+#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
@@ -61,14 +56,13 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"console=ttymxc0,115200 quiet\0" \
-	"fdtfile=imx6q-mccmon6.dtb\0" \
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"boot_os=yes\0" \
+	"kernelsize=0x300000\0" \
 	"disable_giga=yes\0" \
 	"download_kernel=" \
-		"tftpboot ${kernel_addr} ${kernel_file};" \
-		"tftpboot ${fdt_addr} ${fdtfile};\0" \
+		"tftpboot ${loadaddr} ${kernel_file};\0" \
 	"get_boot_medium=" \
 		"setenv boot_medium nor;" \
 		"setexpr.l _src_sbmr1 *0x020d8004;" \
@@ -76,10 +70,7 @@
 		"if test ${_b_medium} = 40; then " \
 			"setenv boot_medium sdcard;" \
 		"fi\0" \
-	"kernel_file=uImage\0" \
-	"load_kernel=" \
-		"load mmc ${bootdev}:${bootpart} ${kernel_addr} uImage;" \
-		"load mmc ${bootdev}:${bootpart} ${fdt_addr} ${fdtfile};\0" \
+	"kernel_file=fitImage\0" \
 	"boot_sd=" \
 		"echo '#######################';" \
 		"echo '# Factory SDcard Boot #';" \
@@ -90,12 +81,11 @@
 		"run factory_flash_img;\0" \
 	"boot_nor=" \
 		"setenv kernelnor 0x08180000;" \
-		"setenv dtbnor 0x09980000;" \
 		"setenv bootargs console=${console} " \
 		CONFIG_MTDPARTS_DEFAULT " " \
 		"root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
-		"cp.l ${dtbnor} ${dtbloadaddr} 0x8000;" \
-		"bootm ${kernelnor} - ${dtbloadaddr};\0" \
+		"cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
+		"bootm ${loadaddr};reset;\0" \
 	"boot_recovery=" \
 		"echo '#######################';" \
 		"echo '# RECOVERY SWU Boot   #';" \
@@ -103,14 +93,13 @@
 		"setenv rootfsloadaddr 0x13000000;" \
 		"setenv swukernelnor 0x08980000;" \
 		"setenv swurootfsnor 0x09180000;" \
-		"setenv swudtbnor 0x099A0000;" \
 		"setenv bootargs console=${console} " \
 		CONFIG_MTDPARTS_DEFAULT " " \
 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
 		    ":${hostname}::off root=/dev/ram rw;" \
 		"cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
-		"cp.l ${swudtbnor} ${dtbloadaddr} 0x8000;" \
-		"bootm ${swukernelnor} ${rootfsloadaddr} ${dtbloadaddr};\0" \
+		"cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
+		"bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
 	"boot_tftp=" \
 		"echo '#######################';" \
 		"echo '# TFTP Boot           #';" \
@@ -118,7 +107,7 @@
 		"if run download_kernel; then " \
 		     "setenv bootargs console=${console} " \
 		     "root=/dev/mmcblk0p2 rootwait;" \
-		     "bootm ${kernel_addr} - ${fdt_addr};" \
+		     "bootm $loadaddr};reset;" \
 		"fi\0" \
 	"bootcmd=" \
 		"if test -n ${recovery_status}; then " \
@@ -138,13 +127,10 @@
 		     "fi;" \
 		"fi\0" \
 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
-	"fdt_addr=0x18000000\0" \
 	"bootdev=1\0" \
 	"bootpart=1\0" \
-	"kernel_addr=" __stringify(CONFIG_LOADADDR) "\0" \
 	"netdev=eth0\0" \
 	"load_addr=0x11000000\0" \
-	"dtbloadaddr=0x12000000\0" \
 	"uboot_file=u-boot.img\0" \
 	"SPL_file=SPL\0" \
 	"load_uboot=tftp ${load_addr} ${uboot_file}\0" \
@@ -171,6 +157,7 @@
 		    "device ${mmcdev};" \
 		    "run factory_nor_img;" \
 		    "run factory_eMMC_img;" \
+		    "run factory_SPL_falcon_setup;" \
 		"fi\0" \
 	"factory_eMMC_img="\
 		"echo 'Update mccmon6 eMMC image'; " \
@@ -192,6 +179,16 @@
 		    "erase ${nor_bank_start} +${nor_img_size};" \
 		    "setexpr nor_img_size ${nor_img_size} / 4; " \
 		    "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
+	"factory_SPL_falcon_setup="\
+		"echo 'Write Falcon boot data'; " \
+		"setenv kernelnor 0x08180000;" \
+		"cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
+		"spl export fdt ${loadaddr};" \
+		"setenv nor_img_addr ${fdtargsaddr};" \
+		"setenv nor_img_size 0x20000;" \
+		"setenv nor_bank_start " \
+				__stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
+		"run nor_update\0" \
 	"tftp_nor_uboot="\
 		"echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
 		"setenv nor_img_file u-boot.img; " \
@@ -200,22 +197,14 @@
 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
 		    "run nor_update;" \
 		"fi\0" \
-	"tftp_nor_uImg="\
-		"echo 'Update mccmon6 NOR uImage via TFTP'; " \
-		"setenv nor_img_file uImage; " \
+	"tftp_nor_fitImg="\
+		"echo 'Update mccmon6 NOR fitImage via TFTP'; " \
+		"setenv nor_img_file fitImage; " \
 		"setenv nor_img_size 0x500000; " \
 		"setenv nor_bank_start 0x08180000; " \
 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
 		    "run nor_update;" \
 		"fi\0" \
-	"tftp_nor_dtb="\
-		"echo 'Update mccmon6 NOR DTB via TFTP'; " \
-		"setenv nor_img_file imx6q-mccmon6.dtb; " \
-		"setenv nor_img_size 0x20000; " \
-		"setenv nor_bank_start 0x09980000; " \
-		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
-		    "run nor_update;" \
-		"fi\0" \
 	"tftp_nor_img="\
 		"echo 'Update mccmon6 NOR image via TFTP'; " \
 		"if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
-- 
2.20.1



More information about the U-Boot mailing list