u-boot中nand相关命令使用—- ubi, ubifsls, ubifsmount, ubifsumount | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

u-boot中nand相关命令使用—- ubi, ubifsls, ubifsmount, ubifsumount

点滴 admin 11年前 (2013-12-09) 4030次浏览 已收录 扫描二维码

1. 帮助信息

1.1 ubi

————————————-

U-Bootubi
ubi – ubi commands

Usage:
ubi part [part] [offset]
– Show or set current partition (with optional VID header offset)
ubi info [l[ayout]] – Display volume and ubi layout information
ubi create[vol] volume [size] [type] – create volume name with size
ubi write[vol] address volume size – Write volume from address with size
ubi read[vol] address volume [size] – Read volume to address with size
ubi remove[vol] volume – Remove volume
[Legends]
volume: character name
size: specified in bytes
type: s[tatic] or d[ynamic] (default=dynamic)

————————————-

1.2 ubifsls

————————————

U-Bootubifsls
UBIFS not mounted, use ubifsmount to mount volume first!
ubifsls – list files in a directory

Usage:
ubifsls [directory]
– list files in a ’directory’ (default ’/’)

————————————

1.3 ubifsmout

————————————

U-Bootubifsmount
ubifsmount – mount UBIFS volume

Usage:
ubifsmount volume-name
– mount ’volume-name’ volume

————————————

1.4 ubifsumount

————————————

U-Bootubifsumount
No UBIFS volume mounted!
ubifsumount – unmount UBIFS volume

Usage:
ubifsumount – unmount current volume

————————————

2.具体使用方法

如果board配置文件中有设置mtdids和mtdparts,则可以直接用mtdparts查看,如果没有,可以通过设置环境变量来使能。

U-Bootsetenv mtdids ’nand0=atmel_nand’

U-Bootsetenv mtdparts ’mtdparts=atmel_nand:8M(bootstrap)ro,-(rootfs)’

U-Bootmtdparts

—————————————————————

device nand0 atmel_nand, # parts = 2
#: name size offset mask_flags
0: bootstrap/uboot/kernel0x00800000 0x00000000 1
1: rootfs 0x0f800000 0x00800000 0

active partition: nand0,0 – (bootstrap/uboot/kernel) 0x00800000 @ 0x00000000

defaults:
mtdids : nand0=atmel_nand
mtdparts: mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs)

—————————————————————

U-Boot ubi part rootfs

—————————————————————

U-Bootubi part rootfs
Creating 1 MTD partitions on “nand0”:
0x000000800000-0x000010000000 : “mtd=1”
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: attached mtd1 to ubi0
UBI: MTD device name: “mtd=1”
UBI: MTD device size: 248 MiB
UBI: number of good PEBs: 1984
UBI: number of bad 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: 1961
UBI: total number of reserved PEBs: 23
UBI: number of PEBs reserved for bad PEB handling: 19
UBI: max/mean erase counter: 1/0

—————————————————————

U-Bootubi create rootfs

—————————————————————

U-Boot ubi create rootfs
No size specified – Using max size (248999936)
Creating dynamic volume rootfs of size 248999936

—————————————————————

U-Boot tftpboot 0x20000000 rootfs.ubi

U-Boot ubi write 0x20000000 rootfs 0x1911000

—————————————————————

U-Boot ubi write 0x20000000 rootfs 0x1911000
26284032 bytes written to volume rootfs

—————————————————————

U-Boot ubifsmount rootfs

—————————————————————

U-Boot ubifsmount rootfs
UBIFS: mounted UBI device 0, volume 0, name “rootfs”
UBIFS: mounted read-only
UBIFS: file system size: 247603200 bytes (241800 KiB, 236 MiB, 1950 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)

—————————————————————

U-Boot ubifsls

—————————————————————

U-Boot ubifsls
DIR 5368 Mon Dec 24 08:18:48 2012 bin
DIR 288 Mon Oct 29 07:56:14 2012 dev
DIR 2128 Mon Dec 24 08:18:47 2012 etc
DIR 2408 Mon Dec 24 08:18:47 2012 lib
DIR 160 Tue Dec 18 03:07:01 2012 mnt
DIR 160 Tue Dec 18 03:07:01 2012 opt
LNK 3 Tue Nov 27 02:10:35 2012 run
DIR 304 Tue Dec 18 03:30:12 2012 tmp
DIR 160 Tue Dec 18 03:07:01 2012 sys
DIR 672 Mon Oct 29 07:56:14 2012 var
DIR 480 Wed Dec 19 01:41:33 2012 usr
DIR 288 Tue Dec 18 03:30:26 2012 home
DIR 160 Tue Dec 18 03:07:01 2012 proc
DIR 3720 Mon Dec 24 08:18:48 2012 sbin
DIR 376 Tue Dec 18 03:07:01 2012 root
LNK 11 Tue Dec 18 03:15:34 2012 linuxrc
DIR 160 Tue Dec 18 03:07:01 2012 media

—————————————————————

U-Boot ubifsumount

—————————————————————

U-Boot ubifsumount
Unmounting UBIFS volume rootfs!

3. FAQ

3.1如何从ubifs image中读取Linuxkernel然后boot呢?

— ubi part rootfs; ubifsmount rootfs; ubifsload 0x20000000 boot/uImage; bootm 0x20000000;

如何确保每一步都正常执行呢? (将;全部改为除最后一个)

–ubi part rootfs ubifsmount rootfs ubifsload 0x20000000 boot/uImage bootm 0x20000000;


喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。