[rowboat] Re: Nandboot with ubifs root file system

I can confirm Khr's observation that TI's u-boot hangs with above. I
tested on a beagleboard RevC3. I used the u-boot that was included in
the aforementioned Devkit 2.1 Gingerbread release. That is:

U-Boot 2010.06 (Dec 31 2011 - 21:04:15)

OMAP3430/3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: HW ECC [Kernel/FS layout] selected
256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Beagle Rev C1/C2/C3
Die ID #1308000300000000040323091000a01a
Hit any key to stop autoboot: 0
OMAP3 beagleboard.org # mmc init
mmc1 is available
OMAP3 beagleboard.org # fatload mmc 0 0x80300000 uImage
reading uImage

2745172 bytes read
[shows that reading 2.7MB is fine]
OMAP3 beagleboard.org # fatload mmc 0 0x80300000 ubi.img
reading ubi.img
[hangs here, waited up to 20 minutes]

(same also happens with pre-built version of u-boot provided in the
devkit release):

U-Boot 2010.06 (Jul 08 2011 - 04:37:45)

OMAP3430/3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: HW ECC [Kernel/FS layout] selected
256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Beagle Rev C1/C2/C3
Die ID #1308000300000000040323091000a01a
Hit any key to stop autoboot: 0

This issue was also posted on the e2e forum,
http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/141650.aspx
.

It would be good if someone from TI could provide feedback on the
issue. Is the inability to load a 60MB file to memory with the TI
u-boot a known issue? Khr solved that portion of the problem by using
the mainline u-boot. Is that what we should be doing?

Thanks,
jaya

Hi folks,

Happy new year 2012 to you all.

I was able to get my beagleboard c3 to work with a ubi rootfs. Details below:

ubifs in the link that you provided, but 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,

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]

I can confirm Khr's observation that TI's u-boot hangs with above. I
tested on a beagleboard RevC3. I used the u-boot that was included in
the aforementioned Devkit 2.1 Gingerbread release. That is:

U-Boot 2010.06 (Dec 31 2011 - 21:04:15)

OMAP3430/3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: HW ECC [Kernel/FS layout] selected
256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Beagle Rev C1/C2/C3
Die ID #1308000300000000040323091000a01a
Hit any key to stop autoboot: 0
OMAP3 beagleboard.org # mmc init
mmc1 is available
OMAP3 beagleboard.org # fatload mmc 0 0x80300000 uImage
reading uImage

2745172 bytes read
[shows that reading 2.7MB is fine]
OMAP3 beagleboard.org # fatload mmc 0 0x80300000 ubi.img
reading ubi.img
[hangs here, waited up to 20 minutes]

(same also happens with pre-built version of u-boot provided in the
devkit release):

U-Boot 2010.06 (Jul 08 2011 - 04:37:45)

OMAP3430/3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: HW ECC [Kernel/FS layout] selected
256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Beagle Rev C1/C2/C3
Die ID #1308000300000000040323091000a01a
Hit any key to stop autoboot: 0

This issue was also posted on the e2e forum,
http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/141650.aspx
.

It would be good if someone from TI could provide feedback on the
issue. Is the inability to load a 60MB file to memory with the TI
u-boot a known issue? Khr solved that portion of the problem by using
the mainline u-boot. Is that what we should be doing?

I was able to get this to work. Here's what I did:

- same u-boot sources as before (same as prebuilt)
U-Boot 2010.06 (Dec 31 2011 - 21:04:15)

OMAP3430/3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 256 MiB
NAND: HW ECC [Kernel/FS layout] selected
256 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Beagle Rev C1/C2/C3
Die ID #1308000300000000040323091000a01a
Hit any key to stop autoboot: 0
OMAP3 beagleboard.org # mmc init
mmc1 is available
OMAP3 beagleboard.org # fatload mmc 0:1 84000000 ubi.img
reading ubi.img
60424192 bytes read

