Colibri IMX6ULL

Im trying to integrate mender on a Toradex Colibri-imx6ull module. I’m using the repos for yocto 3.1 (dunfell) provided by toradex and the dunfell mender branch.

I based slightly based my port on the existing colibri imx7 module (meta-mender-community) but instead of keeping the environment on raw NAND I opted for the option to save it on UBI volumes.

Toradex provides a fork of u-boot (u-boot-toradex) so I followed the manual integration steps described in mender’s docs.

TLDR; The problem
After building everything and flashing it, my system boots only the first time. Once the kernel mounts the rootfs from the ubi volume it spits lots of UBI ECC errors and it kind of corrupts the volume.
After this, rebooting the board causes u-boot to not be capable of mounting the ubi partition anymore.

Any idea about what I could be doing wrong??

My configuration is as follows:


MENDER_MTDIDS = "nand0=gpmi-nand"
MENDER_MTDPARTS = "gpmi-nand:512k(mx6ull-bcb),1536k(u-boot1)ro,1536k(u-boot2)ro,512k(u-boot-env),-(ubi)"
MENDER_ARTIFACT_NAME = "xpac-mender"


RPROVIDES_${PN}_mender-uboot += "u-boot"
FILESEXTRAPATHS_prepend_mender-uboot := "${THISDIR}/files:"
MENDER_UBOOT_PRE_SETUP_COMMANDS_mender-uboot_colibri-imx6ull = "setenv fdtfile ${KERNEL_DEVICETREE}"
require recipes-bsp/u-boot/
SRC_URI_remove_mender-uboot = " \
    file://0003-Integration-of-Mender-boot-code-into-U-Boot.patch \
SRC_URI_append_mender-uboot = " \
    file://0001-integrate-mender-into-toradex-uboot.patch \
SRC_URI_append_mender-uboot_colibri-imx6ull = " \
	file://0001-colibri-imx6ull-mender-manual-U-boot-integration.patch \
BOOTENV_SIZE = "0x20000"

U-boot patch: 0001-colibri-imx6ull-mender-manual-U-boot-integration.patch
Relevant parts of the patch:

--- git.orig/configs/colibri-imx6ull_defconfig
+++ git/configs/colibri-imx6ull_defconfig

mender_Kconfig_fragment: Generated by mender on the u-boot build dir


Flashing procedure
The command bitbake tdx-reference-minimal-image just works: builds and installs mender client in the rootfs, applies patches to uboot, generates the ubimg file, etc

I flash the genrated files using the following commands from already working u-boot on the board:

nand erase.part u-boot1
nand erase.part u-boot2
load mmc 0:1 ${loadaddr} u-boot-nand.imx
nand write ${loadaddr} u-boot1 ${filesize}
nand write ${loadaddr} u-boot2 ${filesize}
nand erase.part u-boot-env
nand erase.part ubi
load mmc 0:1 ${loadaddr} Colibri-iMX6ULL_Reference-Minimal-Image.ubimg
nand write ${loadaddr} ubi ${filesize}

The problem
After flashing, once I reset the board, the following things happen:

  1. U-boot detects the empty env. and saves the default one on the ubi volume (i added some printfs and 100% sure is saving on u-boot-env-1 and u-boot-env-2)
  2. U-boot loads the kernel + dtb file from the rootfsA partition and boots it
  3. Linux boots, rootfs is mounted
  4. Once linux mounts the rootfs It starts printing UBI ECC errors like this:
[    6.991319] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 69 bytes from PEB 546:91120, read 69 bytes
[    7.079145] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 67 bytes from PEB 546:92624, read 67 bytes
<omitted systemd messages here....>
[   15.013194] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 72 bytes from PEB 546:100816, read 72 bytes
[   15.360800] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 74 bytes from PEB 546:104048, read 74 bytes
<omitted systemd messages here....>
[   16.153057] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 32 bytes from PEB 546:108512, read 32 byte
  1. It finally boots, I get a loging prompt, I can use some commands , etc, but it still keeps printing ECC errors periodically.
  2. After rebooting, u-boot is no longer capable of recognizing the ubi partition anymore:
Booting from NAND...
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
ubi0 error: ubi_attach_fastmap: PEB 3 is in EBA but not in used list
ubi0 error: ubi_scan_fastmap: Attach by fastmap failed, doing a full scan!
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
UBIFS error (ubi0:0 pid 0): ubifs_scan: bad node
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 3:4096, read 126976 bytes
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 126976 bytes from PEB 4:4096, read 126976 bytes
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 11 bytes from PEB 10:8192, read 11 bytes
UBIFS error (ubi0:0 pid 0): ubifs_leb_read: reading 11 bytes from LEB 8:4096 failed, error -74
Error reading superblock on volume 'ubi0:rootfsa' errno=-74!
ubifsmount - mount UBIFS volume

I had the same problem and answered in the following thread: Ubifs ECC errors after adding Mender to Toradex iMX6ULL Image.

In short: Try nand write.trimffs instead of nand write to flash the device.

1 Like

YES! It worked! That was the issue. Thanks!

My plan is now to commit my changes to meta-mender-community so I will somehow add this very useful info to the Readme.

If using Toradex Easy Installer

I had the same issue when installing the generated (tezi) image with the Toradex Easy Installer.
Based on what is explained here I appended –space-fixup to MKUBIFS_ARGS in local.conf which solves the problem.

# Enable free --space-fixup (-F)

This is done in meta-freescale-3rdparty/conf/machine/colibri-imx7-nand.conf as well.

I guess it would also work for nand write (without trimffs) in u-boot, I didn’t test it though.

1 Like

Will test this approach as well. Would be great to be capable of using teezi out of the box.

Im going to prepare a pull request for the meta-mender-comunity repo, so might be we all benefit of a common solution :slight_smile:

I can confirm adding --space-fixup to the MKUBIFS variable works fine when using “nand write”

I’ve submitted a PR:
Probably would require some clean-up but I think is enough as a start point :slight_smile:

1 Like