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.
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.
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.
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.
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
Wow, I completely missed that, thanks a lot
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
I can’t test it this week but I will validate it all works as expected next week. Thanks again
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
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_VIDEO_IMX_HDP_LOAD=y
CONFIG_OF_LIBFDT_OVERLAY=y
# CONFIG_EFI_LOADER is not set
+CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_OFFSET=0x2000
+CONFIG_ENV_OFFSET_REDUND=0x4000
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
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
-#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE + \
- CONFIG_TDX_CFG_BLOCK_OFFSET)
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_SYS_MMC_ENV_PART 1
+
+
+
+
+
#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
@@ -160,6 +160,8 @@
#define CONFIG_MMCROOT "/dev/mmcblk0p2" /* USDHC1 eMMC */
#define CONFIG_SYS_FSL_USDHC_NUM 3
+#define CONFIG_BOOTCOUNT_ENV
+#define CONFIG_BOOTCOUNT_LIMIT
#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
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.
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 .
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 .
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?
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?