[ I used a different target address this time 0x8400_0000 instead of
0x8030_0000 which I had copied from Khr. I am not sure how long it
took to read it as I wasn't paying attention, probably less than 10
minutes. It would be great if someone could explain why the
0x8400_0000 address makes it work. ]

Ok, so then I went on to flash the ubi.img to NAND as follows.

OMAP3 beagleboard.org # nandecc hw 1
HW ECC [Kernel/FS layout] selected
OMAP3 beagleboard.org # nand erase 0x780000 0x39A0000

NAND erase: device 0 offset 0x780000, size 0x39a0000
Erasing at 0x4100000 -- 100% complete.
OK

OMAP3 beagleboard.org # nand write 0x84000000 0x780000 0x39A0000

NAND write: device 0 offset 0x780000, size 0x39a0000
60424192 bytes written: OK

Rebuilt the kernel adding MTD_UBI and UBIFS support.

OMAP3 beagleboard.org # mmc init
mmc1 is available

[ I just wanted to test if it is able to boot off the ubi partition so
just changed bootargs rather than trying to flash xloader and u-boot
to nand as well. ]

OMAP3 beagleboard.org # setenv bootargs console=ttyO2,115200n8
androidboot.console=ttyO2 mem=256M init=/init ip=off
omap_vout.vid1_static_vrfb_alloc=y vram=8M omapfb.vram=0:8M rootwait
rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs
OMAP3 beagleboard.org # fatload mmc 0 82000000 uImage
reading uImage

2970204 bytes read

OMAP3 beagleboard.org # bootm 0x82000000
## Booting kernel from Legacy Image at 82000000 ...
   Image Name: Linux-2.6.37-g06ebbba
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 2970140 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-g06ebbba (test@lucidgingerbreadbb) (gcc version
4.4.3 (GCC) ) #3 Sun Jan 1 22:19:27 MYT 2012
CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board
Reserving 8388608 bytes SDRAM for VRAM
Memory policy: ECC disabled, Data cache writeback
OMAP3430/3530 ES3.0 (l2cache iva sgx neon isp )
SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x10000
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 62976
Kernel command line: console=ttyO2,115200n8 androidboot.console=ttyO2
mem=256M init=/init ip=off omap_vout.vid1_static_vrfb_alloc=y vram=8M
omapfb.vram=0:8M rootwait rw ubi.mtd=4,2048 rootfstype=ubifs
root=ubi0:rootfs
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 248MB = 248MB total
Memory: 244836k/244836k available, 17308k reserved, 0K highmem
Virtual kernel memory layout:
    vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
    vmalloc : 0xd0800000 - 0xf8000000 ( 632 MB)
    lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
    modules : 0xbf000000 - 0xc0000000 ( 16 MB)
      .init : 0xc0008000 - 0xc003c000 ( 208 kB)
      .text : 0xc003c000 - 0xc05a3000 (5532 kB)
      .data : 0xc05a4000 - 0xc05e8d40 ( 276 kB)
