iMX6ULL flashing NAND from UUU

I’m trying to script the process of flashing a custom image to NAND.
I’ve done this before with other iMX boards, the key difference for me is that the iMX6ULL 256MB has SLC NAND rather than eMMC NAND. So I have to deal with the BCB and UBI layer.

I have something “working” but there is one step in particular that feels wrong. I wonder if there is a better method.
My setup is:

  1. Use SDP to boot to u-boot in RAM
  2. erase NAND
  3. Use fastboot to download a copy of u-boot
  4. Use nandbcb write to flash u-boot to NAND and write back the control block
  5. (Optionally reload the tdx config block)
  6. Attach UBI and set up volumes kernel, dtb and rootfs
  7. Download and flash zImage and dtb respectively with ubi write
  8. **Download and flash rootfs with ubi write

With the correct boot commands I’m able to boot in this state.
But downloading the rootfs in this way with fastboot seems like it could be a problem.
I have 256MB of RAM to work with and the fairly minimal rootfs I’m using (core-image-minimal plus the dependencies I need) already hits ~190MB

With other iMX boards I’ve been able to use fastboot flash to stream the image to eMMC (in .wic format) in chunks, but this just failed with “error writing the image”.

My U-Boot is built with CONFIG_FASTBOOT_FLASH_NAND
The fastboot drivers in u-boot-toradex_2024.07 don’t seem to be UBI-aware, just raw NAND.
But even if I use a <image.ubi> file which I can manually flash from RAM with nand write, using fastboot flash [-raw2sparse] ubi <image.ubi> fails as above.

Am I missing something with fastboot flash and NAND?
Has anyone got that working, or is there a better way to do this?

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Let me help you with NAND flashing for the iMX6ULL. Based on the available documentation, there are some important considerations for NAND-based modules like your Colibri iMX6ULL.

Understanding NAND-based Module Structure

For NAND-based Toradex modules, the partition layout typically looks like this (1):

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

(1)

Alternative Approach: Using Toradex Easy Installer

The officially supported method for flashing entire images to Toradex SoMs is Toradex Easy Installer (1). For the Colibri iMX6ULL, you can load Easy Installer via recovery mode (2).

Manual NAND Update from Userspace

If you need to update components individually, the documentation shows how to update NAND-based modules from userspace (1):

Updating U-Boot

For U-Boot updates, the process involves erasing and writing to both redundant partitions (1):

root@colibri-imx7:~# flash_erase /dev/mtd1 0 0  
Erasing 128 Kibyte @ 160000 -- 100 % complete  
root@colibri-imx7:~# nandwrite /dev/mtd1 u-boot-colibri-imx7-2016.11-2.7.3-gitrf0e4149.imx   
Writing data to block 0 at offset 0x0  
Writing data to block 1 at offset 0x20000  
Writing data to block 2 at offset 0x40000  
Writing data to block 3 at offset 0x60000  
Writing data to block 4 at offset 0x80000  

(1)

Updating Kernel and Device Tree

For kernel and device tree updates, UBI volumes are used (1):

root@colibri-imx7:~# ubiupdatevol /dev/ubi0_0 zImage  
root@colibri-imx7:~# ubiupdatevol /dev/ubi0_1 imx7d-colibri-eval-v3.dtb   

(1)

Addressing Your Fastboot Issue

The issue you’re experiencing with fastboot and NAND is a known limitation. The community discussion indicates that fastboot drivers in U-Boot may not be fully UBI-aware for NAND operations (3).

Recommended Solutions

  1. Use Toradex Easy Installer: This is the officially supported method for complete image flashing (1)

  2. Boot from SD and flash NAND: You can boot from SD card and use the userspace methods to update NAND components individually (4)

  3. Consider memory constraints: For your 190MB rootfs on a 256MB RAM system, streaming approaches or breaking the rootfs into smaller chunks may be necessary

Platform Clarification Needed

To provide more specific guidance, could you confirm:

  • Which exact version of the OS/BSP are you using?
  • Are you working with TorizonCore, Yocto BSP, or another Linux distribution?

