Toradex Apalis IMX8 Yocto with Mender

I am trying to get a Yocto build on the Toradex Apalis IMX8 dev kit working with Mender.

I am using dunfell with:
meta-mender-core = “HEAD:bd87ddf4b97ccca21044645094b407a5d7beeae5”
meta-mender-toradex-nxp = “HEAD:390c061f4d56a6628135c0911d1164ce14327405”

local.conf

Changed 0001-Integration-of-Mender-boot-code-into-toradex-U-Boot.patch to work with current sources:

diff --git a/include/env_default.h b/include/env_default.h
index 56a8bae39a..b6cd139ce8 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -8,6 +8,7 @@
  */
 
 #include <env_callback.h>
+#include <env_mender.h>
 
 #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
 env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
@@ -21,6 +22,7 @@ static char default_environment[] = {
 #else
 const uchar default_environment[] = {
 #endif
+MENDER_ENV_SETTINGS
 #ifndef CONFIG_USE_DEFAULT_ENV_FILE
 #ifdef	CONFIG_ENV_CALLBACK_LIST_DEFAULT
 	ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 00b8fb34aa..d500c48405 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -109,7 +109,8 @@ define filechk_config_h
 	echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>;		\
 	echo \#include \<asm/config.h\>;				\
 	echo \#include \<linux/kconfig.h\>;				\
-	echo \#include \<config_fallbacks.h\>;)
+	echo \#include \<config_fallbacks.h\>;			\
+	echo \#include \<config_mender.h\>;)
 endef
 
 include/config.h: scripts/Makefile.autoconf create_symlink FORCE

Created a new patch for apalis-imx8:

diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index 1cd2994622..f9da99c624 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -3,7 +3,9 @@ CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0xFFFFDE00
+CONFIG_ENV_OFFSET=0x800000
+CONFIG_ENV_OFFSET_REDUND=0x1000000
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_DM_GPIO=y
 CONFIG_BOOTAUX_RESERVED_MEM_BASE=0x88000000
 CONFIG_BOOTAUX_RESERVED_MEM_SIZE=0x08000000
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 41b67d7a53..c27023dea6 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -127,9 +127,8 @@
 #define CONFIG_SYS_MEMTEST_START	0x90000000
 #define CONFIG_SYS_MEMTEST_END		0xc0000000
 
-/* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_SYS_MMC_ENV_DEV		0	/* USDHC1 eMMC */
-#define CONFIG_SYS_MMC_ENV_PART		1
+#define CONFIG_BOOTCOUNT_ENV
+#define CONFIG_BOOTCOUNT_LIMIT
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART	1

I get the following mender-grow-data.service error while running on the target:

-- Logs begin at Fri 2021-04-16 06:25:47 UTC, end at Fri 2021-04-16 06:29:17 UTC
. --
Apr 16 06:25:47 apalis-imx8 mender-client-resize-data-part[354]: cat: can't open
 '/sys/block/mmcblk0/mmcblk0p4/size': No such file or directory
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mmender-grow-d
ata.service: Main process exited, code=exited, status=1/FAILURE[[0m
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;38;5;185m[[0;1;39m[[0;1;38;5;185mm
ender-grow-data.service: Failed with result 'exit-code'.[[0m
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;31m[[0;1;39m[[0;1;31mFailed to sta
rt Mender service to grow data partition size.[[0m
Apr 16 06:25:47 apalis-imx8 systemd[1]: Starting Mender service to grow data par
tition size...
Apr 16 06:25:47 apalis-imx8 mender-client-resize-data-part[467]: cat: can't open
 '/sys/block/mmcblk0/mmcblk0p4/size': No such file or directory
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;39m[[0;1;31m[[0;1;39mmender-grow-d
ata.service: Main process exited, code=exited, status=1/FAILURE[[0m
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;38;5;185m[[0;1;39m[[0;1;38;5;185mm
ender-grow-data.service: Failed with result 'exit-code'.[[0m
Apr 16 06:25:47 apalis-imx8 systemd[1]: [[0;1;31m[[0;1;39m[[0;1;31mFailed to sta
rt Mender service to grow data partition size.[[0m

I did some debugging on the target:

# fdisk -l
Disk /dev/mmcblk0: 14.84 GiB, 15913189376 bytes, 31080448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2f2e2c2f

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    40959    32768   16M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      40960 31080447 31039488 14.8G 83 Linux


# cat /proc/cmdline
pci=nomsi root=/dev/mmcblk0p2 ro rootwait

# cat /proc/mtd
dev:    size   erasesize  name


Full console log.

1 Like

This works now with the latest updates to the mender-community layer.

See Toradex integration updates - #19 by drewmoseley

Hi @pgiangrossi,

What is the value of MENDER_TOTAL_SIZE_MB with the larger image that fails with easy installer automated install? I’ll try to replicate here now that I have a working apalis-imx8 build.

Drew

Hi Drew,

MENDER_TOTAL_SIZE_MB is 12288

Thanks to your most recent post on the toradex discussion, I have fixed the problem. nginx was timing out on the large transfer. I added the following 4 lines to a new file called “/etc/nginx/conf.d/timeout.conf”

proxy_connect_timeout 1200;
proxy_send_timeout 1200;
proxy_read_timeout 1200;
send_timeout 1200;

Then I restarted the nginx server, and it worked like a charm. Thanks a lot!

I tried to post this on the other toradex chat, but it says that I do not have permissions to post a comment.

Paul

OK. Great to hear.

I’ll see if I can figure out your permissions issue. Worst case I’ll post the details for you.

Drew

Hi @pgiangrossi I just confirmed that the Toradex community site is read-only at the moment. We are migrating to a new platform. It should be live again soon.