NR_IRQS:409
Clocking rate (Crystal/Core/MPU): 26.0/332/500 MHz
Reprogramming SDRC clock to 332000000 Hz
IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
Total of 96 interrupts on 1 active controller
GPMC revision 5.0
Trying to install interrupt handler for IRQ402
Trying to install interrupt handler for IRQ403
Trying to install interrupt handler for IRQ404
Trying to install interrupt handler for IRQ405
Trying to install interrupt handler for IRQ406
Trying to install interrupt handler for IRQ407
Trying to install interrupt handler for IRQ408
Trying to install type control for IRQ409
Trying to set irq flags for IRQ409
OMAP clockevent source: GPTIMER1 at 32768 Hz
Console: colour dummy device 80x30
Calibrating delay loop... 499.92 BogoMIPS (lpj=1949696)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
regulator: dummy:
NET: Registered protocol family 16
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
omap_mux_init: Add partition: #1: core, flags: 0
OMAP3 Beagle Rev: C1/C2/C3
Found NAND on CS0
Registering NAND on CS0
Unable to get DVI reset GPIO
hw-breakpoint: debug architecture 0x4 unsupported.
OMAP DMA hardware revision 4.0
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
omap_i2c omap_i2c.1: bus 1 rev3.12 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
regulator: VUSB1V5: 1500 mV normal standby
regulator: VUSB1V8: 1800 mV normal standby
regulator: VUSB3V1: 3100 mV normal standby
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
regulator: VMMC1: 1850 <--> 3150 mV at 3000 mV normal standby
regulator: VDAC: 1800 mV normal standby
regulator: VDVI: 1800 mV normal standby
regulator: VSIM: 1800 <--> 3000 mV at 1800 mV normal standby
regulator: VAUX3: 1800 mV normal standby
regulator: VAUX4: 1800 mV normal standby
omap_device: omap_i2c.1: new worst case deactivate latency 0: 30517
omap_i2c omap_i2c.2: bus 2 rev3.12 at 400 kHz
omap_i2c omap_i2c.3: bus 3 rev3.12 at 100 kHz
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource 32k_counter
musb-hdrc: version 6.0, otg (peripheral+host), debug=0
musb-hdrc musb-hdrc.0: dma type: dma-inventra
musb-hdrc musb-hdrc.0: USB OTG mode controller at fa0ab000 using DMA, IRQ 92
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
omap-iommu omap-iommu.0: isp registered
OMAP35x Linux PSP version 04.02.00.07 (OMAP3BEAGLE)
ashmem: initialized
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
JFFS2 version 2.2. (NAND) (SUMMARY) �© 2001-2006 Red Hat, Inc.
msgmni has been set to 478
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
OMAP DSS rev 2.0
OMAP DISPC rev 3.0
OMAP VENC rev 2
OMAP DSI rev 1.0
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a OMAP UART0
omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a OMAP UART1
omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a OMAP UART2
console [ttyO2] enabled
brd: module loaded
loop: module loaded
omap_device: omap_i2c.1: new worst case activate latency 0: 30517
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"

[ kernel is getting these from omap3beagle_nand_partitions ]

OneNAND driver initializing
UBI: attaching mtd4 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. sequence number: 0
UBI: volume 0 ("rootfs") re-sized from 1652 to 1973 LEBs
UBI: attached mtd4 to ubi0
UBI: MTD device name: "File System"
UBI: MTD device size: 249 MiB
UBI: number of good PEBs: 1996
UBI: number of bad PEBs: 0
UBI: number of corrupted PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 1996
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 1/0
UBI: image sequence number: 1247564091
UBI: background thread "ubi_bgt0d" started, PID 527
usbcore: registered new interface driver asix
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver smsc95xx
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-omap.0 supply hsusb0 not found, using dummy regulator
ehci-omap.0 supply hsusb1 not found, using dummy regulator
ehci-omap ehci-omap.0: OMAP-EHCI Host Controller
ehci-omap ehci-omap.0: new USB bus registered, assigned bus number 1
ehci-omap ehci-omap.0: irq 77, io mem 0x48064800
ehci-omap ehci-omap.0: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: OMAP-EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.37-g06ebbba ehci_hcd
usb usb1: SerialNumber: ehci-omap.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
android init
android_probe pdata: c05b3f2c
android_bind
android_usb gadget: android_usb ready
musb-hdrc musb-hdrc.0: MUSB HDRC host driver
musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 2
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: MUSB HDRC host driver
usb usb2: Manufacturer: Linux 2.6.37-g06ebbba musb-hcd
usb usb2: SerialNumber: musb-hdrc.0
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
f_adb init
android_register_function adb
adb_bind_config
f_mass_storage init
android_register_function usb_mass_storage
mice: PS/2 mouse device common for all mice
input: gpio-keys as /devices/platform/gpio-keys/input/input0
input: twl4030_pwrbutton as
/devices/platform/omap/omap_i2c.1/i2c-1/1-0049/twl4030_pwrbutton/input/input1
using rtc device, twl_rtc, for alarms
twl_rtc twl_rtc: rtc core: registered twl_rtc as rtc0
twl_rtc twl_rtc: Power up reset detected.
twl_rtc twl_rtc: Enabling TWL-RTC.
i2c /dev entries driver
Linux media interface: v0.10
Linux video capture interface: v2.00
omap3isp supply VDD_CSIPHY1 not found, using dummy regulator
omap3isp supply VDD_CSIPHY2 not found, using dummy regulator
omap3isp omap3isp: Revision 2.0 found
omap-iommu omap-iommu.0: isp: version 1.1
omap_i2c omap_i2c.2: controller timed out
mt9v113 2-003c: chip id mismatch read 0x0, expecting 0x2280
isp_register_subdev_group: Unable to register subdev mt9v113
OMAP Watchdog Timer Rev 0x31: initial timeout 60 sec
twl4030_wdt twl4030_wdt: Failed to register misc device
twl4030_wdt: probe of twl4030_wdt failed with error -16
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.18.0-ioctl (2010-06-29) initialised: dm-devel@redhat.com
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
logger: created 64K log 'log_system'
usbcore: registered new interface driver snd-usb-audio
OMAP3 Beagle/Devkit8000 SoC init
asoc: twl4030-hifi <-> omap-mcbsp-dai.1 mapping ok
ALSA device list:
  #0: omap3beagle
