微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > at91sam9261-ubifs成功移植

at91sam9261-ubifs成功移植

时间:12-02 来源:互联网 点击:
based on: linux-3.6.9, 128M Nand, busybox-1.20.2
ubi命令来自busbox。
如下:

flash_eraseall /dev/mtd1

ubiattach /dev/ubi_ctrl -m 1

ubimkvol /dev/ubi0 -s 104857600 -N rootfs

mount -t ubifs /dev/ubi0_0 /media

由于ubifs自身占用,不可能把128M全部使用,暂时只使用100M=104857600 Bytes。
~#flash_eraseall /dev/mtd1

Erasing 128 Kibyte @ 7fc0000 - 100% complete.

~ # ubiattach /dev/ubi_ctrl -m 1

UBI: attaching mtd1 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: empty MTD device detected

UBI: max. sequence number: 0

UBI: create volume table (copy #1)

UBI: create volume table (copy #2)

UBI: attached mtd1 to ubi0

UBI: MTD device name: "Partition 2"

UBI: MTD device size: 127 MiB

UBI: number of good PEBs: 919

UBI: number of bad PEBs: 103

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: 906

UBI: total number of reserved PEBs: 13

UBI: number of PEBs reserved for bad PEB handling: 9

UBI: max/mean erase counter: 0/0

UBI: image sequence number: -267629685

UBI: background thread "ubi_bgt0d" started, PID 868

~ # ubimkvol /dev/ubi0 -s 104857600 -N rootfs

~ # mount -t ubifs /dev/ubi0_0 /media

UBIFS: default file-system created

UBIFS: mounted UBI device 0, volume 0, name "rootfs"

UBIFS: file system size: 103606272 bytes (101178 KiB, 98 MiB, 803 LEBs)

UBIFS: journal size: 5160960 bytes (5040 KiB, 4 MiB, 40 LEBs)

UBIFS: media format: w4/r0 (latest is w4/r0)

UBIFS: default compressor: lzo

UBIFS: reserved for root: 4893579 bytes (4778 KiB)

~#
用ramdisk启动内核,通过usb将文件系统,复制到nand flash中。
ramdisk启动内核后,插入usb:
mount -t vfat /dev/uba1 /mnt
tar -zxvf /mnt/rootfs-busy1.20.tar.gz -C /media

然后,需要在文件系统中vi etc/init.d/rcS
加入如下:
/sbin/ubiattach /dev/ubi_ctrl -m 1
/bin/mount -t ubifs /dev/ubi0_0 /media/

reboot
u-boot,启动参数:
setenv bootargs ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs init=/linuxrc console=ttyS0,115200
内核成功启动。
ubifs移植成功以后,以后就可以抛弃yaffs2了。半个月的时间,终于把自制fs和ubifs移植到at91sam926x上,心情大好。

## Booting kernel from Legacy Image at 20400000 ...

Image Name: Linux-3.6.9

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1990904 Bytes = 1.9 MiB

Load Address: 20008000

Entry Point: 20008000

Verifying Checksum ... OK

Loading Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Booting Linux on physical CPU 0

Initializing cgroup subsys cpu

……

atmel_usart.0: ttyS0 at MMIO 0xfffff200 (irq = 17) is a ATMEL_SERIAL

console [ttyS0] enabled

atmel_usart.1: ttyS1 at MMIO 0xfffb0000 (irq = 22) is a ATMEL_SERIAL

atmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 23) is a ATMEL_SERIAL

……

Creating 2 MTD partitions on "atmel_nand":

0x000000000000-0x000000040000 : "Partition 1"

0x000000040000-0x000008000000 : "Partition 2"

UBI: attaching mtd1 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: max. sequence number: 58

UBI: attached mtd1 to ubi0

UBI: MTD device name: "Partition 2"

UBI: MTD device size: 127 MiB

UBI: number of good PEBs: 915

UBI: number of bad PEBs: 107

UBI: number of corrupted PEBs: 0

UBI: max. allowed volumes: 128

UBI: wear-leveling threshold: 4096

UBI:

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top