(MENDER_STORAGE_DEVICE: not found) Mender u-boot patches for Toradex U-boot on Apalis imx8x


I am working on getting Mender to run on a Toradex Apalis IMX8X SoM (using their Ixora board) using Yocto.
I followed the guide on setting up Mender in a Yocto project but I am running in an issue regarding U-Boot.
The U-boot is provided by Toradex and called u-boot-Toradex, I added the “require recipes-bsp/u-boot/u-boot-mender.inc” to the .bb of u-boot-toradex but I am running into a compile error.

ERROR: u-boot-toradex-2020.04-r0 do_provide_mender_defines: Execution of '/home/developer/apalis/build/tmp/work/apalis_imx8x-tdx-linux/u-boot-toradex/2020.04-r0/temp/run.do_provide_mender_defines.31694' failed with exit code 1:
+ true
+ [ ! -e /home/developer/apalis/build/tmp/work/apalis_imx8x-tdx-linux/u-boot-toradex/2020.04-r0/fw_env.config.default ]
+ [ 0 -eq 0 ]
+ expr 16777216 % ( 8388608 * 2 )
+ [ 0 -ne 0 ]
+ [ 16777216 -gt 16777216 ]
/home/developer/apalis/build/tmp/work/apalis_imx8x-tdx-linux/u-boot-toradex/2020.04-r0/temp/run.do_provide_mender_defines.31694: 136: /home/developer/apalis/build/tmp/work/apalis_imx8x-tdx-linux/u-boot-toradex/2020.04-r0/temp/run.do_provide_mender_defines.31694: MENDER_STORAGE_DEVICE: not found

I do have MENDER_STORAGE_DEVICE specified in my local.conf file:

MENDER_STORAGE_DEVICE = “/dev/mmcblk0”

Does this error mean that MENDER_STORAGE_DEVICE or that u-boot tried to find a device called /dev/mmcblk0 and is not able to find it?

I did try adding the following but the error remains:


Without “require recipes-bsp/u-boot/u-boot-mender.inc” in the .bb file, the uboot compiles and works as expected, and my device nicely shows up in the mender.io server, but of course updating does not work.

@drewmoseley edited formatting

Hi @riktw what version of Yocto are you building? Are you using the existing meta-mender-toradex layer from the meta-mender-community repository? It should be relatively straight-forward to add a new Toradex SOM to the existing layer and I think all the U-Boot changes should already be there. You may only need to add a few _apalis-imx8 variable suffixes.


Hello Drew,

I am using Yocto 3.1 Dunfell (building on Debian 9) based on the Yocto examples from Toradex. I also tried the meta-mender-toradex one and I had to make one or two changes to the Integration of Mender boot code into Toradex U-boot patch file but after that I ended up with the exact same error sadly enough.

Best regards,


It looks like it is complaining because the string MENDER_STORAGE_DEVICE is referenced in u-boot-mender.inc rather than the variable declaration ${MENDER_STORAGE_DEVICE}.

Can you share your local.conf and any other related conf files if you use them (ie auto.conf)?

Can you confirm the commit hash you are using for the meta-mender and meta-mender-community repositories?

Can you also verify that git diff shows no local changes in your sources?



The local hashes are:
meta-mender: bd5a6de7f3e79f1bb37e18d02595ff31d22584ae and no local changes
meta-mender-community: fd3fafc3bd957b53b2dd0327c571b20e3341c465
One local change to to file meta-mender-toradex-nxp/recipes-bsp/u-boot/files/0001-Integration-of-Mender-boot-code-into-toradex-U-Boot.patch

The diff:

@@ -2,14 +2,15 @@ Index: git/include/env_default.h
 --- git.orig/include/env_default.h
 +++ git/include/env_default.h
-@@ -8,6 +8,7 @@
-  */
+@@ -9,6 +9,8 @@
  #include <env_callback.h>