oprofile: hardware counters not available
oprofile: using timer interrupt.
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
ThumbEE CPU extension supported.
Power Management for TI OMAP3.
smartreflex smartreflex.0: omap_sr_probe: SmartReflex driver initialized
smartreflex smartreflex.1: omap_sr_probe: SmartReflex driver initialized
SmartReflex Class3 initialized
clock: disabling unused clocks to save power
platform iva.0: omap_voltage_scale: Already at the requestedrate 360000000
platform mpu.0: omap_voltage_scale: Already at the requestedrate 500000000
platform l3_main.0: omap_voltage_scale: Already at the requestedrate 166000000
regulator_init_complete: incomplete constraints, leaving VDAC on
twl_rtc twl_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
omap_vout omap_vout: Buffer Size = 3686400
omap_vout omap_vout: : registered and initialized video device 15
omap_vout omap_vout: Buffer Size = 3686400
omap_vout omap_vout: : registered and initialized video device 16
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 245952512 bytes (240188 KiB, 234 MiB, 1937 LEBs)
UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)

[ hey, look at that, seems good so far ]

VFS: Mounted root (ubifs filesystem) on device 0:12.
Freeing init memory: 208K
mmc0: new high speed SDHC card at address 1234
mmcblk0: mmc0:1234 SA04G 3.68 GiB
mmcblk0: p1 p2 p3
init (1): /proc/1/oom_adj is deprecated, please use
/proc/1/oom_score_adj instead.
init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'
# enabling adb
adb_open
warning: `zygote' uses 32-bit capabilities (legacy support in use)
binder: release 1302:1302 transaction 1075 out, still active
binder: 1139:1321 transaction failed 29189, size 14460-0
binder: send failed reply for transaction 1075, target dead

Ok, so I think that worked fine. Here were my ubi settings:

1107 cd ~/nand_work/mtd-utils/
1108 ./mkfs.ubifs/mkfs.ubifs -r
~/nand_work/TI_Android_GingerBread_2_3_4_DevKit_2_1/Prebuilt_Images/beagleboard-rev-c4/Filesystem/jaya_unpacked/
-m 2048 -e 126976 -c 1948 -o ubifs.img

# cat ubinize.cfg
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=200MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

ubi-utils/ubinize -o ubi.img -O 2048 -m 2048 -p 128KiB -s 512 ubinize.cfg

I hope this is helpful.

Regards,
jaya