Chinaunix首页 | 论坛 | 博客
  • 博客访问: 188647
  • 博文数量: 20
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 405
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-19 13:00
文章分类
文章存档

2011年(1)

2009年(18)

2008年(1)

我的朋友

分类: LINUX

2009-03-14 19:59:59

   在建立文件系统时,2.6.22.1内核挂载yaffs文件系统老是出错,采用cramfs又不能写,所以就决定采用jffs2了。具体方法就是将这个建立好的根文件系统制作成jffs2镜像,烧到FLASH中,改改Linux的启动参数即可。

 

1.下载jffs2制作工具源码mtd-utils-1.1.0.tar.bz2

2. 解压后编译

#Tar –jxvf  mtd-utils-1.1.0.tar.bz2 

#cd mtd-utils-05.07.23

#cd util

#make

生成的mkfs.jffs2即为制作jffs2文件系统的工具

3. 制作根文件系统的JFFS2镜像

# mkfs.jffs2  -r /home/nick/rootfs -o rootfs.jffs2 -e 0x4000 --pad=0x800000 –n

各参数的意义:
(1)-r
:指定要做成image的文件夹
.
(2)-o :
指定输出image档案的文件名
.
(3)-e :
每一块要抹除的block size,预设是64KB.要注意,不同的flash, block size会不一样.我的是三星的
K9F1208U0B.
(4)--pad
-p: 16进制来表示所要输出文件的大小,也就是root.jffs2的大小。很重要的是, 为了不浪费flash空间, 这个值最好符合flash driver所规划的区块大小.这里使用的是
8MB.
(5)
如果挂载后会出现类似:CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0 的警告,则加上 -n 就会消失。

(6)
还有的选项,自己看帮助!-h

4. 烧写JFFS2镜像到NAND FLASH

rootfs.jffs2下载到NAND FLASH,然后启动开发板。

出现错误:

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e154: 0xfbeb instead

开始在网上找原因,后来才知道是因为flash的未使用空间不是全0xff的原因,可以在加载jffs2.img之前,用eraseall对整个mtd设备擦除,或者,在用mk.jffs2生成image的时候,用-p选项填充所有未使用空间为0xff

 

所以我用DNW擦除了文件系统所在的那个分区,重新下载启动开发板,OK!成功!

Uncompressing Linux.................................................................................................... done, booting the kernel.

Linux version 2.6.22.1 (nick@localhost.localdomain) (gcc version 3.4.1) #38 Sat Mar 14 19:19:03 CST 2009

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177

Machine: SMDK2410

Warning: bad configuration page, trying to continue

Memory policy: ECC disabled, Data cache writeback

CPU S3C2410A (id 0x32410002)

S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz

S3C24XX Clocks, (c) 2004 Simtec Electronics

CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on

CPU0: D VIVT write-back cache

CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets

Built 1 zonelists.  Total pages: 16256

Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc rootfstype=jffs2 init=/linuxrc console=ttySAC0 115200 mem=64M

irq: clearing subpending status 00000093

irq: clearing subpending status 00000092

PID hash table entries: 256 (order: 8, 1024 bytes)

timer tcon=00090d00, tcnt a2c1, tcfg 00000200,00001030, usec 00001eb8

Console: colour dummy device 80x30

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 61628KB available (2828K code, 287K data, 124K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

NET: Registered protocol family 16

S3C2410 Power Management, (c) 2004 Simtec Electronics

S3C2410: Initialising architecture

S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics

DMA channel 0 at c4800000, irq 33

DMA channel 1 at c4800040, irq 34

DMA channel 2 at c4800080, irq 35

DMA channel 3 at c48000c0, irq 36

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NetWinder Floating Point Emulator V0.97 (double precision)

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

JFFS2 version 2.2. (NAND) 2001-2006 Red Hat, Inc.

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler deadline registered

io scheduler cfq registered

s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach

s3c2410-lcd: probe of s3c2410-lcd failed with error -22

s3c2410-led initialized

lp: driver loaded but no devices found

ppdev: user-space parallel port driver

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled

s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410

s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410

s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

loop: module loaded

Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)

eth0: CS8900A rev E at 0xe0000300 irq=53, no eeprom , addr: 08: 0:3E:26:0A:5B

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx

BAST NOR-Flash Driver, (c) 2004 Simtec Electronics

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c2410-nand s3c2410-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns

NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)

NAND_ECC_NONE selected by board driver. This is not recommended !!

Scanning device for bad blocks

Bad eraseblock 6 at 0x00018000

Bad eraseblock 7 at 0x0001c000

Bad eraseblock 8 at 0x00020000

Bad eraseblock 9 at 0x00024000

Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":

0x00000000-0x00040000 : "Boot"

ftl_cs: FTL header not found.

0x00040000-0x00300000 : "kernel"

ftl_cs: FTL header not found.

0x00300000-0x02000000 : "Rootfs"

ftl_cs: FTL header not found.

0x02000000-0x04000000 : "User"

ftl_cs: FTL header not found.

usbmon: debugfs is not available

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

mice: PS/2 mouse device common for all mice

S3C24XX RTC, (c) 2004,2006 Simtec Electronics

s3c2410-i2c s3c2410-i2c: slave address 0x10

s3c2410-i2c s3c2410-i2c: bus frequency set to 390 KHz

s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter

TCP cubic registered

NET: Registered protocol family 1

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Empty flash at 0x0046fde8 ends at 0x0046fe00

Empty flash at 0x013b4c2c ends at 0x013b4e00

VFS: Mounted root (jffs2 filesystem).

Freeing init memory: 124K

 

init started: BusyBox v1.9.2 (2009-03-13 15:19:05 CST)

 

starting pid 738, tty '': '/etc/init.d/rcS'

/etc/init.d/rcS: line 2: ./etc/host: Permission denied

(none)

*****************mount all**********

*****************Starting mdev******

************************************

*******nick's rootfs 2009.3*********

*********************

************************************

 

starting pid 747, tty '': '/bin/sh'

 

Processing /etc/profile... Set search library path in /etc/profile

Set user path in /etc/profile

Set PS1 in /etc/profile

Done

 

[root@ /]#JFFS2 notice: (736) check_node_data: wrong data CRC in data node at 0x013b5000: read 0x4f1f99be, calculated 0x85ca45db.

[root@ /]#ls

bin      dev      home     linuxrc  proc     sbin     tmp      var

boot     etc      lib      mnt      root     sys      usr

 

本次移植的主要参考:http://blog.chinaunix.net/u1/34474/showart.php?id=486604

在这里衷心的感谢作者!

阅读(2958) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~