How to debug UBI?
Use fake MTD device When debugging UBI one doesn’t have to use a real embedded platform with real flash. In many cases, it is easier to use a PC with an MTD device emulator and run UBI on top of this emulated MTD device. In fact, this is how most of the UBI development was done. There are 3 MTD device emulators in Linux kernel available: • mtdram which simulates NOR flash in RAM; • nandsim which simulates NAND flash in RAM; • block2mtd which simulates NOR flash on top of a block device; For example, to get a 32MiB fake NOR flash, run $ modprobe mtdram total_size=32768 or to get a 64MiB fake NAND flash, run $ modprobe nandsim second_id_byte=0x36 See here for more information about the NAND simulator. To ensure that you have fake MTD devices, run “cat /prof/mtd”. It should print something like dev: size erasesize name mtd0: 02000000 00020000 “mtdram test device” mtd1: 04000000 00004000 “NAND simulator partition” The fake MTD devices may further be attached to UBI (see here). Enable debug