Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1038862
  • 博文数量: 244
  • 博客积分: 6820
  • 博客等级: 准将
  • 技术积分: 3020
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 21:33
文章分类

全部博文(244)

文章存档

2013年(1)

2012年(16)

2011年(132)

2010年(3)

2009年(12)

2008年(80)

我的朋友

分类: LINUX

2008-09-09 23:32:25

 
 
 
 
 
 

linux 2.6.14支持yaffs2文件系统移植心得

[日期:2007-01-24] 来源:华恒嵌入式Linux技术论坛  作者: [字体: ]
以下为启动信息:
VIVI version 0.1.4 (root@localhost.localdomain) (gcc version 2.95.3 20010315 (release)) #0.1.4 Sat Apr 1 12:42:15 EST 2006
MMU table base address = 0x33DFC000
Succeed memory mapping.
+---------------------------------------------+
| S3C2410X USB Downloader ver R1.11 SEP/03/02 |
+---------------------------------------------+
FCLK=200MHz,DMA mode
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
formAT:
+++
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Found saved vivi parameters.
Press Return to start the now, any other key for vivi
Copy kernel from 0x00030000 to 0x30008000, size = 0x00100000 ... done
zImage magic = 0x016f2818
Setup parameters at 0x30000100
command line is: "noinitrd root=/dev/mtdblock/3 init=/rc console=ttySAC0"
MACH_TYPE = 193
NOW, Booting ......
Uncompressing ................................................................. done, booting the kernel.
version 2.6.14 (root@luofuchong.gdut) (gcc version 3.4.1) #5 Wed Jul 26 14:48:03 CST 2006

CPU: 920Tid(wb) [41129200] revision 0 (v4T)

Machine: SMDK2410

ATAG_INITRD is deprecated; please update your bootloader.

Memory policy: ECC disabled, Data cache writeback

CPU S3C2410A (id 0x32410002)

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

S3C2410 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

Kernel command line: noinitrd root=/dev/mtdblock/3 init=/rc console=ttySAC0

irq: clearing pending status 02000000

irq: clearing subpending status 00000002

PID hash table entries: 512 (order: 9, 8192 bytes)

timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8

Console: colour dummy device 80x30

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

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

Memory: 64MB = 64MB total

Memory: 62720KB available (1660K code, 290K data, 92K init)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

softlockup thread 0 started up.

NET: Registered protocol family 16

S3C2410: Initialising architecture

devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)

devfs: devfs_debug: 0x0

devfs: boot_options: 0x1

yaffs Jul 26 2006 14:37:50 Installing.

Console: switching to colour frame buffer device 80x25

fb0: Virtual frame buffer device, using 1024K of video memory

s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410

s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410

s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered

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

loop: loaded (max 8 devices)

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c2410-nand: mapped registers at c4980000

s3c2410-nand: timing: Tacls 10ns, Twrph0 40ns, Twrph1 10ns

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

Scanning device for bad blocks

Bad eraseblock 1884 at 0x01d70000

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

0x00000000-0x00020000 : "vivi"

0x00020000-0x00030000 : "param"

0x00030000-0x00130000 : "kernel"

0x00130000-0x00930000 : "root"

mice: PS/2 mouse device common for all mice

NET: Registered protocol family 2

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

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

