Hello @drewmoseley,
I have tried to follow these instructions and hit problems. Are you able to help? Firstly the U-boot patch was rejected. The problem is very similar to https://hub.mender.io/t/is-there-a-support-for-meta-mender-imx-on-zeus/2669/10. I am using meta-imx version 5.4.4.7-2.2.0. I changed the patch to work on the newer version and everything compiled. However, there was an error when trying to create the image filesystem:
ERROR: fsl-image-qt5-1.0-r0 do_image_ext4: Execution of '/home/yocto/nano/var-fsl-yocto/build_xwayland/tmp/work/imx8mn_var_som-poky-linux/fsl-image-qt5/1.0-r0/temp /run.do_image_ext4.23158' failed with exit code 1:
0+0 records in
0+0 records out
0 bytes copied, 0.000132599 s, 0.0 kB/s
mke2fs 1.45.3 (14-Jul-2019)
Discarding device blocks: done
Creating filesystem with 843273 4k blocks and 843648 inodes
Filesystem UUID: 99d16d85-dd5d-46d1-a963-71175a1bed8c
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Copying files into the device: __populate_fs: Could not allocate block in ext2 filesystem while writing file "sysc_setreuid.stp"
mkfs.ext4: Could not allocate block in ext2 filesystem while populating file system
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/yocto/nano/var-fsl-yocto/build_xwayland/tmp/work /imx8mn_var_som-poky-linux/fsl-image-qt5/1.0-r0/temp/log.do_image_ext4.23158
Here is the modified patch:
diff --git a/configs/imx8mn_var_som_defconfig b/configs/imx8mn_var_som_defconfig
index ca354a4ed8..96ae23d6aa 100644
--- a/configs/imx8mn_var_som_defconfig
+++ b/configs/imx8mn_var_som_defconfig
@@ -84,3 +84,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
CONFIG_CI_UDC=y
CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_EFI_LOADER=y
+CONFIG_DISTRO_DEFAULTS=y
diff --git a/include/configs/imx8mn_var_som.h b/include/configs/imx8mn_var_som.h
index c554a9da63..55cc3ad678 100644
--- a/include/configs/imx8mn_var_som.h
+++ b/include/configs/imx8mn_var_som.h
@@ -60,6 +60,7 @@
#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+#define BOOTENV
#endif /* CONFIG_SPL_BUILD */
#define CONFIG_CMD_READ
@@ -109,21 +110,20 @@
/* Initial environment variables */
#define CONFIG_EXTRA_ENV_SETTINGS \
CONFIG_MFG_ENV_SETTINGS \
+ BOOTENV \
"bootdir=/boot\0" \
"script=boot.scr\0" \
"image=Image.gz\0" \
"img_addr=0x42000000\0" \
"console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200\0" \
- "fdt_addr=0x43000000\0" \
+ "fdt_addr_r=0x43000000\0" \
"fdt_high=0xffffffffffffffff\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
- "fdt_file=undefined\0" \
+ "fdtfile=undefined\0" \
"initrd_addr=0x43800000\0" \
"initrd_high=0xffffffffffffffff\0" \
"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
- "mmcblk=1\0" \
- "mmcautodetect=yes\0" \
"mmcpart=1\0" \
"m7_addr=0x7e0000\0" \
"m7_bin=hello_world.bin\0" \
@@ -138,65 +138,14 @@
"dcache flush; " \
"fi; " \
"bootaux ${m7_addr};\0" \
- "optargs=setenv bootargs ${bootargs} ${kernelargs};\0" \
- "mmcargs=setenv bootargs console=${console} " \
- "root=/dev/mmcblk${mmcblk}p${mmcpart} rootwait rw ${cma_size}\0 " \
- "loadbootscript=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootdir}/${script};\0" \
- "bootscript=echo Running bootscript from mmc ...; " \
- "source\0" \
- "loadimage=load mmc ${mmcdev}:${mmcpart} ${img_addr} ${bootdir}/${image};" \
"unzip ${img_addr} ${loadaddr}\0" \
"findfdt=" \
- "if test $fdt_file = undefined; then " \
+ "if test $fdtfile = undefined; then " \
"if test $som_rev = som_rev10; then " \
- "setenv fdt_file imx8mn-var-som-rev10.dtb; " \
+ "setenv fdtfile imx8mn-var-som-rev10.dtb; " \
"else " \
- "setenv fdt_file imx8mn-var-som.dtb; " \
+ "setenv fdtfile imx8mn-var-som.dtb; " \
"fi;" \
- "fi; \0" \
- "loadfdt=run findfdt; " \
- "echo fdt_file=${fdt_file}; " \
- "load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${bootdir}/${fdt_file}\0" \
- "ramsize_check="\
- "if test $sdram_size -le 512; then " \
- "setenv cma_size cma=320M; " \
- "else " \
- "setenv cma_size cma=640M@1376M; " \
- "fi;\0" \
- "mmcboot=echo Booting from mmc ...; " \
- "run mmcargs; " \
- "run optargs; " \
- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "if run loadfdt; then " \
- "booti ${loadaddr} - ${fdt_addr}; " \
- "else " \
- "echo WARN: Cannot load the DT; " \
- "fi; " \
- "else " \
- "echo wait for boot; " \
- "fi;\0" \
- "netargs=setenv bootargs console=${console} " \
- "root=/dev/nfs ${cma_size} " \
- "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
- "netboot=echo Booting from net ...; " \
- "if test ${ip_dyn} = yes; then " \
- "setenv get_cmd dhcp; " \
- "else " \
- "setenv get_cmd tftp; " \
- "fi; " \
- "${get_cmd} ${img_addr} ${image}; unzip ${img_addr} ${loadaddr};" \
- "run netargs; " \
- "run optargs; " \
- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "run findfdt; " \
- "echo fdt_file=${fdt_file}; " \
- "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
- "booti ${loadaddr} - ${fdt_addr}; " \
- "else " \
- "echo WARN: Cannot load the DT; " \
- "fi; " \
- "else " \
- "booti; " \
"fi;\0"
#define CONFIG_BOOTCOMMAND \
@@ -206,18 +155,11 @@
"if test ${use_m7} = yes && run loadm7bin; then " \
"run runm7bin; " \
"fi; " \
- "if run loadbootscript; then " \
- "run bootscript; " \
- "else "\
- "if run loadimage; then " \
- "run mmcboot; " \
- "else " \
- "run netboot; " \
- "fi; " \
- "fi; " \
- "else " \
- "booti ${loadaddr} - ${fdt_addr}; " \
- "fi;"
+ "fi;" \
+ "setenv bootargs console=${console} ${cma_size} ${kernelargs}; " \
+ "run findfdt; " \
+ "setenv kernel_addr_r ${loadaddr}; " \
+ "run distro_bootcmd;"
/* Link Definitions */
#define CONFIG_LOADADDR 0x40480000
@@ -234,6 +176,7 @@
#define CONFIG_ENV_OVERWRITE
/* Default ENV offset is 4MB for SD/EMMC/FSPI, but NAND uses 60MB offset, overridden by env_get_offset */
+#define CONFIG_ENV_SIZE SZ_8K
#define CONFIG_ENV_SECT_SIZE (64 * 1024)
#define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC2 */
@@ -301,6 +244,11 @@
#define CONFIG_USB_GADGET_MASS_STORAGE
#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#define BOOT_TARGET_DEVICES(func) \
+ func(MMC, mmc, 2) \
+ func(MMC, mmc, 1)
+#include <config_distro_bootcmd.h>
+
#endif
#define CONFIG_USB_GADGET_VBUS_DRAW 2