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

Hello,

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 ]
+ MENDER_STORAGE_DEVICE
/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:

MENDER_UBOOT_STORAGE_INTERFACE = “mmc”
MENDER_UBOOT_STORAGE_DEVICE = “0”

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.

Drew

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,

Rik

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?

Drew

Hello,

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>
++
  #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
+ env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
+       ENV_CRC,        /* CRC Sum */
 @@ -22,6 +23,7 @@ static char default_environment[] = {
  #else
  const uchar default_environment[] = {

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

Rik

@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

MENDER_ROOTFS_PART_A = "$(MENDER_STORAGE_DEVICE)2"
MENDER_ROOTFS_PART_B = "$(MENDER_STORAGE_DEVICE)3"

and you should have

MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE}2"
MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE}3"

Drew

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

Rik

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

Drew

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:

Rik