[U-Boot] U-boot and UBI problem with vexpress board.

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

Hi Marcin,
On 27.03.2015 13:59, Marcin Krzemiński wrote:
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)
Without looking deeper into your mail, I would recommend to increase the malloc size to at least 2MiB and test again.
Thanks, Stefan

Hi Stefan,
I've changed malloc pool size to 2MiB and nothing changed. I've also disabled UBIFS support and that does not make any changes. Still after qemu restart u-boot can not attach to ubi device.
Regards, Marcin
W dniu 27.03.2015 o 16:01, Stefan Roese pisze:
Hi Marcin,
On 27.03.2015 13:59, Marcin Krzemiński wrote:
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)
Without looking deeper into your mail, I would recommend to increase the malloc size to at least 2MiB and test again.
Thanks, Stefan

Hi,
It seem that I have found the root cause of the problem. This board in qemu is set in this way, that device width is set to 2 and interface to 4. That is why CFI driver in u-boot calculates wrongly sector size ( because size ratio variable was wrong ), so in the end every odd sector (counting from 0 ) was not available. I've changed vexpress board code in qemu and for now it is working. I do not have real vexpress board to check if the root cause is u-boot or qemu, but i think CFI driver i popular so propapbly there is something wrong in qemu site.
Regards, Marcin
W dniu 27.03.2015 o 16:53, mar.krzeminski pisze:
Hi Stefan,
I've changed malloc pool size to 2MiB and nothing changed. I've also disabled UBIFS support and that does not make any changes. Still after qemu restart u-boot can not attach to ubi device.
Regards, Marcin
W dniu 27.03.2015 o 16:01, Stefan Roese pisze:
Hi Marcin,
On 27.03.2015 13:59, Marcin Krzemiński wrote:
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)
Without looking deeper into your mail, I would recommend to increase the malloc size to at least 2MiB and test again.
Thanks, Stefan

Hello Marcin,
Am 29.03.2015 21:57, schrieb mar.krzeminski:
Hi,
It seem that I have found the root cause of the problem.
Good!
This board in qemu is set in this way, that device width is set to 2 and interface to 4. That is why CFI driver in u-boot calculates wrongly sector size ( because size ratio variable was wrong ), so in the end every odd sector (counting from 0 ) was not available.
Ah, ok...
I've changed vexpress board code in qemu and for now it is working.
Great.
I do not have real vexpress board to check if the root cause is u-boot or qemu, but i think CFI driver i popular so propapbly there is something wrong in qemu site.
I don't know ... it would be nice to have this checked on a real hw...
bye, Heiko

Hello Heiko,
I tried all people I know and unfortunately no one has this board. If someone has this board here, it is very easy to check. 1. fli command returns number of sectors. Should be 256 sectors, in wrong case is 128. Also sector addresses differs by 0x80000 in wrong case, but should be 0x40000. 2. saveenv command fails if this bug is present.
Regards, Marcin
W dniu 30.03.2015 o 08:05, Heiko Schocher pisze:
Hello Marcin,
Am 29.03.2015 21:57, schrieb mar.krzeminski:
Hi,
It seem that I have found the root cause of the problem.
Good!
This board in qemu is set in this way, that device width is set to 2 and interface to 4. That is why CFI driver in u-boot calculates wrongly sector size ( because size ratio variable was wrong ), so in the end every odd sector (counting from 0 ) was not available.
Ah, ok...
I've changed vexpress board code in qemu and for now it is working.
Great.
I do not have real vexpress board to check if the root cause is u-boot or qemu, but i think CFI driver i popular so propapbly there is something wrong in qemu site.
I don't know ... it would be nice to have this checked on a real hw...
bye, Heiko

Hello Marcin,
Am 30.03.2015 20:07, schrieb mar.krzeminski:
Hello Heiko,
I tried all people I know and unfortunately no one has this board.
:-(
If someone has this board here, it is very easy to check.
- fli command returns number of sectors. Should be 256 sectors, in wrong case is 128.
Also sector addresses differs by 0x80000 in wrong case, but should be 0x40000. 2. saveenv command fails if this bug is present.
If saveenv also fails, I think, it is not an UBI problem.
bye, Heiko
Regards, Marcin
W dniu 30.03.2015 o 08:05, Heiko Schocher pisze:
Hello Marcin,
Am 29.03.2015 21:57, schrieb mar.krzeminski:
Hi,
It seem that I have found the root cause of the problem.
Good!
This board in qemu is set in this way, that device width is set to 2 and interface to 4. That is why CFI driver in u-boot calculates wrongly sector size ( because size ratio variable was wrong ), so in the end every odd sector (counting from 0 ) was not available.
Ah, ok...
I've changed vexpress board code in qemu and for now it is working.
Great.
I do not have real vexpress board to check if the root cause is u-boot or qemu, but i think CFI driver i popular so propapbly there is something wrong in qemu site.
I don't know ... it would be nice to have this checked on a real hw...
bye, Heiko

Hi Heiko,
I'm not stating that is ubi problem. I just found it playing with ubi. It is in MTD driver, that is why I doubt it is related with u-boot at all, but real check would be nice...
Regards, Marcin
2015-03-31 7:24 GMT+02:00 Heiko Schocher hs@denx.de:
Hello Marcin,
Am 30.03.2015 20:07, schrieb mar.krzeminski:
Hello Heiko,
I tried all people I know and unfortunately no one has this board.
:-(
If someone has this board here, it is very easy to check.
- fli command returns number of sectors. Should be 256 sectors, in wrong
case is 128. Also sector addresses differs by 0x80000 in wrong case, but should be 0x40000. 2. saveenv command fails if this bug is present.
If saveenv also fails, I think, it is not an UBI problem.
bye, Heiko
Regards, Marcin
W dniu 30.03.2015 o 08:05, Heiko Schocher pisze:
Hello Marcin,
Am 29.03.2015 21:57, schrieb mar.krzeminski:
Hi,
It seem that I have found the root cause of the problem.
Good!
This board in qemu is set in this way, that device width is set to 2
and interface to 4. That is why CFI driver in u-boot calculates wrongly sector size ( because size ratio variable was wrong ), so in the end every odd sector (counting from 0 ) was not available.
Ah, ok...
I've changed vexpress board code in qemu and for now it is working.
Great.
I do not have real vexpress board to check if the root cause is u-boot
or qemu, but i think CFI driver i popular so propapbly there is something wrong in qemu site.
I don't know ... it would be nice to have this checked on a real hw...
bye, Heiko
-- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Hello Marcin,
Am 27.03.2015 16:53, schrieb mar.krzeminski:
Hi Stefan,
I've changed malloc pool size to 2MiB and nothing changed. I've also disabled UBIFS support and that does not make any changes. Still after qemu restart u-boot can not attach to ubi device.
Hmm.. hard to say, can you enable debug (not only in UBI) and maybe try current mainline U-Boot?
The line "UBI error: vtbl_check: bad CRC at record 0: 0x88cdfb6, not 0xffffffff" ... it seems, you have some problems reading your flash ... can you try a to write into your flash, reread the content and compare it?
Thanks!
bye, Heiko
Regards, Marcin
W dniu 27.03.2015 o 16:01, Stefan Roese pisze:
Hi Marcin,
On 27.03.2015 13:59, Marcin Krzemiński wrote:
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)
Without looking deeper into your mail, I would recommend to increase the malloc size to at least 2MiB and test again.
Thanks, Stefan
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (4)
-
Heiko Schocher
-
mar.krzeminski
-
Marcin Krzemiński
-
Stefan Roese