日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux开发环境 tq2440,Linux2.6.35在TQ2440的移植过程(一)

發(fā)布時(shí)間:2023/12/20 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux开发环境 tq2440,Linux2.6.35在TQ2440的移植过程(一) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Linux2.6.35在TQ2440的移植過程(一)

本文為原創(chuàng),版本歸作者:Machoe . Yang所有。如需轉(zhuǎn)載,請注明:

環(huán)境:

硬件平臺(tái):TQ2440

軟件平臺(tái):VM7.1Fedora10arm-linux-gcc-4.3.3Linux2.6.35版本源碼天嵌科技提供的u-boot2010.06版

一、獲取并解壓源碼

本人一直習(xí)慣從下載源碼,極為方便,本次移植選則的源碼為Linux2.6.35版本。下載后,將源碼保存在了/opt/kernel/目錄下。

成功得到源碼后,開始對其解壓:、

tar xvfj linux2.6.35.tar.bz2 –C ./

當(dāng)解壓過程結(jié)束后,即可在當(dāng)前目錄下看到:

root@EmbedSky kernel]# ls

cvslinux-2.6.25.8linux-2.6.30.4linux-2.6.35linux-2.6.35.4.tar.bz2

cvs-root.tar[1]linux-2.6.25.8.tar.bz2linux-2.6.30.4.tar.bz2linux-2.6.35.4linux-2.6.35.tar.bz2

二、修改Makefile文件添加對arm平臺(tái)的支持

修改頂層Makefile文件,VIMMakefile。修改其文件的第191、192兩行,修改后:

191 ARCH?= arm

192 CROSS_COMPILE?= arm-linux-

至于第193行的CORSS_COMPILE選項(xiàng)這里我們可以不用理會(huì),它是在配置內(nèi)核時(shí)用到的,只需改前面兩項(xiàng)即可。

三、修改部分源碼以支持TQ2440平臺(tái)

1.修改平臺(tái)時(shí)鐘

修改arch/arm/mach-s3c2440/mach-smdk2440.c文件的第163行,將16000000改成12000000即可。

160 static void __init smdk2440_map_io(void)

161 {

162s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));

163s3c24xx_init_clocks(12000000);

164s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));

165 }

2.修改機(jī)器碼與u-boot保持一致

修改arch/arm/tools/mach-types文件的第379行,將最后的362修改成為168

379s3c2440ARCH_S3C2440S3C2440168

此處修改的機(jī)器碼會(huì)在文件arch/arm/mach-s3c2440/mach-smdk2440.c文件中被下面這段代碼調(diào)用,此處如果沒有修改,會(huì)導(dǎo)致內(nèi)核無法啟動(dòng)。

MACHINE_START(S3C2440, "SMDK2440")

177/* Maintainer: Ben Dooks */

178.phys_io= S3C2410_PA_UART,

