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:
- Use SDP to boot to u-boot in RAM
- erase NAND
- Use fastboot to download a copy of u-boot
- Use
nandbcb writeto flash u-boot to NAND and write back the control block - (Optionally reload the tdx config block)
- Attach UBI and set up volumes
kernel,dtbandrootfs - Download and flash zImage and dtb respectively with
ubi write - **Download and flash
rootfswithubi 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?