I have a working system with u-boot and a UBIFS partition on SLC NAND.
I've copied the UBIFS partition into a binary image file by reading the whole range of blocks it occupies, including spare area.
I can successfully program this image to another NAND device (skipping empty pages) and mount it, thus duplicating the partition. However, if there's a bad block in the new NAND device, I don't know what would be the correct action?
When I try to skip bad blocks (during programming), which seems to be the most reasonable solution, mount from u-boot fails! Can't UBIFS mount process identify that a bad block was skipped? Is there any other simple solution?
Found a working method!
The whole purpose of this was to find a simple algorithm for programming NAND flash parts, before soldeing it to the board.
This is done during mass production by a programming machine, and there's no way to use Linux to do that. Since the NAND part is new, no need for wear leveling information, however, it may have 0 to any number of bad blocks, randomly located in the partition area. The only available steps are:
It's possible to prepare UBIFS using mkfs and other tools, but than you need to add the ECC information, which the programming machine may not be able to calculate on the fly, and sometimes just don't have the knowledge.
Hope that helps anyone :-)