Colibri iMX6ULL: Updating flash from Uboot / Launching TEZI without PC

Hi team,

The customer is looking for an easy and approachable way of updating their Colibri iMX6ULL whole flash memory without the use of a PC connection, pretty much just a USB drive, where they will have the new files (Uboot, DTB, kernel, rootfs) and the serial console. As you know, we would have to tackle 2 steps: first backup the files, and then restore them to another module.

I made some changes but I couldn’t find an easy way to do it, but maybe (hopefully) I’m missing something.

I’ve been trying the following approaches to do, with the limitations given, in ascending difficulty level:

Backup the mtd partitions directly from a running Linux.
With cat /proc/mtd and mtdparts, I could get an idea of the flash partitioning. I tried to backup the “least sensitive data” first, mtd4, which contained the rootfs within the ubifs.


Colibri iMX6ULL # mtdparts
device nand0 <gpmi-nand>, # parts = 5
 #: name                size            offset          mask_flags
 0: mx6ull-bcb          0x00080000      0x00000000      0
 1: u-boot1             0x00180000      0x00080000      1
 2: u-boot2             0x00180000      0x00200000      1
 3: u-boot-env          0x00080000      0x00380000      0
 4: ubi                 0x1fc00000      0x00400000      0


root@colibri-imx6ull:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00080000 00020000 "mx6ull-bcb"
mtd1: 00180000 00020000 "u-boot1"
mtd2: 00180000 00020000 "u-boot2"
mtd3: 00080000 00020000 "u-boot-env"
mtd4: 1fc00000 00020000 "ubi"

I tried with dd if=/dev/mtd4 of=/media/sda1/mtd4.backup count=508 bs=1M (1fc00000 = 508MB), which succeeded, but I couldn’t restore it back. I tried through TEZI’s Linux to restore it back before launching a ramdisk or a Linux from a USB but that directly failed (TEZI has an additional MTD partition loaded):

/ #  cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 20000000 00020000 "gpmi-nand"
mtd1: 00080000 00020000 "mx6ull-bcb"
mtd2: 00180000 00020000 "u-boot1"
mtd3: 00180000 00020000 "u-boot2"
mtd4: 00080000 00020000 "u-boot-env"
mtd5: 1fc00000 00020000 "ubi"

/ # flash_erase /dev/mtd5 --quiet 0 0 
/ # cat /media/mtd4.backup | nandwrite --quiet --pad /dev/mtd5 
libmtd: error!: bad eraseblock number 4064, mtd5 has 4064 eraseblocks
nandwrite: error!: /dev/mtd5: MTD get bad block failed
           error 22 (Invalid argument)
nandwrite: error!: Data was only partially written due to error
           error 22 (Invalid argument)

Using a Legacy image for the iMX6ULL (But there is no Legacy flashing method for the ULL)

Before going deeper and starting to implement a “manual TEZI” (basically, do all the steps that TEZI will do in this equivalent case, like going through all the UBI commands) or find more information about DFU, I wanted to ask you about the possibility in launching TEZI without having to go to the recovery mode. I went through the following ideas:

  1. Creating a TEZI partition, launchable through U-boot. For this, I added tezi.itb in my image folder and then made some image.json formats additions (adding a new UBI volume and creating a new MTD device). Both methods failed (I can give the log but I don’t want to make this post too long, so tell me if you think it will help) during the flashing, size or format related.
  2. Creating a TEZI launchable USB. As a try, I followed “Boot From an SD Card / USB Stick / SATA drive” to create the TEZI USB but Uboot didn’t seem to recognize it.

Any suggestion will be appreciated!

Many thanks and best regards,

First, please note that Tezi is an installer and not an updater!

  1. Should work just like we can factory pre-install Tezi. Do please have a look at the Tezi’s JSON for reference.
  2. Would need to prepare a distributor media e.g. just extract the contents of the Tezi archive to the root of a FAT formatted media, preferably onto the first partition as there was a bug loading Tezi from subsequent ones.

Hi Álvaro

What you are looking for is booting TEZI from an SD card through the Distro Boot mechanism, which is what marcel is pointing to in (2). Please have a look at the (finally!) published article on Distro Boot.

Thank you both! The distro boot did exactly the trick :slight_smile: