1、主机环境:VMare下ubuntu10.04 ,1G内存。
2、编译编译环境:arm-linux-gcc
3、开发板:Micro2440,2M nor flash,256M nand flash。
4、u-boot-version:u-boot-2010.06
5、linux -version:Linux-2.6.39
2.1、yaffs2文件系统移植
a)获取yaffs2 源代码
针对嵌入式设备,现在大部分开发板都可以支持yaffs2 文件系统,特别是使用nand flash 作为存储器的嵌入式设备而创建的一种文件系统,早先的yaffs 仅支持小页(512byte/page)的nand flash,现在的开发板大都配备了更大容量的nand flash,它们一般是大页模式的(2K/page),使用yaffs2 就可以支持大页的nand flash,下面是yaffs2 的移植详细步骤。root@bootloader:/home/eilian/development# apt-get install git-core
root@bootloader:/home/eilian/development# git clone git://www.aleph1.co.uk/yaffs2
Initialized empty Git repository in /home/eilian/development/yaffs2/.git/
remote: Counting objects: 6632, done.
remote: Compressing objects: 100% (3921/3921), done.
remote: Total 6632 (delta 5268), reused 3394 (delta 2642)
Receiving objects: 100% (6632/6632), 3.35 MiB | 59 KiB/s, done.
Resolving deltas: 100% (5268/5268), done.
root@bootloader:/home/eilian/development#ls
Android Bootloader Linux Tools workspace yaffs2
root@bootloader:/home/eilian/development#cdyaffs2
b)为内核打补丁
root@bootloader:/home/eilian/development/yaffs2#./patch-ker.sh c s ../Linux/linux-2.6.39
c)配置内核
root@bootloader:/home/eilian/development/Linux/linux-2.6.39# make menuconfig //在之前加载缺省文件的前提下
移动上下按键找到File Systems,如图
按回车进入该子菜单,再找到“Miscellaneous filesystems”菜单项,如图
按回车进入该子菜单,找到“YAFFS2 file system support”,如图
按空格选中它,这样我们就在内核中添加了yaffs2 文件系统的支持,按“Exit”退出内核配置。最好选中“Yes”保存
2.2、编译测试
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make clean
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make uImage
打开超级终端下载内核运行
U-Boot 2010.06 (Dec 03 2011 - 12:10:06)
DRAM: 64 MiB
Flash: 2 MiB
NAND: dev_id = 218
NAND 256MiB 3,3V 8-bit256 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
Device nand0 not found!
Hit any key to stop autoboot: 0
bootloader# printenv
bootargs=noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 mem=64M
bootcmd=nboot 0x32000000 kernel; bootm 0x32000000
bootdelay=3
baudrate=115200
ethaddr=08:00:3e:26:0a:5b
netmask=255.255.255.0
ethact=dm9000
mtdids=nand0=nandflash0
mtdparts=mtdparts=nandflash0:1m@0(bootloader),128k(params),5m(kernel),-(root)
ipaddr=211.67.217.138
serverip=211.67.217.136
gatewayip=211.67.217.1
stdin=serial
stdout=serial
stderr=serial
Environment size: 428/131068 bytes
bootloader# tftp 32000000 uImage
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
operating at unknown: 0 mode
Using dm9000 device
TFTP from server 211.67.217.136; our IP address is 211.67.217.138
Filename 'uImage'.
Load address: 0x32000000
Loading: T #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#####################################
done
Bytes transferred = 2182288 (214c90 hex)
bootloader# bootm 32000000
## Booting kernel from Legacy Image at 32000000 ...
Image Name: Linux-2.6.39
Created: 2011-12-02 12:29:08 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2182224 Bytes = 2.1 MiB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@bootloader) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #3 Fri Dec 2 20:27:45 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: eilian240 development board
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 mem=64M
PID hash table entries: 256 (order: -2, 1024 bytes)
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: 60384k/60384k available, 5152k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc4800000 - 0xf6000000 ( 792 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0029000 ( 132 kB)
.text : 0xc0029000 - 0xc040a654 (3974 kB)
.data : 0xc040c000 - 0xc042fe00 ( 144 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
gpiochip_add: gpios 288..303 (GPIOK) failed to register
gpiochip_add: gpios 320..334 (GPIOL) failed to register
gpiochip_add: gpios 352..353 (GPIOM) failed to register
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
bio: create slab
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.24.
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
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 117
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 5 MTD partitions on "nand":
0x000000000000-0x000000100000 : "bootloader"
0x000000100000-0x000000120000 : "params"
0x000000120000-0x000000620000 : "kernel"
0x000000620000-0x000040620000 : "root"
mtd: partition "root" extends beyond the end of device "nand" -- size truncated to 0xf9e0000
0x000000000000-0x000010000000 : "nand"
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
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
usbcore: registered new interface driver libusual
mousedev: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 132K
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[
[
[
[