-+#include <env_mender.h>
- #include <linux/stringify.h>
++#include <env_mender.h>
+ env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
+       ENV_CRC,        /* CRC Sum */
 @@ -22,6 +23,7 @@ static char default_environment[] = {
  const uchar default_environment[] = {

And the local.conf: MACHINE ?= "apalis-imx8x"## Where to place downloads## During a firs - Pastebin.com


@drewmoseley: edited formatting

I think the issue is your syntax in declaring the MENDER_ROOT_FS_PART_* variables. You are using parentheses instead of brackets:

ie You have


and you should have



Wow, I completely missed that, thanks a lot :slight_smile:
I had to make a patch file for things like the CONFIG_ENV_OFFSET setting in u-boot but I could copy that almost completely from the existing verdin patch. The build nor succeeds :smiley:

I can’t test it this week but I will validate it all works as expected next week. Thanks again


Excellent. Glad to hear we got you unstuck for now. I look forward to hearing if it is all working for you now.


I had to add a few more things to my patches (adding CONFIG_BOOTCOUNT_ENV, CONFIG_ENV_IS_IN_MMC and such in apalis include file) but I managed to get my apalis board to boot and update now, thanks again :slight_smile:


Hi riktw and drewmoseley,

I am really happy to know you successfully managed to integrate it. I am currently trying to do the same, but rather for Zeus Linux, which uses u-boot-toradex_2018.03. I followed your steps and created a patch for apalis-imx8_defconfig and apalis-imx8.h to include the missing boot environment variables . This is the content of the patch:

diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index 4f1266ed6f..0b93d0935a 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -71,3 +71,7 @@ CONFIG_VIDEO=y
 # CONFIG_EFI_LOADER is not set
diff --git a/include/configs/apalis-imx8.h b/include/configs/apalis-imx8.h
index 0d81069394..84802548c8 100644
--- a/include/configs/apalis-imx8.h
+++ b/include/configs/apalis-imx8.h
@@ -148,11 +148,11 @@
 #define CONFIG_SYS_MEMTEST_END		0x89000000
 /* Environment in eMMC, before config block at the end of 1st "boot sector" */
-#define CONFIG_ENV_SIZE			0x2000
@@ -160,6 +160,8 @@
 #define CONFIG_MMCROOT			"/dev/mmcblk0p2" /* USDHC1 eMMC */
 #define CONFIG_SYS_BOOTM_LEN		(64 << 20) /* Increase max gunzip size */
 /* Size of malloc() pool */

However, when compiling u-boot-toradex, I get the following error even though CONFIG_SYS_REDUNDAND_ENVIRONMENT was set in the patch:

Apalis-imx8/build-apalis-imx8/tmp/work/apalis_imx8-poky-linux/u-boot-toradex/2018.03-r0/git/include/config_mender.h:41:3: error: #error CONFIG_SYS_REDUNDAND_ENVIRONMENT is required for Mender to work. Make sure that: 1) All the instructions at https:
|    41 | # error CONFIG_SYS_REDUNDAND_ENVIRONMENT is required for Mender to work. Make sure that: 1) All the instructions at https://docs.mender.io/system-updates-yocto-project/board-integration/bootloader-support/u-boot have been followed. 2) All required layers are included in bblayers.conf, including any board specific layers such as meta-mender-<board>. Check also https://docs.mender.io/troubleshoot/yocto-project-build for Known Issues when upgrading.

I tried to also upgrade to u-boot-toradex_2019.07, but it gives the exact same error. Have you come across this error or have you any suggestions on how to fix it?

Thank you for your support, its really appreciated :slight_smile:

It looks like meta-mender-core/recipes-bsp/u-boot/patches/0002-Generic-boot-code-for-Mender.patch is checking for a C preprocessor define for CONFIG_SYS_REDUNDAND_ENVIRONMENT rather than a defconfig setting. The coral board integration shows how this is done. I’m not sure if that’s in addition to the defconfig setting or instead of it; you’ll need to experiment a bit.


Hi Drew,

Thanks for the hint, I will check it out.

Hi Drew

I implemented the changes to the patches, so now the uboot environment variables are patched as C preprocessor defines in apalis-imx8.h. Now I am able to compile and the board boots with Mender :slight_smile:.

I have two issues though, the first one I am familiar with, but the 2nd issue I don’t know what it means or why its happening.

When I run mender daemon, I get this error:

ERRO[0000] Failed to read the current active partition: No match between boot and root partitions.: Failed mender_saveenv_canary check. There is an error in the U-Boot setup. Likely causes are: 1) Mismatch between the U-Boot boot loader environment location and the location specified in /etc/fw_env.config. 2) ‘mender_setup’ is not run by the U-Boot boot script: exit status 1

To fix this, I need to update fw_env.config with the correct Device name, Device offset, and Env. size so that they match those U-Boot is using. How can I go about fixing this issue?

The 2nd issue is that after the board finishes booting, I get this message repeatedly:

mmcblk1: response CRC error sending SET_BLOCK_COUNT command, card status 0xc00b00

Do you have any idea what can be the cause of this message? I think both issues are related somehow .

Thank you :slight_smile:

The first issue indicates that the U-Boot environment is incorrect, likely as you surmise caused by invalid values in fw_env.config. You’ll need to dig through the configured U-Boot sources to figure out what values are needed.

I have no idea what would cause the second error. Are you using the Toradex BSP or a custom checkout? What branch?


Hi Rik,

I am interested in running Mender on the Apalis IMX8/Ixora platform. I am curious to see how you got this to work for the Apalis IMX8X, as this may help my work. Is it possible to share your patches?


I provided more information about my setup and current stage in the following post: