
Hi,
I want to test some UBI fs behavior in U-Boot using qemu and vexpress_ca9x4 board ( U-Boot 2015.1) To tst UBI I added lines to vexpress_ca9x4.h:
#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ #define CONFIG_MTD_PARTITIONS /* needed for UBI */ #define CONFIG_FLASH_CFI_MTD #define MTDIDS_DEFAULT "nor0=flash0-0" #define MTDPARTS_DEFAULT "mtdparts=flash0-0:1m(empty),10m(ubi),-(rest)" #define CONFIG_LZO /* needed for UBI */ #define CONFIG_RBTREE /* needed for UBI */ #define CONFIG_CMD_MTDPARTS #define CONFIG_CMD_UBI #define CONFIG_CMD_UBIFS #define CONFIG_FIT
also I've changed malloc pool size to 512kB in vexpress_common.h: #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 512 * 1024)
Also I enabled debugs in UBI and MTD driver
I'm running my test commands like that: qemu-system-arm -M vexpress-a9 -kernel u-boot -m 1024M -nographic -pflash flash1.bin -pflash flash2.bin Than in u-boot console: mtd default ubi part ubi
results are:
UBI: attaching mtd2 to ubi0 UBI: scanning is finished UBI: empty MTD device detected UBI: attached mtd2 (name "mtd=1", size 10 MiB) to ubi0 UBI: PEB size: 524288 bytes (512 KiB), LEB size: 524160 bytes UBI: min./max. I/O unit sizes: 1/1, sub-page size 1 UBI: VID header offset: 64 (aligned 64), data offset: 128 UBI: good PEBs: 20, bad PEBs: 0, corrupted PEBs: 0 UBI: user volume: 0, internal volumes: 1, max. volumes count: 128 UBI: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 0 UBI: available PEBs: 16, total reserved PEBs: 4, PEBs reserved for bad PEB handling: 0
So it is ok flash was empty (file wit only ff's).
I am quting qemu, starting it again ant now I can not mount ubi. Logs are here: UBI: attaching mtd2 to ubi0 UBI: scanning is finished UBI error: vtbl_check: bad CRC at record 0: 0x88cdfb6, not 0xffffffff UBI error: vtbl_check: bad CRC at record 0: 0x88cdfb6, not 0xffffffff UBI error: process_lvol: both volume tables are corrupted UBI error: ubi_attach_mtd_dev: failed to attach mtd2, error -22 UBI error: ubi_init: cannot attach mtd2 UBI error: ubi_init: cannot initialize UBI, error -22 ubi_init UBI init error 22
In flash imgae besides UBI! and UBI# headers I've got some other written sectors in this partition, is that ok? I thing i should have only those two headers ant their copy at this staete. I also thing about changing pool size, maybe there is something wrong with SP and that is why I've got this strange behaviour? I've tested qemu flash emulation, and all seems to work fine (writing and reading after reboots).
Regards, Marcin