Chinaunix首页 | 论坛 | 博客
  • 博客访问: 550826
  • 博文数量: 116
  • 博客积分: 2063
  • 博客等级: 大尉
  • 技术积分: 1174
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-26 16:44
个人简介

none

文章分类

全部博文(116)

文章存档

2023年(2)

2020年(3)

2019年(4)

2018年(7)

2017年(6)

2016年(17)

2015年(13)

2014年(19)

2013年(6)

2012年(13)

2011年(5)

2010年(11)

2008年(10)

分类: LINUX

2011-12-10 11:34:40

Reference 

Environment
~ >: uname -a
Linux localhost 3.0.0 #205 Wed Dec 7 16:47:04 CST 2011 armv5tejl GNU/Linux
~ >: 
~ >: cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 98.71
Features        : swp half fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5

Hardware        : Atmel AT91SAM9260-EK
Revision        : 0000
Serial          : 0000000000000000
~ >: 
~ >: cat /proc/meminfo  | grep "MemTotal"
MemTotal:          61888 kB
~ >:


Requiresment
~ >: cat /proc/filesystems 
nodev   ubifs  # Make sure u can see this line in file /proc/filesystems


Create steps
ubiattach /dev/ubi_ctrl -m 9 # means attach mtd block 9 as UBI, after this CMD will cread /dev/ubi0 
ubimkvol /dev/ubi0 -N rootfs -s 51351500 # create volumes on the UBI device /dev/ubi0 with size 48MiB about
mount -o sync,noatime -t ubifs /dev/ubi0_0 /data/ # mount this volume 


Destory steps
umount /data
ubirmvol /dev/ubi0 -n 0
ubidetach -d 0 /dev/ubi_ctrl 


Operation on My board atmel at91sam9260
~ >: cat /proc/filesystems | grep "ubifs"
nodev   ubifs
~ >: 
~ >: ls /dev/ubi*
/dev/ubi_ctrl
~ >: 
~ >: cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00040000 00020000 "bootloader------256KB"
mtd1: 00020000 00020000 "boot ENV--------128KB"
mtd2: 00020000 00020000 "boot ENV BAK----128KB"
mtd3: 00500000 00020000 "linux kernel----5MB"
mtd4: 00a00000 00020000 "filesystem------10MB"
mtd5: 00500000 00020000 "backup_kernel---5MB"
mtd6: 01400000 00020000 "backup_fs-------20MB"
mtd7: 01e00000 00020000 "apps------------30MB"
mtd8: 00500000 00020000 "info------------5MB"
mtd9: 03300000 00020000 "data------------51M"
~ >: 
~ >: ubiattach /dev/ubi_ctrl -m 9
[  648.660000] UBI: attaching mtd9 to ubi0
[  648.670000] UBI: physical eraseblock size:   131072 bytes (128 KiB)
[  648.670000] UBI: logical eraseblock size:    129024 bytes
[  648.680000] UBI: smallest flash I/O unit:    2048
[  648.680000] UBI: sub-page size:              512
[  648.690000] UBI: VID header offset:          512 (aligned 512)
[  648.690000] UBI: data offset:                2048
[  648.780000] UBI: max. sequence number:       126
[  648.800000] UBI: attached mtd9 to ubi0
[  648.810000] UBI: MTD device name:            "data------------51M"
[  648.810000] UBI: MTD device size:            51 MiB
[  648.820000] UBI: number of good PEBs:        406
[  648.820000] UBI: number of bad PEBs:         2
[  648.830000] UBI: number of corrupted PEBs:   0
[  648.830000] UBI: max. allowed volumes:       128
[  648.830000] UBI: wear-leveling threshold:    4096
[  648.840000] UBI: number of internal volumes: 1
[  648.840000] UBI: number of user volumes:     0
[  648.850000] UBI: available PEBs:             398
[  648.850000] UBI: total number of reserved PEBs: 8
[  648.860000] UBI: number of PEBs reserved for bad PEB handling: 4
[  648.860000] UBI: max/mean erase counter: 22/1
[  648.870000] UBI: image sequence number:  1434265609
[  648.880000] UBI: background thread "ubi_bgt0d" started, PID 494
~ >: 
~ >: 
~ >: ubimkvol /dev/ubi0 -N rootfs -s 51351500
~ >: 
~ >: mount -o sync,noatime -t ubifs /dev/ubi0_0 /data/ # mount this volume
[  663.200000] UBIFS: default file-system created
[  663.270000] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[  663.270000] UBIFS: file system size:   50190336 bytes (49014 KiB, 47 MiB, 389 LEBs)
[  663.280000] UBIFS: journal size:       2451456 bytes (2394 KiB, 2 MiB, 19 LEBs)
[  663.290000] UBIFS: media format:       w4/r0 (latest is w4/r0)
[  663.290000] UBIFS: default compressor: lzo
[  663.300000] UBIFS: reserved for root:  2370612 bytes (2315 KiB)
~ >: 
~ >: mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,relatime,errors=continue)
proc on /proc type proc (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock6 on /apps type jffs2 (ro,sync,noatime)
/dev/mtdblock7 on /info type jffs2 (ro,sync,noatime)
/dev/ubi0_0 on /data type ubifs (rw,sync,noatime)
~ >: 
~ >: df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    9.7M      4.4M      5.2M  46% /
/dev/root                 9.7M      4.4M      5.2M  46% /
tmpfs                    30.2M         0     30.2M   0% /dev
/dev/mtdblock6           20.0M      1.3M     18.7M   6% /apps
/dev/mtdblock7           30.0M      1.1M     28.9M   4% /info
/dev/ubi0_0              44.3M     20.0K     42.0M   0% /data
~ >: 
~ >: 
~ >: 
~ >: 
~ >: umount /data
[  668.970000] UBIFS: un-mount UBI device 0, volume 0
~ >: 
~ >: ubirmvol /dev/ubi0 -n 0
~ >: 
~ >: ubidetach -d 0 /dev/ubi_ctrl 
[  677.010000] UBI: mtd9 is detached from ubi0
~ >:
阅读(1713) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

k_ewell2011-12-12 15:16:53

#!/bin/sh
NAME7="apps"
NAME8="info"
NAME9="data"

SIZE7=30060000
SIZE8=3483000
SIZE9=51350000

i=7
OPTIONS="-o ro,sync,noatime"
LOGS="/tmp/mount.log"
REMOUNT=0

if [ -e /dev/ubi_ctrl ];then
   
    while [ $i -lt 10 ];
    do
   
        if [ $i