# Mender on iMX8 Plus U-Boot Setup Errors

**URL:** <https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686>\
**Category:** Yocto Project\
**Created:** [February 24, 2022, 8:55pm UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686 "2022-02-24T20:55:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgthompson24](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pgthompson24](https://hub.mender.io/u/pgthompson24)\
**Post date:** [February 24, 2022, 8:55pm UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/1 "2022-02-24T20:55:49Z")

</div>

# Board description

AvNet IMX8 Plus

> **[TRIA SM2S-IMX8PLUS - NXP-based compute modules by Tria](https://www.tria-technologies.com/product/tria-sm2s-imx8plus/)**
>
> The MSC SM2S-IMX8Plus module from Tria features NXP’s i.MX 8M Plus processors based on latest 14nm FinFET technology to allow high computing and graphics performance at very low power consumption combined with a high degree of functional integration.

Hello,

I’m new to mender and trying to run it in conjunction with a demo server on an avnet imx8 board. After following the instructions in the docs and fixing some other build errors, the build is completing and the built image boots on the board. However, whenever I try to perform an update or `mender setup` or `mender bootstrap` I receive the following error:

> Failed to read the current active partition: No match between boot and root partitions.

In following the steps from the [integration checklist](https://docs.mender.io/3.2/client-installation/integration-checklist), I noticed that in my `/etc/fw_env.config` the wrong device is referenced. It initially referenced `/dev/mmcblk0` so I changed it to reference the proper device which is `/dev/mmcblk1` (this device is shown in the first line of output after running `mount`). After this change the error expands to the following:

> 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

I am suspecting that it is cause number 2. When I interrupt the board’s boot to enter u-boot config, the `printenv` command yields entirely different variables than those that appear when I run `fw_printenv` in the linux environment. So I don’t think that the system is using the mender-modified version of u-boot or it for some reason isn’t getting modified.

The yocto build currently has `MENDER_UBOOT_AUTO_CONFIGURE` enabled and like I said I have followed the listed steps for U-Boot integration from here:

> **[U-Boot | Mender documentation](https://docs.mender.io/3.2/system-updates-yocto-project/board-integration/bootloader-support/u-boot)**

If anyone has seen an issue like this or has any insight, I would greatly appreciate your help.  
Thanks

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [February 25, 2022, 8:31am UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/2 "2022-02-25T08:31:57Z")

</div>

Hi @pgthompson24!

It’s somewhat ‘hidden’ in the last paragraph, but this is a Yocto build that you set up, right? So I would suggest to start out by diagnosing the bootloader in use. An idea on how to get going would be `bitbake -e virtual/bootloader | less` and see which u-boot is being put to use. If you do not see the Mender integration kicking in there, then this is probably the culprit.

If you can link to the BSP/Documentation you used for the integration build then I can also have a look.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![pgthompson24](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pgthompson24](https://hub.mender.io/u/pgthompson24)\
**Post date:** [February 28, 2022, 6:58pm UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/3 "2022-02-28T18:58:20Z")

</div>

Hi Josef,

Thanks for the reply. I realize now I didn’t make this very clear but yes this is a yocto build using the `zeus` branches of the `meta-mender-core` and `meta-mender-demo` layers. I followed this [guide](https://docs.mender.io/3.2/system-updates-yocto-project/build-for-demo) to integrate mender with the build in addition to these [steps](https://docs.mender.io/3.2/system-updates-yocto-project/board-integration/bootloader-support/u-boot) for u-boot.

That `bitbake` command you gave gives a lot of output but from what I can glean from it the build is using the `u-boot-imx` bootloader which is the one we made a `bbappend` for so that it would use mender. Is there something in there I can look at so make sure it is specifically doing the mender stuff to the bootloader?

---

<div class="post-metadata">

**Author:** ![whsplk](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@whsplk](https://hub.mender.io/u/whsplk)\
**Post date:** [March 2, 2022, 1:56am UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/4 "2022-03-02T01:56:01Z")

</div>

I would probably check if the mender layers are patching the necessary uboot related recipes. You can use `bitbake-layers show-appends` command and/or `bitbake -c patch <recipe>` and check the patched sources to make sure mender integration is inplace.

Use `bitbake -vn virtual/bootloader` to check which bootloader recipe your build is using.

The other recipe of note of `u-boot-distro-boot` as there’s some mender specific setup there as well

---

<div class="post-metadata">

**Author:** ![pgthompson24](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pgthompson24](https://hub.mender.io/u/pgthompson24)\
**Post date:** [March 2, 2022, 2:10pm UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/5 "2022-03-02T14:10:54Z")

</div>

Thanks whsplk,

When checking the `show-appends`, it does appear my patch is being applied

> u-boot-imx\_2018.03.bb:  
> /workdir/osdev/fng-bsp/sources/01047/msc-ldk-bsp-recipes.git/meta/recipes-bsp/u-boot/u-boot-imx\_%.bbappend  
> /workdir/osdev/fng-bsp/sources/meta-fng/recipes-bsp/u-boot/u-boot-imx\_%.bbappend  
> u-boot-imx\_2020.04.bb:  
> /workdir/osdev/fng-bsp/sources/01047/msc-ldk-bsp-recipes.git/meta/recipes-bsp/u-boot/u-boot-imx\_%.bbappend  
> /workdir/osdev/fng-bsp/sources/meta-fng/recipes-bsp/u-boot/u-boot-imx\_%.bbappend

And according to `bitbake -vn virtual/bootloader | grep boot`, the right bootloader is being used:

> NOTE: selecting u-boot-imx to satisfy virtual/bootloader due to PREFERRED\_PROVIDERS  
> NOTE: selecting u-boot-imx to satisfy runtime u-boot-imx-dev due to PREFERRED\_PROVIDER\_virtual/bootloader = u-boot-imx  
> NOTE: selecting u-boot-imx to satisfy runtime u-boot-imx due to PREFERRED\_PROVIDER\_virtual/bootloader = u-boot-imx

And bitbake couldn’t find anything when I searched that last recipe you mentioned. Maybe that is my issue? Also for clarity, this is the patch I am applying to `u-boot-imx`:

> # u-boot has to integrate directly with mender
> 
> require recipes-bsp/u-boot/u-boot-mender.inc  
> PROVIDES += “u-boot”  
> RPROVIDES\_${PN} += “u-boot”

So is there something wrong with my append file or is there more I need to add to it? Or should I try to track down why I don’t have the `u-boot-distro-boot` recipe? Thanks again for any help here.

---

<div class="post-metadata">

**Author:** ![whsplk](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@whsplk](https://hub.mender.io/u/whsplk)\
**Post date:** [March 2, 2022, 3:29pm UTC](https://hub.mender.io/t/mender-on-imx8-plus-u-boot-setup-errors/4686/6 "2022-03-02T15:29:17Z")

</div>

yea probably, Im not an uboot expert but for my board (from toradex), their recipes have a patch to the boot script ([meta-mender-community/0001-Adapt-boot.cmd.in-to-Mender.patch at dunfell · mendersoftware/meta-mender-community · GitHub](https://github.com/mendersoftware/meta-mender-community/blob/dunfell/meta-mender-toradex-nxp/recipes-bsp/u-boot-distro-boot/files/toradex-bsp-5.4.0/0001-Adapt-boot.cmd.in-to-Mender.patch)). This gets compiled down to a `boot.scr` file in my boot directory which reflects these changes.

Several other bsp layers does this too (for e.g [meta-mender-community/boot.cmd.in at dunfell · mendersoftware/meta-mender-community · GitHub](https://github.com/mendersoftware/meta-mender-community/blob/dunfell/meta-mender-odroid/recipes-bsp/odroid-u-boot-scr/files/boot.cmd.in) and [meta-mender/boot.cmd.in at master · mendersoftware/meta-mender · GitHub](https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in))

I would imagine you would need to implement something similar as well (or atleast check that the `mender_*` commands are being called during boot
