Thursday, 16 January 2014

Creating UBIFS File System

        UBIFS
  • UBIFS used with raw flash memory media like NAND or NOR.
  • UBIFS works on top of an unsorted block images device, which is itself on top of a memory technology device (MTD).
  • The Unsorted Block Image File System (UBIFS) is a successor to JFFS2, and competitor to LogFS.
For more about UBIFS check this links below.



 Creating ubifs image:
  • Host# mkfs.ubifs -r <x> -m 4096 -e 516096 -c 320 -o rootfs.ubifs
   x= path to your file system like aragofs.
       This  step  will create rootfs.ubifs filesystem image.
       put that in your NFS path.


Flashing the UBIFS Filesystem.

  •  First of all compile kernel with MTD UBIFS support.for this enter below  commmands:

         ->Go to kernel source.
         ->Open menuconfig and enable the UBIFS support
         ->First Enable Device driver->MemoryTechnologydevice(MTD)-> Enable UBI       - Unsorted block images
         ->Then Ebable  Filesystem->Miscellaneous filesystems->UBIFS file system support
 
  •  Boot this compiled uImage with NFS filesystem. My kernel NAND mtd partition is as  below. filesystem partiton size is 60 MB

mtd0: 00080000 00080000 "UBL"
mtd1: 00200000 00080000 "u-boot"
mtd2: 00400000 00080000 "kernel"
mtd3: 03c00000 00080000 "filesystem"  <----- It is 60 MB.
mtd4: 00010000 00010000 "UBL"

1) First you have to Format NAND Partition in which you want to put filesyetem. here is  3rd partition. If you get any warning say yes.

     Target# ubiformat /dev/mtd3 -s 4096 -O 4096 

shows this messages:
----------------------------------------------------------------
    ubiformat: mtd3 (nand), size 62914560 bytes (60.0 MiB), 120 eraseblocks of 524288 bytes (512.0 KiB), min. I/O size 4096
bytes
libscan: scanning eraseblock 119 -- 100 % complete
ubiformat: 120 eraseblocks have valid erase counter, mean value is 0
ubiformat: formatting eraseblock 119 -- 100 % complete
------------------------------------------------------------------

2) Attach 3rd partition.(specified with -m option)

Target# ubiattach /dev/ubi_ctrl -m 3 -O 4096
  shows this messages:
------------------------------------------------------------
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   524288 bytes (512 KiB)
UBI: logical eraseblock size:    516096 bytes
UBI: smallest flash I/O unit:    4096
UBI: sub-page size:              1024
UBI: VID header offset:          4096 (aligned 4096)
UBI: data offset:                8192
UBI: max. sequence number:       0
UBI: attached mtd3 to ubi0
UBI: MTD device name:            "filesystem"
UBI: MTD device size:            60 MiB
UBI: number of good PEBs:        120
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:     0
UBI: available PEBs:             114
UBI: total number of reserved PEBs: 6
UBI: number of PEBs reserved for bad PEB handling: 2
UBI: max/mean erase counter: 1/1
UBI: image sequence number:  1158651939
UBI: background thread "ubi_bgt0d" started, PID 1276
UBI device number 0, total 120 LEBs (61931520 bytes, 59.1 MiB), available 114 LEBs (58834944 bytes, 56.1 MiB), LEB size
516096 bytes (504.0 KiB)
------------------------------------------------------------------

3) make volume of size 50MB. (please note my Partition size is 60 MB So I create only 50 MB Volume)
Target# ubimkvol /dev/ubi0 -s 50MiB -N ubifs0
shows this messages:
-----------------------------------------------------------------------
Volume ID 0, size 102 LEBs (52641792 bytes, 50.2 MiB), LEB size 516096 bytes (504.0 KiB), dynamic, name "ubifs0", alignm
ent 1
-------------------------------------------------------------------------
4) Write File-system in this volume.

Target# ubiupdatevol /dev/ubi0_0 <PATH TO Your created filesyetm>/rootfs.ubifs

5) Detach the 3rd partition.(specified with -m option)
Target# ubidetach /dev/ubi_ctrl -m 3

6) Set following bootargs and boot from NAND.
U-Boot> setenv bootargs console=ttyS2,115200n8 noinitrd rw mem=32M@0xc0000000 mem=64M@0xc4000000 ubi.mtd=3,4096 root=ubi0:ubifs0 rw rootfstype=ubifs ip=dhcp