179.io_pg_offst= (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,

180.boot_params= S3C2410_SDRAM_PA + 0x100,

181

182.init_irq= s3c24xx_init_irq,

183.map_io= smdk2440_map_io,

184.init_machine= smdk2440_machine_init,

185.timer= &s3c24xx_timer,

186 MACHINE_END

3.修改nandflash源碼

修改nandflash的分區(qū)表,打開arch/arm/plat-s3c24xx/common-smdk.c,修改111行的結(jié)構(gòu)體,修改成下面的代碼:

111 static struct mtd_partition smdk_default_nand_part[] = {

112[0] = {

113.name= "EmbedSky_Board_uboot",

114.offset = 0x00000000,

115.size= 0x00040000,

116},

117[1] = {

118.name= "EmbedSky_Board_kernel",

119.offset = 0x00200000,

120.size= 0x00200000,

121},

122[2] = {

123.name= "EmbedSky_Board_yaffs2",

124.offset = 0x00400000,

125.size= 0x0FB80000,

126}

127

128 };

并且將其后面的代碼修改成下面,以支持TQ2440的硬件,注意這里不同的Nandflash芯片,下面的取值可能不同,可以參考天嵌給出的linux2.6.30.4的。

143 static struct s3c2410_platform_nand smdk_nand_info = {

144.tacls= 10,

145.twrph0= 25,

146.twrph1= 10,

147.nr_sets= ARRAY_SIZE(smdk_nand_sets),

148.sets= smdk_nand_sets,

149 };

修改driver/mtd/nand/s3c2410.c文件的第822行,修改成下面的部分:

chip->ecc.mode= NAND_ECC_NONE;

至此,整個(gè)nandflash的源碼修改結(jié)束,我們可以配置內(nèi)核了。

三、配置內(nèi)核

(由于圖片不能貼過來,需要的話,稍候我把文件傳上來,供大家下載)

在完成了上述工作后,使用make distclean清除內(nèi)核,再make menuconfig配置內(nèi)核,配置的具體步驟如下:

1.利用別人的配置單

在進(jìn)入到配置界面后,選擇Load an Alternate Configuration File,進(jìn)入后,輸入如圖的配置單。

arch/arm/configs/s3c2410_defconfig

2.修改General setup--->

這里只修改了第3項(xiàng),Local.version,修改成了我自己名字,Machoe.Yang,其它的選擇默認(rèn),選擇默認(rèn)的原因并不是不需要修改,只是我們目前只是為了驗(yàn)證內(nèi)核能不能跑得起來,稍候的移植教程中,我人和大家分享配置單的詳細(xì)配置情況。這里只要注意Kernel compression mod選項(xiàng),默認(rèn)的是GZIP方式,如果不是,請修改過來。

2.個(gè)性system type選項(xiàng)

這里是我們本次配置的重點(diǎn),由于我們剛才調(diào)用了s3c2410的配置單,現(xiàn)在出現(xiàn)在我們面前的,第二項(xiàng),ARM system type已經(jīng)是我們所需要的CPU了,因此也不用修改了。

但這里我們的一定要修改的是中間部分,從s3c2400 Machines一直到s3c2443Machines。將它們的所有選項(xiàng)全部取消,只保留s3c2410 Machines中的smdk2410/ARM92410和s3c2440 and s3c2442 Machines選項(xiàng)中的SMDK2440SMDK2440with S3c2440 CPU Module (new)選項(xiàng)。

注意:這里一定要取消其它的開發(fā)板支持,否則會(huì)出現(xiàn)內(nèi)核(zImage)啟動(dòng)不了,而uImage可以正常啟動(dòng)的現(xiàn)象。這是因?yàn)?#xff0c;如果配置了其它開發(fā)板后,zImage的解壓縮地址會(huì)改變,具體的可以參考各目錄下的kconfig文件、Makefile和.lds文件。也可以參考本人的上一篇拙著“基于linux2.6.35的zImage內(nèi)核啟動(dòng)研究”。

3.修改Kernel Features選項(xiàng)

由于我使用的交叉編譯工具為4.3.3版本,因此,此處選上下面兩個(gè)選項(xiàng)

[*] Use the ARM EABI to compile the kernel

[*]Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (NEW)

4.添加對nandflash驅(qū)動(dòng)

在Device Driversà

Memory Technology Device (MTD) support--->

NAND Device Support--->

選項(xiàng)上中,我們要配置上

NAND Flash support for Samsung S3C SoCs

其它的選擇默認(rèn)即可。

四、編譯內(nèi)核

在完成上面的配置后,退出到頂層配置界面,選擇

Save an Alternate Configuration File

將其保存為.config配置單,然后退出。此處注意,如果不以這種方式退出,而直接退出保存,則保存的有可能是我們調(diào)用的arch/arm/configs/s3c2410_defconfig配置單,這樣就破壞了原配置單。

最后,執(zhí)行make zImage進(jìn)行編譯。

Kernel: arch/arm/boot/Image is ready

ASarch/arm/boot/compressed/head.o

GZIParch/arm/boot/compressed/piggy.gzip

ASarch/arm/boot/compressed/piggy.gzip.o

CCarch/arm/boot/compressed/misc.o

CCarch/arm/boot/compressed/decompress.o

SHIPPED arch/arm/boot/compressed/lib1funcs.S

ASarch/arm/boot/compressed/lib1funcs.o

LDarch/arm/boot/compressed/vmlinux

OBJCOPY arch/arm/boot/zImage

Kernel: arch/arm/boot/zImage is ready

出現(xiàn)上述,說明zImage已經(jīng)編譯成功,將其copy到windows的共享目錄下,

cparch/arm/boot/zImage/mnt/hjfs/abc/zImage.bin

其中,/mnt/hjfs/abc/為VM虛擬機(jī)設(shè)置的共享目錄。

將鏡像文件燒到開發(fā)板中,啟動(dòng)開發(fā)板,此處要確認(rèn)一下,開發(fā)板中一定要事先燒好u-boot,這是初學(xué)者容易犯的錯(cuò)誤。另外,天嵌提供的u-boot中,提供zImage測試功能,可以不必將其燒到nandflash中,如要使用該功能,詳見天嵌的教程。

當(dāng)正確完成上述工作后,串口會(huì)打印如下信息,重點(diǎn)信息用顏色標(biāo)出:

Now, Downloading [ADDRESS:30008000h,TOTAL:2019522]

RECEIVED FILE SIZE: 2019522 (986KB/S, 2S)

NOW, Booting Linux......

Uncompressing Linux... done, booting the kernel.