You can use the tdx-info command to get detailed system information: Getting Device Information with Tdx-Info | Toradex Developer Center

This information will help me provide more targeted assistance for your specific setup.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Here is the output of tdx-info

Software summary

Bootloader:               U-Boot
Kernel version:           6.6.85-0 #1 SMP PREEMPT Fri Mar 28 20:59:57 UTC 2025
Kernel command line:      ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs ubi.fm_autoconvert=1 console=tty1 console=ttyLP0,115200n8 mtdparts=gpmi-nand:512k(mx6ull-bcb),1536k(u-boot1)ro,1536k(u-boot2)ro,512k(u-boot-env),-(ubi)
Distro name:              NAME=“Framebuffer with EGLFS”
Distro version:           VERSION_ID=1.0
Distro variant:           -
Hostname:                 colibri-imx6ull

Hardware info

HW model:                 Toradex Colibri iMX6ULL 256/512MB on Colibri Evaluation Board V3
Toradex version:          0036 V1.1A
Serial number:            15716302
Processor arch:           armv7l

Yes my partition layout is similar to what you describe

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"

Updating NAND from an initramfs with visibility of both NAND and an SD card seems like it might work, but it is an extra step over just directly flashing via UUU

It seems like it should be possible to take a Yocto-created <image.ubi> with the correct volumes and flash that directly to the ubi partition.
Then fastboot flash doesn’t need to be UBI-aware.
But I couldn’t get that to work. Do you think it should be possible?

Based on your system information and partition layout, I understand you’re working with a Colibri iMX6ULL running a custom Yocto build. Your approach of flashing a UBI image directly to the ubi partition should theoretically work, but there are some important considerations.

Understanding the NAND Flash Layout

Your partition layout matches the expected structure for NAND-based Toradex modules (1). The UBI partition (mtd4) contains the kernel, device tree, and root filesystem as UBI volumes (1).

Why Direct UBI Flashing Should Work

You’re correct that flashing a complete .ubi image to the ubi partition should bypass the need for UBI-aware fastboot drivers. The process would be:

  1. Erase the UBI partition: Clear the entire UBI partition first
  2. Write the UBI image: Flash your Yocto-generated .ubi file directly to /dev/mtd4

Alternative Approach from Community Experience

Based on community discussions, there’s a proven method for NAND flashing that might work better for your use case (2):

Using SD Card Boot Method

  1. Prepare SD card with update files: Use the legacy update script method (2)
  2. Boot from SD: This gives you access to both SD storage and NAND devices (2)
  3. Manual UBI operations: Use ubiattach and ubiupdatevol commands (2)

From the community discussion, the process involves (2):

ubiattach --p /dev/mtd3

Then use ubiupdatevol to update individual volumes, which you can identify with ubinfo -a (2).

Potential Issues with Your Current Approach

The failure you’re experiencing with fastboot flash might be due to:

  1. Memory constraints: Your 190MB rootfs on 256MB RAM system is pushing limits
  2. Fastboot NAND limitations: The fastboot implementation may not handle raw NAND operations correctly for UBI partitions
  3. UBI image format: Ensure your Yocto-generated .ubi file is properly formatted for the target NAND geometry

Recommended Next Steps

  1. Try the SD boot method: This approach has been confirmed working by community members (2)
  2. Verify UBI image: Ensure your .ubi file matches the NAND erase block size and contains the correct volume layout
  3. Consider chunked approach: Break down the flashing process to work within RAM constraints

The documentation confirms that updating NAND-based modules from userspace is supported, though it notes that “we do not officially support updating NAND-based modules from userspace” and recommends Toradex Easy Installer as the primary method (1).

Would you like me to provide more specific guidance on any of these approaches?

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

If you do a Yocto build using Toradex BSP Layers, you should get a Toradex Easy Installer compatible package and then use it for module programming. All details related to UBI/UBIFS will be handled for you by the Toradex Easy Installer.