7) Reboot your board with compiled uImage, you will get following prints.

## Booting kernel from Legacy Image at c0700000 ...
   Image Name:   Linux-2.6.37
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2214972 Bytes = 2.1 MiB
   Load Address: c0008000
   Entry Point:  c0008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37 (nirav@freescale-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #2 PREEMPT Thu Jul 28
 22:18:29 IST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: DaVinci DA850/OMAP-L138/AM18x EVM
Memory policy: ECC disabled, Data cache writeback
DaVinci da850/omap-l138/am18x variant 0x1
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
Kernel command line: console=ttyS2,115200n8 noinitrd rw mem=32M@0xc0000000 mem=64M@0xc4000000 ubi.mtd=3,4096 root=ubi0:u
bifs0 rw rootfstype=ubifs ip=dhcp
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 32MB 64MB = 96MB total
Memory: 92708k/92708k available, 5596k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xff000000 - 0xffe00000   (  14 MB)
    vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0031000   ( 164 kB)
      .text : 0xc0031000 - 0xc044a000   (4196 kB)
      .data : 0xc044a000 - 0xc0473720   ( 166 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptable hierarchical RCU implementation.
        RCU-based detection of stalled CPUs is disabled.
        Verbose stalled-CPUs detection is disabled.
NR_IRQS:245
Console: colour dummy device 80x30
Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
DaVinci: 144 gpio irqs
regulator: core version 0.5
regulator: dummy:
NET: Registered protocol family 16
WARNING: both McASP and McBSP are enabled, but they share pins.
        Only McASP will work. If you want McBSP support, disable McASP.
da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
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
pca953x 1-0020: interrupt support not compiled in
DA850/OMAP-L138 EVM UI card detected
pca953x 1-0021: interrupt support not compiled in
regulator: VDCDC1: 3200 <--> 3300 mV at 3300 mV
regulator: VDCDC2: 1750 <--> 3300 mV at 3300 mV
regulator: VDCDC3: 950 <--> 1350 mV at 1200 mV
regulator: LDO1: 1800 mV
regulator: LDO2: 1150 <--> 1300 mV at 1200 mV
i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource timer0_1
musb-hdrc: version 6.0, host, debug=0
musb-hdrc musb-hdrc: dma type: dma-cppi41
Waiting for USB PHY clock good...
musb-hdrc musb-hdrc: MUSB HDRC host driver
musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
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
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
EMAC: MII PHY configured, RMII PHY will not be functional
McBSP:Probed McBSP1
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 181
io scheduler noop registered (default)
da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
Console: switching to colour frame buffer device 60x34
Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
console [ttyS2] enabled
brd: module loaded
at24 1-0050: 32768 byte 24c256 EEPROM (writable)
ahci ahci: forcing PORTS_IMPL to 0x1
ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc
scsi0 : ahci_platform
ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
NAND device: Manufacturer ID: 0x2c, Chip ID: 0x48 (Micron )
Creating 4 MTD partitions on "davinci_nand.1":
0x000000080000-0x000000100000 : "UBL"
0x000000300000-0x000000500000 : "u-boot"
0x000000500000-0x000000900000 : "kernel"
0x000000900000-0x000004500000 : "filesystem"
davinci_nand davinci_nand.1: controller rev. 2.5
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   524288 bytes (512 KiB)
UBI: logical eraseblock size:    516096 bytes
UBI: smallest flash I/O unit:    4096
UBI: sub-page size:              1024
UBI: VID header offset:          4096 (aligned 4096)
UBI: data offset:                8192
ata1: SATA link down (SStatus 0 SControl 300)
UBI: max. sequence number:       42
UBI: attached mtd3 to ubi0
UBI: MTD device name:            "filesystem"
UBI: MTD device size:            60 MiB
UBI: number of good PEBs:        120
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:             12
UBI: total number of reserved PEBs: 108
UBI: number of PEBs reserved for bad PEB handling: 2
UBI: max/mean erase counter: 4/1
UBI: image sequence number:  1158651939
UBI: background thread "ubi_bgt0d" started, PID 450
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
m25p80 spi1.0: m25p64 (8192 Kbytes)
Creating 6 MTD partitions on "m25p80":
0x000000000000-0x000000010000 : "UBL"
0x000000010000-0x000000090000 : "U-Boot"
0x000000090000-0x0000000a0000 : "U-Boot-Env"
0x0000000a0000-0x000000320000 : "Kernel"
0x000000320000-0x000000720000 : "Filesystem"
0x0000007f0000-0x000000800000 : "MAC-Address"
Read MAC addr from SPI Flash: ff:ff:ff:ff:ff:ff
spi_davinci spi_davinci.1: Controller at 0xfef0e000
davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
davinci_mdio davinci_mdio.0: detected phy mask fffffffe
davinci_mdio.0: probed
davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
console [netcon0] enabled
netconsole: network logging started
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci ohci.0: DA8xx OHCI
ohci ohci.0: new USB bus registered, assigned bus number 2
Waiting for USB PHY clock good...
ohci ohci.0: irq 59, io mem 0x01e25000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
input: gpio-keys-polled as /devices/platform/gpio-keys-polled.0/input/input0
input: gpio-keys-polled as /devices/platform/gpio-keys-polled.1/input/input1
input: TPS6507x Touchscreen as /devices/platform/i2c-gpio.1/i2c-1/1-0048/input/input2
omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
omap_rtc: RTC power up reset detected
omap_rtc: already running
i2c /dev entries driver
watchdog watchdog: heartbeat 60 sec
cpuidle: using governor ladder
cpuidle: using governor menu
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
1-0018 supply IOVDD not found, using dummy regulator
1-0018 supply DVDD not found, using dummy regulator
1-0018 supply AVDD not found, using dummy regulator
1-0018 supply DRVDD not found, using dummy regulator
asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok
ALSA device list:
  #0: DA850/OMAP-L138 EVM
TCP cubic registered
NET: Registered protocol family 17
regulator_init_complete: incomplete constraints, leaving LDO2 on
regulator_init_complete: incomplete constraints, leaving LDO1 on
regulator_init_complete: incomplete constraints, leaving VDCDC3 on
regulator_init_complete: incomplete constraints, leaving VDCDC2 on
regulator_init_complete: incomplete constraints, leaving VDCDC1 on
davinci_emac_probe: using random MAC addr: 76:15:39:fc:12:4d
omap_rtc omap_rtc: setting system clock to 2000-04-11 08:08:25 UTC (955440505)
davinci_mdio davinci_mdio.0: resetting idled controller
net eth0: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=0:00, id=7c0f1)
Sending DHCP requests .
PHY: 0:00 - Link is Up - 100/Full
., OK
IP-Config: Got DHCP answer from 192.168.6.59, my address is 10.100.3.38
IP-Config: Complete:
     device=eth0, addr=10.100.3.38, mask=255.255.255.0, gw=10.100.3.1,
     host=10.100.3.38, domain=, nis-domain=(none),
     bootserver=192.168.6.59, rootserver=192.168.6.59, rootpath=
UBIFS: mounted UBI device 0, volume 0, name "ubifs0"
UBIFS: file system size:   47480832 bytes (46368 KiB, 45 MiB, 92 LEBs)
UBIFS: journal size:       10452992 bytes (10208 KiB, 9 MiB, 21 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:13.
Freeing init memory: 164K
INIT: version 2.86 booting
Please wait: booting...
Starting udev
udevd (592): /proc/592/oom_adj is deprecated, please use /proc/592/oom_score_adj instead.
Root filesystem already rw, not remounting
Caching udev devnodes
Populating dev cache
logger: mount: mount point /proc/bus/usb does not exist
ALSA: Restoring mixer settings...
Configuring network interfaces... Unknown hardware: "" "" "" "" ""
Hardware is initialized using a guess method
udhcpc (v1.13.2) started
/usr/share/alsa/init/default:53: control element not found
/usr/share/alsa/init/default:53: control element not found
/usr/sbin/alsactl: set_control:1256: failed to obtain info for control #3 (No such 
Configuring update-modules.
Configuring dbus.
 Adding system startup for /etc/init.d/dbus-1.
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting telnet daemon.
Starting syslogd/klogd: done
Starting thttpd.

 _____                    _____           _         _
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
              |___|                    |___|

Arago Project http://arago-project.org arago ttyS2

Arago 2010.11 arago ttyS2

arago login: root
------------------------------------------------------------------

No comments:

Post a Comment