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.

Booting Android from nand with ubifs root file system on BeagleBoard Rev C4

I have not been able to get this to work.

I have been using the information in http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_UserGuide#Creating_ubifs_images and am using the sources  from the rowboat_gingerbread.xml manifest. Everything seems to work except the linux kernel is unable to successfully mount the ubifs.

Here's the console dump:

Booting from nand ...

NAND read: device 0 offset 0x280000, size 0x400000
 4194304 bytes read: OK
## Booting kernel from Legacy Image at 80200000 ...
   Image Name:   Linux-2.6.37-gbe29450-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2900980 Bytes = 2.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37-gbe29450-dirty (kevin@kevin-Parallels-Virtual-
Platform) (gcc version 4.4.3 (GCC) ) #1 Wed Oct 19 21:08:52 PDT 2011
CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board
Reserving 12582912 bytes SDRAM for VRAM
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES3.1 (l2cache iva sgx neon isp 720mhz )
SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x10000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages:
61952
Kernel command line: console=ttyO2,115200n8 no_console_suspend
androidboot.console=ttyO2 mpurate=auto buddy=unknown camera=none
vram=12M omapfb.mode=dvi:640x480MR-1
6@60 omapdss.def_disp=dvi root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs
init=/init rw
rootwait

.
.
.

brd: module loaded
loop: module loaded
mtdoops: mtd device (mtddev=name/number) must be supplied
omap2-nand driver initializing
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron )
Creating 5 MTD partitions on "omap2-nand.0":
0x000000000000-0x000000080000 : "X-Loader"
0x000000080000-0x000000260000 : "U-Boot"
0x000000260000-0x000000280000 : "U-Boot Env"
0x000000280000-0x000000680000 : "Kernel"
0x000000680000-0x000010000000 : "File System"
OneNAND driver initializing
UBI: attaching mtd4 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 error: process_eb: bad image sequence number 28927372 in PEB 340,
expected 230676958
UBI error: ubi_init: cannot attach mtd4

.
.
.

VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available
partitions:
1f00             512 mtdblock0  (driver?)
1f01            1920 mtdblock1  (driver?)
1f02             128 mtdblock2  (driver?)
1f03            4096 mtdblock3  (driver?)
1f04          255488 mtdblock4  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-
block(0,0)
Backtrace:
[<c004b65c>] (dump_backtrace+0x0/0x110) from [<c0424f3c>] (dump_stack
+0x18/0x1c)
 r7:c0030e94 r6:00008000 r5:c05c0468 r4:c05c0468
[<c0424f24>] (dump_stack+0x0/0x1c) from [<c0424fa4>] (panic
+0x64/0x180)
[<c0424f40>] (panic+0x0/0x180) from [<c0008f54>] (mount_block_root
+0x260/0x2b0)
 r3:00000000 r2:00000000 r1:cec1bf70 r0:c04f48d6
[<c0008cf4>] (mount_block_root+0x0/0x2b0) from [<c00090a0>]
(prepare_namespace+0x94/0x1c4)
[<c000900c>] (prepare_namespace+0x0/0x1c4) from [<c00084bc>]
(kernel_init+0x114/0x154)
 r5:c0030470 r4:c05bf3c0
[<c00083a8>] (kernel_init+0x0/0x154) from [<c0076748>] (do_exit
+0x0/0x638)
 r5:c00083a8 r4:00000000

Here are the steps I followed in order to create the ubifs image and write it to nand:

1) I downloaded and compiled the latest version of the mtd-utils from git://git.infradead.org/mtd-utils.git
2) I couldn't successfully build the u-boot in the source tree with the arm-eabi-4.4.3 toolchain so I used arm-eabi-4.4.0 (it fails on the final link with:
./arm-eabi-4.4.3/bin/arm-eabi-ld: error: u-boot.lds:36:24: OVERLAY section type is unsupported
/bin/bash: line 1: 19473 Segmentation fault )

3) When I attempt to load my ubifs image into memory from the mmc with this u-boot the system hangs:

> fatload mmc 0:1 0x80300000 ubisystem.img
reading ubisystem.img        
[hangs forever here]

This behavior is the same with the pre-build u-boot.bin in the 2.4.3 devkit). I can load smaller files from the mmc with fatload with no problems and if I specify a size argument to fatload above I can successfully read 0xb00000 bytes from the file but not -xc00000 (out of a total filesize of 0x2a40000)

4) To work around this I downloaded and compiled the latest released version (2011.09) of u-boot from the git repository at git.denx.de. I also needed to compile this with the arm-eabi-4.4.0 toolchain.

5) I can load my ubifs image with this u-boot, but the nandecc command only takes hw or sw as and argument not hw1 and hw 2 as indicated in the devkit documentation.

Here are the details of how I am creating and flashing the ubifs image:

> ubinize --version
ubinize 1.4.6

> mkfs.ubifs/mkfs.ubifs --version
mkfs.ubifs 1.4.6

> sudo mkfs.ubifs/mkfs.ubifs -r ./out/target/product/jupiter_bb/android_nand_rootfs -o ./out/target/product/jupiter_bb/android_beagle.ubifs -m 2048  -e 129024 -c 1996;

> sudo ubinize -o ./ubisystem.img  -m 2048 -p 128KiB -s 512 ./ubinize.cfg

Contents of ubinize.cfg

[ubifs]
mode=ubi
image=android_beagle.ubifs
vol_id=0
vol_size=200MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize


u-boot commands to write ubifs image to nand:

> fatload mmc 0:1 0x80300000 ubisystem.img
> nandecc hw
> nand erase 0x680000 $filesize
> nand write 0x80300000 0x680000 $filesize

where $filesize = 0x2A40000

the u-boot I am using reports it's version as:

U-Boot 2011.09-00282-gd8fffa0 (Oct 19 2011 - 20:35:13)
arm-eabi-gcc (GCC) 4.4.0
GNU ld (GNU Binutils) 2.19

I have used different arguments for the logical erase block and erase count with mkfs.ubifs than the devkit documentation suggests. When I use the exact same arguments as in the documentation the reported error is different:

NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron )
Creating 5 MTD partitions on "omap2-nand.0":
0x000000000000-0x000000080000 : "X-Loader"
0x000000080000-0x000000260000 : "U-Boot"
0x000000260000-0x000000280000 : "U-Boot Env"
0x000000280000-0x000000680000 : "Kernel"
0x000000680000-0x000010000000 : "File System"
OneNAND driver initializing
UBI: attaching mtd4 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 error: validate_ec_hdr: bad VID header offset 2048, expected 512
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
UBI error: ubi_init: cannot attach mtd4

Any help will be greatly appreciated as I've been bumping my head against this for almost  a week.

Thanks,

Kevin

  • I can confirm that the TI pre-built u-boot also hangs on a beagleboard C3 in the same way when I attempted to fatload a 60MB ubi.img.

    OMAP3 beagleboard.org # fatload mmc 0 0x80300000 uImage
    reading uImage

    2745172 bytes read
    OMAP3 beagleboard.org # fatload mmc 0 0x80300000 ubi.img
    reading ubi.img
    (hangs at this point)
    It would be good if TI could confirm whether their prebuilt u-boot has a known bug or if we're doing something incorrect.
    Thanks,
    jaya
  • I was able to successfully boot from nand after applying the ubifs patches to the 2.6.37 kernel (http://www.linux-mtd.infradead.org/doc/ubifs.html#L_source) , and creating a ubifs image that did not use subpages. Had to use mainline u-boot  built from latest sources (http://www.denx.de/wiki/U-Boot/SourceCode), in order to copy the image into nand though (the TI u-boot just hung).