----------------------编译内核-----------------
修改 Makefile
主要是以下两项:
1 ) ARCH = arm
2) CROSS_COMPILE = /arm-linux-
选中 load an Alternate Configuration File ,然后键入配置文件的路径。
在我刚编译内核的时候选择的是 linux-2.6.14/arch/arm/configs/smdk2410_defconfig 这个配置文件。
-------------------让内核支持 yaffs 文件系统----------
1. MTD 分区的支持
进入Device Drivers->Memory Technology Devices(MTD)目录,配置界面如下:
Memory Technology Device (MTD) support
[ ] Debugging │ │
[ ] MTD concatenating support │ │
进入NAND Flash Device Drivers目录,配置界面如下:
其它不用多设,甚至 Direct char device access to MTD devices 选项和Mapping drivers for chip access ---> 目录下的所有选项都可以去掉(经已试验过) 。因为那些是为 nor flash 服务的,一般文件系统都会放在 nand flash 上吧,不过也不排除例外。那你就干脆让它们留着好了,因为编译出来后实在多不了多少,我把它们去掉的原因只是为了试验 ^_^
-----------------------添加驱动---------------------
vi arch/arm/mach-s3c2410/devs.c
添加如下内容:
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <asm/arch/nand.h>
...
/* NAND Controller */
1.建立Nand Flash分区表
/* 一个Nand Flash总共64MB, 按如下大小进行分区 */
static struct mtd_partition partition_info[] ={
[0] = {
.name = "bootloader",
.offset = 0x00000000,
.size = 0x00030000,
},
[1] = {
.name = "kernel",
.offset = 0x00030000,
.size = 0x00200000,
},
[2] = {
.name = "root",
.offset = 0x00230000,
.size = 0x03dcc000,
}
};
注:分区表信息要参考你自己的内核和文件系统的大小,排布来设置,vivi中的分区信息要和mtd分区信息一致,分多少个区由你自己决定,
2. 加入Nand Flash分区
struct s3c2410_nand_set nandset ={
nr_partitions: 3, /* the number of partitions */
partitions: partition_info, /* partition table */
};
nr_partitions: 指明partition_info中定义的分区数目
partitions: 分区信息表
3. 建立Nand Flash芯片支持
struct s3c2410_platform_nand superlpplatform={
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
4. 加入Nand Flash芯片支持到Nand Flash驱动
另外,还要修改此文件中的s3c_device_nand结构体变量,添加对dev成员的赋值
struct platform_device s3c_device_nand = {
.name = "s3c2410-nand",
/* Device name */
.id = -1,
/* Device ID */
.num_resources = ARRAY_SIZE(s3c_nand_resource),
.resource = s3c_nand_resource, /* Nand Flash Controller Registers */
/* Add the Nand Flash device */
.dev = {
.platform_data = &superlpplatform
}
};
/*----------------------禁止Flash ECC校验(yaffs系统好像不用)---------
vi drivers/mtd/nand/s3c2410.c
找到s3c2410_nand_init_chip()函数,在该函数体最后加上一条语句:
chip>
eccmode = NAND_ECC_NONE;
保存,退出。*/
----------------------------指定启动时初始化--------------
kernel启动时依据我们对分区的设置进行初始配置修改arch/arm/mach-s3c2410/mach-smdk2410.
static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
/* 添加如下语句即可 */
&s3c_device_nand,
};
--------------------内核加上对yaffs2支持-----------------
下载yaffs2.tar.gz源码包,解压源码,并进入目录执行
#./patch-ker.sh /linux-2.6.14.1/
File systems->Miscellaneous filesystems 目录,配置信息如下:
在这里要说明一下以上的配置,在论坛发贴的时候我因为对它不怎么了解,几乎是全部选上的。后来经过自己的理解和摸索,发现:
1、 --- 2048 byte (or larger) / page devices 目录以下全部不用选,因为这是 yaffs2 文件系统的,如果你是用 yaffs 文件系统的话就不必选择这个了 ( 我到现在还没去研究 yaffs2 比 yaffs 文件系统优越多少,反正 yaffs 文件系统用得好好的 )
2、 Lets Yaffs do its own ECC 这一项,网上很多人说 yaffs 文件系统和 mtd 驱程的更新速度问题,导致加上 ecc 检测后,会挂不了 yaffs 文件系统,所以要把 mtd 驱程的 ecc 检测去掉,让 yaffs 自己做 ecc 检测(就是要选上这一项)。不过去掉 mtd 驱程 ecc 检测的后果就是换来烦人的 Reading data from NAND FLASH without ECC is not recommended 的提示,后来发现原来把 mtd 驱程的 ecc 检测加回去,也可以很好的支持 yaffs 文件系统,所以就把这一项去掉了,终于可以不用再看那烦人的提示了 ^_^
-----------------------devfs-----------------------
拷贝下面几项到2.6.14的fs/Kconfig中去:
找到menu "Pseudo filesystems"
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
depends on EXPERIMENTAL
help
config DEVFS_MOUNT
bool "Automatically mount at boot"
depends on DEVFS_FS
help
config DEVFS_DEBUG
bool "Debug devfs"
depends on DEVFS_FS
help
重新make menuconfig 在File systems->Pseudo filesystems目录里面可以后到devfs的配置选项如下:
保存。
make zImage。(附上自己的zImage)
启动信息:
VIVI version 0.1.4 (root@localhost.localdomain) (gcc version 2.95.3 20010315 (release)) #0.1.4 Wed Sep 13 21:06:12 EDT 2006
MMU table base address = 0x33FBC000
Succeed memory mapping.
+---------------------------------------------+
| YC2410 USB Downloader ver R2.00 06-12-08 |
+---------------------------------------------+
FCLK=200MHz,DMA mode
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Could not found stored vivi parameters. Use default vivi parameters.
Press Return to start the LINUX/Wince now, any other key for vivi
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root="31:2" init="/linuxrc" console="ttySAC0""
MACH_TYPE = 193
NOW, Booting Linux......
Uncompressing Linux................................................................................. done, booting the kernel.
Linux version 2.6.14 (root@localhost.localdomain) (gcc version 3.4.1) #34 Sat Mar 21 03:29:48 CST 2009
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
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
USB Control, (c) 2006 s3c2410
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="31:2" init="/linuxrc" console="ttySAC0"
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: 62208KB available (1998K code, 475K data, 104K 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
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
yaffs Mar 20 2009 22:17:07 Installing.
Console: switching to colour frame buffer device 40x30
fb0: s3c2410fb frame buffer device
fb1: 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
usbcore: registered new driver ub
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
Linux video capture interface: v1.00
V4L-Driver for Vision CPiA based cameras v1.2.3
Since in-kernel colorspace conversion is not allowed, it is disabled by default now. Users should fix the applications in case they don't work without conversion reenabled by setting the 'colorspace_conv' module parameter to 1<6>USB driver for Vision CPiA based cameras v1.2.3
usbcore: registered new driver cpia
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
Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00030000 : "bootloader"
0x00030000-0x00230000 : "kernel"
0x00230000-0x03ffc000 : "root"
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
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
usbcore: registered new driver ov511
drivers/usb/media/ov511.c: v1.64 for Linux 2.5 : ov511 USB Camera Driver
drivers/usb/media/spca5xx/spca_core.c: USB SPCA5XX camera found. Type Vimicro Zc301P 0x301b
usbcore: registered new driver spca5xx
drivers/usb/media/spca5xx/spca_core.c: spca5xx driver 00.57.06LE registered
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
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
VFS: Mounted root (yaffs filesystem).
Mounted devfs on /dev
Freeing init memory: 104K
init started: BusyBox v1.9.2 (2009-03-19 21:06:33 CST)
starting pid 703, tty '': '/etc/init.d/rcS'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^ Welcome to YAFFS root filesystem! ^
^ Qiu ^
^^^^^^^^^^^^^^^^09-3-18^^^^^^^^^^^^^^^^^^^^
# mount all...........
# Starting mdev.........
starting pid 711, tty '': '/bin/sh'
[root@Qiu /]#
用户377235 2012-6-15 15:22
thanks
用户377235 2012-5-2 09:39
用户603678 2012-4-7 20:02
用户377235 2012-3-31 11:17
用户1679196 2009-8-27 17:55
用户1679196 2009-8-14 15:56
用户44267 2009-8-14 14:12
用户1679196 2009-6-11 11:34
用户211975 2009-6-9 19:30
用户1679196 2009-4-22 10:32