TCP bind hash table entries: 4096 (order: 2, 16384 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP reno registered

TCP bic registered

NET: Registered protocol family 1

Root-NFS: No NFS server available, giving up.

VFS: Unable to mount root fs via NFS, trying floppy.

yaffs: dev is 32505859 name is "mtdblock3"

yaffs: Attempting MTD mount on 31.3, "mtdblock3"

Reading data from NAND FLASH without ECC is not recommended

VFS: Mounted root (yaffs filesystem).

Mounted devfs on /dev

Freeing init memory: 92K

Failed to execute /rc.  Attempting defaults...

Reading data from NAND FLASH without ECC is not recommended


init started:  BusyBox v0.60.5 (2003.09.05-09:25+0000) multi-call binary
Using /lib/input.o
insmod: kernel-module version mismatch
/lib/input.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/keybdev.o
insmod: kernel-module version mismatch
/lib/keybdev.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/mousedev.o
insmod: kernel-module version mismatch
/lib/mousedev.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/evdev.o
insmod: kernel-module version mismatch
/lib/evdev.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
/etc/init.d/rcS: /sbin/mount: No such file or directory
/etc/init.d/rcS: /sbin/mount: No such file or directory
/etc/init.d/rcS: /sbin/mount: No such file or directory
mkdir: Cannot create directory `/var': Cannot allocate memory
mkdir: Cannot create directory `/var': Cannot allocate memory
mkdir: Cannot create directory `/var': Cannot allocate memory
Using /lib/hid-core.o
insmod: kernel-module version mismatch
/lib/hid-core.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/usbmouse.o
insmod: kernel-module version mismatch
/lib/usbmouse.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/usbkbd.o
insmod: kernel-module version mismatch
/lib/usbkbd.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/mmcsd_core.o
insmod: kernel-module version mismatch
/lib/mmcsd_core.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/mmcsd_slot.o
insmod: kernel-module version mismatch
/lib/mmcsd_slot.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
Using /lib/mmcsd_disk.o
insmod: kernel-module version mismatch
/lib/mmcsd_disk.o was compiled for kernel version 2.4.18-rmk7-pxa1
while this kernel is version 2.6.14.
/etc/rc.d/init.d/netd: /sbin/inetd: No such file or directory
/etc/rc.d/init.d/httpd: /sbin/boa: No such file or directory
/etc/rc.d/init.d/leds: /sbin/led-player: No such file or directory
/etc/init.d/rcS: /sbin/ifconfig: No such file or directory
/etc/init.d/rcS: /sbin/ifconfig: No such file or directory

Please press Enter to activate this console.


BusyBox v0.60.5 Reading data from NAND FLASH without ECC is not recommended

(2003.09.05-09:25+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

[root@fa /]#

实在太兴奋了,郁闷了好几个星期了,终于搞掂了,原来一直是devfs搞鬼。发贴庆祝一下,等我整理好后再把详细过程发上来参考一下^_^2.6.14内核移植的总结

一、首先下载内核2.6.14和交叉编译工具3.4.1,详细参考这个文档:

可以看到其实要修改部分不多,主要是加上nandflash的支持和mtd分区表的填写(为了怕你们链接不上,把nandflash部分的修改拷贝下来),如下:
1.       修改arch\\mach-s3c2410\devs.c文件
增加头文件定义
/***********add here***********/
  #include  
#include  
#include  
/**************end add********/

增加nand flash分区信息
/***********add here***********/
static struct mtd_partition partition_info[] ={
{
name: "loader",
size: 0x00020000,
offset: 0,
}, {
name: "param",
size: 0x00010000,
offset: 0x00020000,
}, {
name: "kernel",
size: 0x001c0000,
offset: 0x00030000,
}, {
name: "root",
size: 0x00200000,
offset: 0x00200000,
mask_flags: MTD_WRITEABLE,
}, {
name: "user",
size: 0x03af8000,
offset: 0x00400000,
}
};

struct s3c2410_nand_set nandset ={
nr_partitions: 5 ,
partitions: partition_info ,
};

struct s3c2410_platform_nand superlpplatform={
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
/**************end add********/

struct platform_device s3c_device_nand = {
.name  = "s3c2410-nand",
.id  = -1,
.num_resources  = ARRAY_SIZE(s3c_nand_resource),
.resource  = s3c_nand_resource,

/***********add here****************/
.dev = {
.platform_data = &superlpplatform
}
/**************end here************/
};
2. 修改arch\\mach-s3c2410\mach-smdk2410.c文件
Startic struct platform_device *smdk2410_devices[] __initdata={
&s3c_device_usb,
&s3c_device_lcd;
&s3c_device_wdt,
&s3c_device_i2c;
&s3c_device_iis,
&s3c_device_nand, /*add here*/
};

注:分区表信息要根据你板上的实际来填写,我的就只分了4个区^_^。

二、为了支持yaffs2文件系统,需要帮内核加上对yaffs2文件系统的支持,详细请看这个贴:

主要是把yaffs2文件系统的文件拷贝到fs目录,并修改Makefile 和 Kconfig文件。

在配置方面有些地方要注意一下,以下是我的配置信息:

1,首先make menuconfig,进入配置窗口,然后选择”load an Alternate Configuration File”
把arch//configs/smdk2410_defconfig配置文件load进来。

2,进入Device Drivers->Memory Technology Devices(MTD)目录,配置界面如下:
Memory Technology Device (MTD) support
[ ]   Debugging                                                          │ │
[ ]   MTD concatenating support                                          │ │
[*]   MTD partitioning support                                           │ │
[ ]     RedBoot partition table parsing                                  │ │
[ ]     Command line partition table parsing                             │ │
[ ]     Firmware Suite partition parsing                             │ │
---   User Modules And Translation Layers                                │ │
[*]   Direct char device access to MTD devices                           │ │
[*]   Caching block device access to MTD devices                         │ │
[ ]   FTL (Flash Translation Layer) support                              │ │
[ ]   NFTL (NAND Flash Translation Layer) support                        │ │
[ ]   INFTL (Inverse NAND Flash Translation Layer) support               │ │
RAM/ROM/Flash chip drivers  --->                                   │ │
Mapping drivers for chip access  --->                              │ │
Self-contained MTD device drivers  --->                            │ │
NAND Flash Device Drivers  --->                                    │ │

3,进入NAND Flash Device Drivers目录,配置界面如下:
[*] NAND Device Support                                              │ │
[ ]   Verify NAND page writes                                        │ │
[*] NAND Flash support for S3C2410/S3C2440 SoC                       │ │
[*]   S3C2410 NAND driver debug                                      │ │
[ ]   S3C2410 NAND Hardware ECC                                      │ │
[ ] DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplement│ │
[ ] Support for NAND Flash Simulator                                 │ │

回到File systems->Miscellaneous filesystems目录,配置信息如下:
[*] YAFFS2 file system support                                               │ │
---   512 byte / page devices                                                │ │
[*]     Lets Yaffs do its own ECC                                            │ │
[*]       Use the same ecc byte order as Steven Hill's nand_ecc.c            │ │
---   2048 byte (or larger) / page devices                                   │ │
[*]     Autoselect yaffs2 format                                             │ │
[*]     Disable lazy loading                                                 │ │
[*]   Turn off wide tnodes                                                   │ │
[*]   Turn off debug chunk erase check                                       │ │
[*]   Cache short names in RAM

可以看到,我基本上把yaffs2的所有选项都选了,因为我还不知道哪些是必要的^_^
差不多了,其它就按照默认的吧。

三、现在轮到郁闷我了很久的devfs的问题,因为2.6.12内核以后取消了devfs的配置选项,具体为了什么我不清楚,不过缺少了它内核问题抱怨找不到mtdblock设备,以下是hn斑竹提供的解决方法:

在他给的pdf文件里面有介绍,不过好像我试过打开不了链接,不知道什么原因,不过不怕,我把里面的内容拷贝出来就是了:

从2.6.12的fs/Kconfig中拷贝下面几项到2.6.14的fs/Kconfig中去:

config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
depends on EXPERIMENTAL
help
This is support for devfs, a virtual file system (like /proc) which
provides the file system interface to device drivers, normally found
in /dev. Devfs does not depend on major and minor number
allocations. Device drivers register entries in /dev which then
appear automatically, which means that the system administrator does
not have to create character and block special device files in the
/dev directory using the mknod command (or MAKEDEV script) anymore.
This is work in progress. If you want to use this, you *must* read
the material in , especially
the file README there.
Note that devfs no longer manages /dev/pts! If you are using UNIX98
ptys, you will also need to mount the /dev/pts filesystem (devpts).
Note that devfs has been obsoleted by udev,
.
It has been stripped down to a bare minimum and is only provided for
legacy installations that use its naming scheme which is
unfortunately different from the names normal installations
use.
If unsure, say N.

config DEVFS_MOUNT
bool "Automatically mount at boot"
depends on DEVFS_FS
help
This option appears if you have CONFIG_DEVFS_FS enabled. Setting
this to 'Y' will make the kernel automatically mount devfs onto /dev
when the system is booted, before the init thread is started.
You can override this with the "devfs=nomount" boot option.
If unsure, say N.

config DEVFS_DEBUG
bool "Debug devfs"
depends on DEVFS_FS
help
If you say Y here, then the /dev file system code will generate
debugging messages. See the file
for more
details.
If unsure, say N.


重新make menuconfig 在File systems->Pseudo filesystems目录里面可以后到devfs的配置选项如下:
[*] /proc file system support                                          │ │
[*] /dev file system support (OBSOLETE)                                │ │
[*]   Automatically mount at boot                                      │ │
[*]   Debug devfs                                                      │ │
[*] Virtual memory file system support (former shm fs)                 │ │
[ ] Relayfs file system support

好了,应该完成了,保存配置后,make 生成的zImage下载到flash中就可以成功挂载yaffs2文件系统了(我现在用的是原来2.4内核用的yaffs2文件系统,所以,我现在只是帮我的板换了个2.6的内核而已,下一步打算搞一个属于自己的文件系统,呵呵)。

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