This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UBI Support in U-Boot for the DM8168

Hello experts!

I am working on a project based on a TI DM8168 that will be running a linux system from NAND. In order to avoid reliability issues caused by NAND blocks' corruptable nature, I decided to implement a solution based on UBI: The nand will be divided in two partitions - the first one for U-boot, and the second one for a two volume UBI partition. The first volume would be containing the linux kernel, and the second one the rootfs on UBIFS.

With this set up I need UBI support on U-Boot, but unfortunately, when enabling it on the u-boot-2010.06-psp04.00.01.13.patch1 version found on SDK version 5.03.01.15 I am unable to make UBI work. Here's the output of u-boot:


U-Boot 2010.06 (Mar 12 2012 - 17:25:29)


TI8168-GP rev 1.1

ARM clk: 987MHz
DDR clk: 796MHz

DRAM: 2 GiB
NAND: HW ECC Hamming Code selected
512 MiB
Net: Detected MACID:90:d7:eb:1c:ae:42
No ETH PHY detected!!!
DaVinci EMAC
Hit any key to stop autoboot: 0
UBoot#print mtdids
mtdids=nand0=omap2-nand
UBoot#print mtdparts
mtdparts=mtdparts=omap2-nand:896k(uboot),128k(env),-(partubi)
UBoot#nand erase partubi

NAND erase: device 0 offset 0x100000, size 0x1ff00000
Erasing at 0x1ffe0000 -- 100% complete.
OK
UBoot#ubi part partubi
Creating 1 MTD partitions on "nand0":
0x000000100000-0x000020000000 : "mtd=2"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI error: erase_worker: failed to erase PEB 762, error -12
UBI error: sync_erase: erase counter overflow at PEB 0, EC 18446744071569407449
UBI error: erase_worker: failed to erase PEB 0, error -22
UBI warning: ubi_ro_mode: switch to read-only mode
UBI error: do_work: work failed with error code -22
UBI error: do_work: work failed with error code -12
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error -12
exit not allowed from main input shell.

Any help in debugging / solving this would be much appreciated. I will be investigating the matter myself but as of now, I am now sure what I can do about this... I will share any new information regarding this if I find a solution to this problem.

To TI employees: Is there any future plan to give official support to UBI in u-boot on the SDK?

  • OK: I have found the solution.

    I had alredy modified include/configs/ti8168_evm.h so that I could compile UBI support, by setting CONFIG_SYS_MALLOC_LEN to (CONFIG_ENV_SIZE+ (512 * 1024)), but it seems that it was still to short in memory for UBI on this platform.

    Changing that value to (CONFIG_ENV_SIZE + (768 * 1024)) seems to work, though.

    So, to sum up, if you want UBI support in your U-Boot, you should modify your config file this way:

    substitute #define  CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE+ (32 * 1024))

    with:

    #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (768 * 1024))

    and add:

    #define CONFIG_CMD_MTDPARTS

    #define CONFIG_MTD_PARTITIONS

    #define CONFIG_MTD_DEVICE

    #define CONFIG_RBTREE

    #define CONFIG_LZO

    #define CONFIG_CMD_UBI

  • Hi Xabier,

    Have you tried to compile UBIFS support as well?  I tried adding #define CONFIG_CMD_UBIFS and my U-Boot image would not boot.  I haven't attempted anything further.

    Thanks.

  • hello,
    I met the same problem with you. I did all the things like the author said, but the u-boot can not boot from nand. Do you know why?

    Is there any one in Ti know something?