Linux version 2.6.35---Machoe.Yang(root@EmbedSky) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176) ) #1 Tue Sep 28 09:28:25 CST 2010

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177

CPU: VIVT data cache, VIVT instruction cache

Machine: SMDK2440

ATAG_INITRD is deprecated; please update your bootloader.

Memory policy: ECC disabled, Data cache writeback

CPU S3C2440A (id 0x32440001)

S3C24XX Clocks, Copyright 2004 Simtec Electronics

S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 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

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: 60796k/60796k available, 4740k reserved, 0K highmem

Virtual kernel memory layout:

vector: 0xffff0000 - 0xffff1000(4 kB)

fixmap: 0xfff00000 - 0xfffe0000( 896 kB)

DMA: 0xffc00000 - 0xffe00000(2 MB)

vmalloc : 0xc4800000 - 0xe0000000( 440 MB)

lowmem: 0xc0000000 - 0xc4000000(64 MB)

modules : 0xbf000000 - 0xc0000000(16 MB)

.init : 0xc0008000 - 0xc0028000( 128 kB)

.text : 0xc0028000 - 0xc03a8000(3584 kB)

.data : 0xc03c0000 - 0xc03e1860( 135 kB)

Hierarchical RCU implementation.

RCU-based detection of stalled CPUs is disabled.

Verbose stalled-CPUs detection is disabled.

NR_IRQS:85

irq: clearing pending ext status 00080000

irq: clearing subpending status 00000003

irq: clearing subpending status 00000002

Console: colour dummy device 80x30

console [ttySAC0] enabled

Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)

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

S3C Power Management, Copyright 2004 Simtec Electronics

S3C2440: Initialising architecture

S3C2440: IRQ Support

S3C24XX DMA Driver, Copyright 2003-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

bio: create slab at 0

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

Advanced Linux Sound Architecture Driver Version 1.0.23.

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.

NetWinder Floating Point Emulator V0.97 (extended precision)

JFFS2 version 2.2. (NAND) (SUMMARY)漏2001-2006 Red Hat, Inc.

ROMFS MTD (C) 2007 Red Hat, Inc.

msgmni has been set to 118

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

Console: switching to colour frame buffer device 30x40

fb0: s3c2410fb frame buffer device

lp: driver loaded but no devices found

ppdev: user-space parallel port driver

Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440

s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440

s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440

brd: module loaded

loop: module loaded

Uniform Multi-Platform E-IDE driver

ide-gd driver 1.18

ide-cd driver 5.00

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c24xx-nand s3c2440-nand: Tacls=1, 10ns Twrph0=3 30ns, Twrph1=1 10ns

s3c24xx-nand s3c2440-nand: NAND soft ECC

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

Scanning device for bad blocks

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

0x000000000000-0x000000040000 : "EmbedSky_Board_uboot"

0x000000200000-0x000000400000 : "EmbedSky_Board_kernel"

0x000000400000-0x00000ff80000 : "EmbedSky_Board_yaffs2"

dm9000 Ethernet Driver, V1.31

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

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.6.0: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

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

ALSA device list:

No soundcards found.

TCP cubic registered

NET: Registered protocol family 17

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

List of all partitions:

1f00256 mtdblock0 (driver?)

1f012048 mtdblock1 (driver?)

1f02257536 mtdblock2 (driver?)

No filesystem could mount root, tried:ext3 ext2 cramfs vfat msdos iso9660 romfs

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)

[] (unwind_backtrace+0x0/0xec) from [] (panic+0x54/0xdc)

[] (panic+0x54/0xdc) from [] (mount_block_root+0x1d0/0x210)

[] (mount_block_root+0x1d0/0x210) from [] (prepare_namespace+0x164/0x1bc)

[] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0x10c/0x14c)

[] (kernel_init+0x10c/0x14c) from [] (kernel_thread_exit+0x0/0x8)

由于沒有燒寫文件系統(tǒng),因此后面會(huì)報(bào)錯(cuò)。

本次編譯的內(nèi)核其中還有好多地方需要完善,這次配置過程,只是為了回答在論壇上有人提出的zImage在TQ2440啟動(dòng)的過程。后續(xù),我還會(huì)繼續(xù)完善2.6.35內(nèi)核的移植過程,直至整個(gè)移植工作的完成。

上述內(nèi)容只是個(gè)人拙見,如果錯(cuò)誤,希望廣大網(wǎng)友不吝賜教,給我指出,望大家共同提高。

由于圖片上傳比較麻煩,如果有需要完整版,請到CSDN下載。下載地址:

總結(jié)

以上是生活随笔為你收集整理的linux开发环境 tq2440,Linux2.6.35在TQ2440的移植过程(一)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。