Ubifs ECC errors after adding Mender to Toradex iMX6ULL Image

Hello,

I have an image based on the latest Toradex BSP (3.0b3) which uses Poky and Yocto Thud which is installed using the Toradex Easy Installer. This image worked fine so I moved on integrating Mender 2.3 into it.

There is an example board integration for the Toradex iMX7 so I based mine off that, adding the following to my local.conf:

INHERIT_append = " mender-full-ubi "
INHERIT_append_colibri-imx6ull += " toradex_image_json "
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"
IMAGE_FSTYPES_remove = "mtdimg"
BOOTENV_SIZE_colibri-imx6ull ?= "0x18000"
BOOTENV_RANGE_colibri-imx6ull ?= "0x40000"
MENDER_STORAGE_PEB_SIZE_colibri-imx6ull = "131072"
MENDER_STORAGE_TOTAL_SIZE_MB_colibri-imx6ull = "512"
IMAGE_ROOTFS_MAXSIZE_colibri-imx6ull = "307200"

Because Toradex uses their own fork of u-boot and Linux, I set MENDER_UBOOT_AUTO_CONFIGURE = ā€œ0ā€ and manually applied the patches as well.

The build finished successfully and resulted in a .ubimg file. I flashed this using the Toradex Easy Installer, which I believe normally mounts the ubifs volumes and intelligently copies the data, but the iMX7 example did it this way so I did the same:

"mtddevs": [
    {
        "name": "u-boot1",
        "content": {
            "rawfile": {
                "filename": "u-boot-nand.imx",
                "size": 1
            }
        }
    },
    {
        "name": "u-boot2",
        "content": {
            "rawfile": {
                "filename": "u-boot-nand.imx",
                "size": 1
            }
        }
    },
    {
        "name": "u-boot-env",
        "content": {
            "rawfile": {
                "filename": "uboot.env",
                "size": 1
            }
        }
    },
    {
        "name": "ubi",
        "content": {
            "rawfile": {
                "filename": "XPAC-Image-colibri-imx6ull.ubimg",
                "size": "196"
            }
        }
    }
]

After it flashes successfully I reset the device and it appears to boot fine at first, but then will constantly start complaining about ECC errors: https://gist.github.com/Goz3rr/3999148383d5aa9ed608316b1cc3b98a

If I then reset the module once more, it refuses to boot completely and gets stuck in uboot: https://gist.github.com/Goz3rr/97c4fbf69991e4a8c1c8a3ee5bd96118

The only thing that stands out to me is that the ubifs max/mean erase counters were reset to 0, where they were 100+ before and retained after flashing an image using TEZI. Iā€™m assuming the flash itself is fine because if I flash the old image without mender back everything works again, so Iā€™m not sure what Iā€™m doing wrong

Hi @Goz3rr welcome to Mender hub.

I donā€™t see anything immediately suspicious in your steps. It all looks about like what I would do. I know getting the UBI/MTD parameters right can be a bit tricky so thatā€™s where I would first look.

There is another forum post on a similar platform that maybe helpful here: Imx6ull NAND Flash

Drew

Hi Drew,

Iā€™m attempting to manually flash the individual ubi volumes to see if that fixes the faulty ECC calculation.

Iā€™m using the XPAC-Image-colibri-imx6ull.tar.xz file from Yocto which normally is flashed to rootfs to fill rootfsa and rootfsb, is this correct or does mender do some additional special stuff to the two?

Iā€™m not sure where to get the default contents for the data partition from, looking at the ubimg it should contain u-boot/fw_env.config and some mender files like mender-agent.pem and mender-store but Iā€™m not sure where to find these.

Lastly the two u-boot-env partitions, are these identical and can I flash the uboot.env file to it?

Thanks.

If the tar.xz files were created by your build with Mender enabled then that should be the right set of files.

You can add ā€˜dataimgā€™ to the IMAGE_FSTYPES variable to have a separate image of the /data partition created but Iā€™m honestly not sure what that will create when using UBI as Iā€™ve only ever used it with ext partitions. I think there is also a ā€˜datatarā€™ option.

I think you can flash the uboot.env files but you shouldnā€™t need to. U-Boot will detect that the environment block is not properly checksummed and use the built-in default values.

Drew

This is reviving a rather old thread, but since I had the exact same issues as the thread creator and his error description is very good, I wanted to add my solution.

As a precursor, I used the toradex-imx7 community recipes as a base and rewrote the parts needed for the imx6ull board. For flashing I followed Mirza Krakā€™s description here: https://hub.mender.io/t/toradex-colibri-imx7-dual-512mb-colibri-imx7-solo-256mb/81

Afterwards the board booted up only once throwing a lot of ecc errors and from the second start it only went into u-boot.

On my search for a solution I stumbled upon the answer from ā€œsawdustā€ in the following stackoverflow thread: https://stackoverflow.com/questions/37407667/ubi-error-ubi-io-read-error-74-ecc-error

Using ā€œnand write.trimffsā€ instead of ā€œnand writeā€ seems to have solved the issue and I can reboot multiple times.

Best regards,
Thorsten

1 Like

Hello @thofu

Iā€™m trying to integrate Mender to my Yocto build. Iā€™m using Toradex Colibri-imx6ull as well.
Iā€™m struggling to do the integration. Iā€™m also using toradex-imx7 community recipes as a base but no success.

Could you provide the steps you took to perform mender and yocto integration for imx6-ull?