转自:http://blog.sina.com.cn/s/blog_95268f5001013ibg.html
内核的移植,是在u-boot的基础上进行的,所以u-boot在这之前一定要先弄好才好
怎样下载源码就不说了,下载后进入内核根目录/linux-2.6.28,修改根目录下Makefile大概193行改成下面这样:193 ARCH ?= arm
194 CROSS_COMPILE ?=arm-linux-
接着进入这个目录linux-2.6.28/arch/arm/configs(如果没有就从网上下载补丁),在该目录下面可以看到
s3c2410_defconfig这个文件,这个就是我们要用到的默认配置文件,这是在内核根目录下执行
linux-2.6.28# make s3c2410_defconfig
#
# configuration written to .config
#
这样我们就建立起默认.config文件
接下来
linux-2.6.28#make menuconfig进入配置界面
┌────────────────────────────────────── System Type ───────────────────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted letters are │
│ hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes features. Press │
│ <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] built-in [ ] excluded │
│ <M> module < > module capable │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ ARM system type (Samsung S3C2410, S3C2412, S3C2413, S3C2440, S3C2442, S3C2│ │
│ │ [*] PWM device support │ │
│ │ -*- S3C2410 DMA support │ │
│ │ [ ] S3C2410 DMA support debug │ │
│ │ [*] ADC common driver support │ │
│ │ *** Boot options *** │ │
│ │ [ ] S3C Initialisation watchdog │ │
│ │ [*] S3C Reboot on decompression error │ │
│ │ [*] Force UART FIFO on during boot process │ │
│ │ *** Power management *** │ │
│ │ [ ] S3C2410 PM Suspend debug │ │
│ │ [ ] S3C2410 PM Suspend Memory CRC │ │
│ │ (0) S3C UART to use for low-level messages │ │
│ │ (0) Space between gpio banks │ │
│ │ S3C2400 Machines ---> │ │
接下来
(1)
System Type --->
S3C2410 Machines --->
[*] SMDK2410/A9M2410
[ ] IPAQ H1940
[ ] Acer N30
[ ] Simtec Electronics BAST (EB2410ITX)
[ ] NexVision OTOM Board
[ ] AML M5900 Series
[ ] Thorcom VR1000
[ ] QT2410
S3C2412 Machines --->
[ ] SMDK2413
[ ] SMDK2412
[ ] VMSTMS
S3C2440 Machines --->
[ ] Simtec Electronics ANUBIS
[ ] Simtec IM2440D20 (OSIRIS) module
[ ] HP iPAQ rx3715
[*] SMDK2440
[ ] NexVision NEXCODER 2440 Light Board
[*] SMDK2440 with S3C2440 CPU module
S3C2442 Machines --->
[ ] SMDM2440 with S3C2442 CPU module
S3C2443 Machines --->
[ ] SMDK2443
(2)在配置菜单中添加自己信息
General setup --->
(-EmbedSky) Local version - append to kernel releas
[*] System V IPC
(17) Kernel log buffer size (16 => 64KB, 17 => 128KB)
(3)选择是否支持EABI
Kernel Features --->
[ ] Preemptible Kernel (EXPERIMENTAL)
[ ] Dynamic tick timer
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTA)
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTA)
Memory model (Flat Memory) --->
[ ] 64 bit Memory and IO resources (EXPERIMENTAL)
196 static void __init smdk2440_map_io(void)
197 {
198 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
上面红色部分如果是使用4.3.3(也就是支持EABI)编译链就选它,3.4.5以下就不用选
到了这里就差不多配置完了,要改动的不是很多,还要配置的下面再配,这时保存推出就可以了。
由于我们2440的晶振是12M的,而默认中不是这样,所以下面要改晶振,在arch/arm/mach-s3c2440/mach-smdk2440.c这个文件里改,如下:
199 s3c24xx_init_clocks(12000000);
200 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
201 }
接下来修改机器码,在U-boot中用了168,所以这里也要改
在arch/arm/tools/mach-types文件里,改成如下:
379 s3c2440 ARCH_S3C2440 S3C2440 168
到了这里,就差不多了,这时make uImage生成uImage镜像
没有错的话会在arch/arm/boot生成uImage和zzimage
顺利的话如下:
Created: 2012-05-08 10:53:36 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1767580 Bytes = 1.7 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux................................................................................................................. done, booting the kernel.
Linux version 2.6.28-EmbedSky (root@www) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #17 Tue May 8 18:53:22 CST 2012
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: TQ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 400.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
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
irq: clearing pending ext status 00080000
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8
Console: colour dummy device 80x30
console [ttySAC0] enabled
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: 61108KB available (3248K code, 363K data, 124K init)
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 484 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
SCSI subsystem initialized
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
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (extended precision)
JFFS2 version 2.2. (NAND) (SUMMARY) 漏 2001-2006 Red Hat, Inc.
yaffs May 5 2012 13:02:57 Installing.
msgmni has been set to 119
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 60x34
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver4 ports, IRQ sharing enabled
s3c2440-uart.0: tq2440_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: tq2440_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: tq2440_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver, V1.31
Uniform Multi-Platform E-IDE driver
ide-gd driver 1.18
ide-cd driver 5.00
Driver 'sd' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 30ns Twrph0=7 70ns, Twrph1=3 30ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 1785 at 0x0df20000
Bad eraseblock 1811 at 0x0e260000
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00040000 : "u-boot" (原来不是这样,要改了分区才行可以按照你喜欢的改,下面说)
0x00200000-0x00400000 : "krenel"
0x00400000-0x00c00000 : "jffs2"
0x00c00000-0x10000000 : "yaffs2"
usbmon: debugfs is not available
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
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver ftdi_sio
ftdi_sio: v1.4.3:USB FTDI Serial Converters Driver
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
yaffs: dev is 32505859 name is "mtdblock3"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.3, "mtdblock3"
yaffs: auto selecting yaffs2
block 1690 is bad
block 1716 is bad
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem).(由于我的yaffs2已近弄好了(下面会说),所以会这样它会挂载yaffs2不过这个分区没有yaffs2系统所以文件系统没起来)
Freeing init memory: 124K
Warning: unable to open an initial console.
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
下面来建立flash分区,这里的分区最好与我们在u-boot时分区对应,当然也可以不一样的,只是为了方便
在vim arch/arm/plat-s3c24xx/common-smdk.c文件里就可以修改自己喜欢的分区,如下:
109 static struct mtd_partition smdk_default_nand_part[] = {
110 [0] = {
111 .name = "u-boot",
112 .size = 0x40000,
113 .offset = 0x00000000,
114 },
115 [1] = {
116 .name = "krenel",
117 .offset = 0x200000,
118 .size = 0x200000,
119 },
120 [2] = {
121 .name = "jffs2",
122 .offset = 0x400000,
123 .size = SZ_8M,
124 },
125 [3] = {
126 .name ="yaffs2",
127 .offset = MTDPART_OFS_APPEND,
128 .size = MTDPART_SIZ_FULL,
129 }
然后还要修改nand flash读写匹配时间,在同一个文件里改
145 static struct s3c2410_platform_nand smdk_nand_info = {
146 .tacls = 10,
147 .twrph0 = 25,
148 .twrph1 = 10,
149 .nr_sets = ARRAY_SIZE(smdk_nand_sets),
150 .sets = smdk_nand_sets,
151 };
152
接下来还要修改 drivers/mtd/nand/Kconfig 增加对各种nand flash支持,如下
165 choice
166 prompt"Nand Flash Capacity select"
167 depends on MTD
168 help
169 EmbedSKy Board Nand Flash Capacity select
170 config EmbeddSky_64MB_NAND
171 boolean "64MB Nand for EmbedSky Board"
172 depends on MTD
173 help
174 Set 64MB Nand parts
175 config EmbeddSky_128MB_NAND
176 boolean "128MB Nand for EmbedSky Board"
177 depends on MTD
178 help
179 Set 128MB Nand parts
180 config EmbeddSky_more_than_256MB__NAND
181 boolean "256MB~1GB Nand for EmbedSky Board"
182 depends on MTD
183 help
184 Set 256MB~1GB Nand parts
185 endchoice
增加对应驱动配置,再次执行make menucofig进入配置界面
Device Drivers --->
<*> Memory Technology Device (MTD)support
<*> NAND Device Support --->
[*] S3C2410 NAND HardwareECC
Nand Flash Capacity select (256MB~1GB Nand for EmbedSky Board) --->
这时从新编译就好了
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00040000 : "u-boot"
0x00200000-0x00400000 : "krenel"
0x00400000-0x00c00000 : "jffs2"
0x00c00000-0x10000000 : "yaffs2"
usbmon: debugfs is not available
接下来移植yaffs文件系统
(1)可以从www.alephl.co.uk/cgi-bin/viewcvs.cgi/获得源码
(2)将yaffs代码加进内核(打补丁就行)
首先进入你下载yaffs2所在目录,我的是#/work/cvs/yaffs2,然后执行如下命令
#./patch-ker.sh c /work/linux-2.6.28
这样就行了
(3)接下来就是配置增加对yaffs2的支持了
#make menuconfig
File systems --->
Miscellaneous filesystems --->
<*> YAFFS2 file system support
要打上补丁才会有这个选择的。
到了这里yaffs2文件系统移植完了。。。。。。。
接下来就是yaffs2文件系统的制作了。。。。。。。。。
239

被折叠的 条评论
为什么被折叠?



