[PATCH v1 1/2] imx8mm: configs: add support for distro boot commands

Alice Guo (OSS) alice.guo at oss.nxp.com
Sat Dec 12 09:50:52 CET 2020


From: Alice Guo <alice.guo at nxp.com>

Supported boot device types in iMX8MM: MMC, QSPI, DHCP.

BOOTENV introduces other environment variables, so the size of ENV
should be increased. CONFIG_CMD_PART is added for command part and
CONFIG_CMD_FS_GENERIC is for command fstype.

CONFIG_BOOTCOMMAND which is defined in include/configs/imx8mm_evk.h is
moved to the place before BOOTENV because "run distro_bootcmd" is not
required to be the default boot mode. scriptaddr is the location in RAM
where boot.scr.uimg/boot.scr will be loaded to prior to execution.
script_offset_f is the location of boot.scr.uimg/boot.scr in QSPI and
script_size_f is the size of boot.scr.uimg/boot.scr. kernel_addr_r is
the location in RAM where the kernel will be loaded to.

Signed-off-by: Alice Guo <alice.guo at nxp.com>
---
 configs/imx8mm_evk_defconfig |  4 ++-
 include/configs/imx8mm_evk.h | 47 +++++++++++++++++++++++++++---------
 2 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/configs/imx8mm_evk_defconfig b/configs/imx8mm_evk_defconfig
index 91d3bc3ac9..993b7b8835 100644
--- a/configs/imx8mm_evk_defconfig
+++ b/configs/imx8mm_evk_defconfig
@@ -5,7 +5,7 @@ CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x10000
-CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x400000
 CONFIG_SYS_I2C_MXC_I2C1=y
 CONFIG_SYS_I2C_MXC_I2C2=y
@@ -49,6 +49,8 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index 83521ad401..e6a1a0557a 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -32,8 +32,43 @@

 #endif

+#define CONFIG_BOOTCOMMAND \
+	   "mmc dev ${mmcdev}; if mmc rescan; then " \
+		   "if run loadbootscript; then " \
+			   "run bootscript; " \
+		   "else " \
+			   "if run loadimage; then " \
+				   "run mmcboot; " \
+			   "else run netboot; " \
+			   "fi; " \
+		   "fi; " \
+	   "fi;"
+
+#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
+	"bootcmd_" #devtypel #instance "=sf probe " #instance " 0 0 && " \
+		       "sf read $scriptaddr $script_offset_f $script_size_f && " \
+		       "source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
+	#devtypel #instance " "
+
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 2) \
+	func(QSPI, qspi, 0) \
+	func(DHCP, dhcp, na)
+
+#include <config_distro_bootcmd.h>
+#endif
+
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS		\
+	BOOTENV \
+	"scriptaddr=0x43500000\0" \
+	"script_offset_f=0x500000\0" \
+	"script_size_f=0x100000\0" \
+	"kernel_addr_r=0x40880000\0" \
 	"script=boot.scr\0" \
 	"image=Image\0" \
 	"console=ttymxc1,115200\0" \
@@ -84,18 +119,6 @@
 			"fi; " \
 		"fi;\0"

-#define CONFIG_BOOTCOMMAND \
-	   "mmc dev ${mmcdev}; if mmc rescan; then " \
-		   "if run loadbootscript; then " \
-			   "run bootscript; " \
-		   "else " \
-			   "if run loadimage; then " \
-				   "run mmcboot; " \
-			   "else run netboot; " \
-			   "fi; " \
-		   "fi; " \
-	   "fi;"
-
 /* Link Definitions */
 #define CONFIG_LOADADDR			0x40480000

--
2.17.1



More information about the U-Boot mailing list