imx8mm: configs: add support for distro boot commands
PATCH 1/2 imx8mm: configs: add support for distro boot commands
From: Alice Guo <[email protected]>
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.
--- configs/imx8mm_evk_defconfig | 4 ++- include/configs/imx8mm_evk.h | 47 +++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 13 deletions(-)
configs/imx8mm_evk_defconfig +3 -1
@@ -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
include/configs/imx8mm_evk.h +35 -12
61 lines not on this page · raw message
--
2.17.1
PATCH 2/2 board: imx8mm: add boot.cmd for distro boot on iMX8MM
From: Alice Guo <[email protected]>
Distro Boot requires a U-Boot-specific script named boot.scr or
boot.scr.uimg which contains boot commands to boot the system. The
boot.cmd is such a file. Use mkimage to generate boot.scr or
boot.scr.uimg from boot.cmd, and the command is:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr.uimg
QSPI in iMX8MM platform is only used to store bootloader and script so that we do not load image or .dtb file from QSPI as is shown in boot.cmd file.
The boot.cmd file is an example script and can be modified based on needs.
--- board/freescale/imx8mm_evk/boot.cmd | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 board/freescale/imx8mm_evk/boot.cmd
board/freescale/imx8mm_evk/boot.cmd new file +35 -0
@@ -0,0 +1,35 @@ +setenv bootargs console=${console} root=${mmcroot}; + +for boot_target in ${boot_targets}; +do + if test "${boot_target}" = "mmc1" ; then + if fatload mmc 1:${mmcpart} ${kernel_addr_r} ${image}; then + if fatload mmc 1:${mmcpart} ${fdt_addr} ${fdt_file}; then + echo Load image and .dtb from SD card(mmc1); + booti ${kernel_addr_r} - ${fdt_addr}; + exit; + fi + fi + fi + + if test "${boot_target}" = "mmc2" ; then + if fatload mmc 2:${mmcpart} ${kernel_addr_r} ${image}; then + if fatload mmc 2:${mmcpart} ${fdt_addr} ${fdt_file}; then + echo Load image and .dtb from eMMC(mmc2); + booti ${kernel_addr_r} - ${fdt_addr}; + exit; + fi + fi + fi + + if test "${boot_target}" = "dhcp" ; then + if dhcp ${kernel_addr_r} ${serverip}:${image}; then + if dhcp ${fdt_addr} ${serverip}:${fdt_file}; then + echo Load image and .dtb from net(dhcp); + booti ${kernel_addr_r} - ${fdt_addr}; + exit; + fi + fi + fi + +done
--
2.17.1