新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > at91sam9261-ubifs成功移植

at91sam9261-ubifs成功移植

作者: 时间:2016-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 ...

本文引用地址://www.cghlg.com/article/201612/325059.htm

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: number of internal volumes: 1

UBI: number of user volumes: 1

UBI: available PEBs: 39

UBI: total number of reserved PEBs: 876

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

UBI: max/mean erase counter: 2/1

UBI: image sequence number: 1228014130

UBI: background thread "ubi_bgt0d" started, PID 855

……

ohci_hcd: USB 1.1 Open Host Controller (OHCI) Driver

at91_ohci at91_ohci: AT91 OHCI

at91_ohci at91_ohci: new USB bus registered, assigned bus number 1

at91_ohci at91_ohci: irq 36, io mem 0x00500000

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

rtc-at91sam9 rtc-at91sam9.0: rtc core: registered rtc-at91sam9 as rtc0

i2c /dev entries driver

at91sam9_wdt: sorry, watchdog is disabled

at91_wdt: probe of at91_wdt failed with error -5

softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)

……

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

UBIFS: file system size: 108767232 bytes (106218 KiB, 103 MiB, 843 LEBs)

UBIFS: journal size: 5419008 bytes (5292 KiB, 5 MiB, 42 LEBs)

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

UBIFS: default compressor: lzo

UBIFS: reserved for root: 4952683 bytes (4836 KiB)

VFS: Mounted root (ubifs filesystem) on device 0:8.

Freeing init memory: 120K

running /etc/init.d/rcS

starting udevd...

cannot open /dev/null

udevd (898): /proc/898/oom_adj is deprecated, please use /proc/898/oom_score_adj instead.

/etc/init.d/rcS: line 21: /sbin/ubiattach: not found

dm9000 dm9000.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

Please press Enter to activate this console.


关键词: at91sam9261ubifs移

评论


技术专区

关闭