TQ2440内核linux2.6.28移植
生活随笔
收集整理的這篇文章主要介紹了
TQ2440内核linux2.6.28移植
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
轉自: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 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?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? ? ? ? ? ? ? ? ?[ ] 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文件系統的制作了。。。。。。。。。
總結
以上是生活随笔為你收集整理的TQ2440内核linux2.6.28移植的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 求高手指点,发现98五笔有几个字三级简码
- 下一篇: sql查询每科成绩的最高分_SQL查询每