I am writing a custom uboot bootloader for the IMX6ULL colibri, and want to write it to the NAND flash from linux itself.
I know that I could use the Toradex EZ installer for this, but I want to manually be able to do this as well. What is the recommended procedure for this?
And if I take a look at mtd1 and mtd2, it is clear u-boot is there at a 1kB offset.
The question is, is it OK for me to simply update these MTD partitions with my new uboot or not?
(The only reason I can think of that this is not OK, is that in the boot block (in BCB) the exact uboot size was passed along, which could lead to the IMX6ULL not fully copying all data into memory before booting.
Thanks, but this indeed shows how to overwrite the /dev/mtd’s with uboot.
It does not ask or check whether the full uboot image is copied to RAM by the IMX-ROM code. That code checks the BCB, which has information like “PagesInFirmware”. If this field is set to the smallest value possible for a given uboot, just updating the /dev/mtd might not be enough.
Hence the question, is this safe to do or not? And if not, what is the recommended procedure to also update the BCB?
Thanks, but this indeed shows how to overwrite the /dev/mtd’s with uboot.
No, you said from Linux itself which is exactly what it shows.
It does not ask or check whether the full uboot image is copied to RAM by the IMX-ROM code. That code checks the BCB, which has information like “PagesInFirmware”. If this field is set to the smallest value possible for a given uboot, just updating the /dev/mtd might not be enough.
Don’t worry, just assume it is all set to sane values.
Hence the question, is this safe to do or not?
Of course, this is safe to do.
And if not, what is the recommended procedure to also update the BCB?
“Don’t worry, just assume it is all set to sane values.”
Sure they are sane (it does boot …), but if you look at the code of kobs-ng, you will see that one of the values filled in is the “PagesInFirmware” or “m_uSectorsInFirmware”. In other words, if my uboot gets bigger than the ones previously flashed by the toradex ez installer, the BCB might be wrong still? (and hence unsafe)
Yes, we did look at it very thoroughly. We do set the size here to 3.5 megabytes which should be plenty enough for any kind of U-Boot even taking a few bad blocks and whatnot into account.
BTW: As follows the output of kobs-ng dump -v from within the Toradex Easy Installer running on a Colibri iMX6ULL:
I appreciate you looking further into this.
However, I am not convinced that the size is 3.5MB.
This is the “chip_size” parameter, which, as far as I can tell, just tells kobs-ng how far to look for the NCB’s.
The parameter I am interested in is the FCB - m_u32PagesInFirmware1. Aside from basic geometry of the NAND, the kobs-ng output you provided does not show any of this (and even seems to assume NCB (which it then does not find).
See the IMX6ULL Reference Manual at <8.5.2.3 Firmware configuration block> and friends for more information.
Sorry for persisting here, but I’d just like to be sure I wont run into any issue at some point with this.