linux26364移植到TQ2440.docx
- 文档编号:6295517
- 上传时间:2023-01-05
- 格式:DOCX
- 页数:35
- 大小:44.10KB
linux26364移植到TQ2440.docx
《linux26364移植到TQ2440.docx》由会员分享,可在线阅读,更多相关《linux26364移植到TQ2440.docx(35页珍藏版)》请在冰豆网上搜索。
linux26364移植到TQ2440
1、内核配置和编译
1.修改顶层Makefile
ARCH?
=arm
CROSS_COMPILE?
=arm-linux-根据自己的环境修改交叉编译器前缀
2.修改arch/arm/boot/Makefile增加一行
@echo'Kernel:
$@isready'
cp$@/tftpboot/根据自己的ftp服务器目录修改
3.匹配机器码
1)启动u-boot执行bdinfo将输出开发板的相关信息,包括机器码
TQ2440#bd
arch_number=0x0000016A机器码362
boot_params=0x30000100
DRAMbank=0x00000000
->start=0x30000000
->size=0x04000000
ethaddr=00:
01:
02:
03:
04:
05
ip_addr=192.168.1.100
baudrate=115200bps
TLBaddr=0x33FF0000
relocaddr=0x33F40000
relocoff=0x33F40000
irq_sp=0x33B2FF68
spstart=0x33B2FF58
FBbase=0x00000000
TQ2440#
2)新版u-boot可以设置环境变量machid来更改机器码
TQ2440#setmachid0x16A
3)内核机器码:
arch/arm/mach-s3c2440/mach-smdk2440.c
MACHINE_START(S3C2440,"SMDK2440")
其中的S3C2440即为机器码
再查看arch/arm/tools/mach-types第379行即为S3C2440所对应的机器码362,必须和u-boot的机器码相同,否则没法启动内核
4.修改系统时钟
arch/arm/mach-s3c2440/mach-smdk2440.c我们的开发板使用12MHZ
s3c24xx_init_clocks(12000000);
5.执行默认配置
root@zjh:
/home/work/linux-2.6.36.4#makes3c2410_defconfig
6.配置内核
root@zjh:
/home/work/linux-2.6.36.4#makemenuconfig
KernelFeatures--->
[*]UsetheARMEABItocompilethekernel
[*]AllowoldABIbinariestorunwiththiskernel(EXPERIMENTAL)
注:
使用4.X.X版本的交叉编译器一定要选中以上两项,否则会出现Kernelpanic-notsyncing:
Attemptedtokillinit!
这样的错误以致没法启动内核
SystemType--->
S3C2440andS3C2442Machines--->
[*]SMDK2440
[*]SMDK2440withS3C2440CPUmodule
只选中这两项即可,其他的Machine都取消
7.编译内核
root@zjh:
/home/work/linux-2.6.36.4#makezImage
…………
OBJCOPYarch/arm/boot/zImage
Kernel:
arch/arm/boot/zImageisready
ImageName:
linux-2.6.36
Created:
WedOct1712:
42:
192012
ImageType:
ARMLinuxKernelImage(uncompressed)
DataSize:
2075944Bytes=2027.29kB=1.98MB
LoadAddress:
30008000
EntryPoint:
30008000
8.启动u-boot,执行如下操作
TQ2440#tftp30000000uImage
TQ2440#bootm30000000
##Bootingimageat30000000...
ImageName:
linux-2.6.36
Created:
2012-10-174:
33:
02UTC
ImageType:
ARMLinuxKernelImage(uncompressed)
DataSize:
2075944Bytes=2MB
LoadAddress:
30008000
EntryPoint:
30008000
VerifyingChecksum...OK
XIPKernelImage...OK
Startingkernel...
UncompressingLinux...done,bootingthekernel.
Linuxversion2.6.36.4(root@zjh)(gccversion4.4.3(ctng-1.6.1))#4WedOct1712:
32:
51CST2012
CPU:
ARM920T[41129200]revision0(ARMv4T),cr=c0007177
CPU:
VIVTdatacache,VIVTinstructioncache
Machine:
SMDK2440
Memorypolicy:
ECCdisabled,Datacachewriteback
CPUS3C2440A(id0x32440001)
S3C24XXClocks,Copyright2004SimtecElectronics
S3C244X:
core400.000MHz,memory100.000MHz,peripheral50.000MHz…………
2、DM9000网卡驱动移植
1.修改arch/arm/mach-s3c2440/mach-smdk2440.c,构建DM9000平台设备
#include
#defineMACH_TQ2440_DM9K_BASE(S3C2410_CS4+0x300)
/*supportDM9000*/
staticstructresourceTQ2440_dm9k_resource[]={
[0]={
.start=MACH_TQ2440_DM9K_BASE,
.end=MACH_TQ2440_DM9K_BASE+3,
.flags=IORESOURCE_MEM
},
[1]={
.start=MACH_TQ2440_DM9K_BASE+4,
.end=MACH_TQ2440_DM9K_BASE+7,
.flags=IORESOURCE_MEM
},
[2]={
.start=IRQ_EINT7,
.end=IRQ_EINT7,
.flags=IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHEDGE,
}
};
/*
*TheDM9000hasnoeeprom,andsetit'sMACaddress
*/
staticstructdm9000_plat_dataTQ2440_dm9k_pdata={
.flags=(DM9000_PLATF_16BITONLY|DM9000_PLATF_NO_EEPROM),
.dev_addr="\x00\x11\x22\x33\x44\x66",
};
staticstructplatform_deviceTQ2440_device_eth={
.name="dm9000",
.id=-1,
.num_resources=ARRAY_SIZE(TQ2440_dm9k_resource),
.resource=TQ2440_dm9k_resource,
.dev={
.platform_data=&TQ2440_dm9k_pdata,
},
};
smdk2440_devices[]结构体数组添加如下代码
&TQ2440_device_eth
2.修改drivers/net/ethernet/davicom/dm9000.c第44行加入如下代码
#include"dm9000.h"
#ifdefined(CONFIG_ARCH_S3C2440)
#include
#endif
第1375行加入如下代码
u32id_val;
#ifdefined(CONFIG_ARCH_S3C2440)
unsignedintoldval_bwscon=*(volatileunsignedint*)S3C2410_BWSCON;
unsignedintoldval_bankcon4=*(volatileunsignedint*)S3C2410_BANKCON4;
#endif
/*Initnetworkdevice*/
第1387行加入如下代码
dev_dbg(&pdev->dev,"dm9000_probe()\n");
#ifdefined(CONFIG_ARCH_S3C2440)
/*设置Bank4:
总线宽度为16,使能nWAIT*/
*((volatileunsignedint*)S3C2410_BWSCON)=(oldval_bwscon&~(3<<16))|
S3C2410_BWSCON_DW4_16|S3C2410_BWSCON_WS4|S3C2410_BWSCON_ST4;
/*设置Bandk4的时间参数*/
*((volatileunsignedint*)S3C2410_BANKCON4)=0x1f7c;
#endif
/*setupboardinfostructure*/
第1615行
out:
/*恢复寄存器原来的值*/
#ifdefined(CONFIG_ARCH_S3C2440)
*(volatileunsignedint*)S3C2410_BWSCON=oldval_bwscon;
*(volatileunsignedint*)S3C2410_BANKCON4=oldval_bankcon4;
#endif
3.配置内核支持DM9000
root@zjh:
/home/work/linux-2.6.36.4#makemenuconfig
[*]Networkingsupport--->
Networkingoptions--->
<*>Packetsocket
<*>Unixdomainsocket
[*]TCP/IPnetworking
[*]IP:
multicasting
[*]IP:
kernellevelautoconfiguration
[*]IP:
BOOTPsupport
DeviceDrivers--->
[*]Networkdevicesupport--->
[*]Ethernet(10or100Mbit)--->
<*>DM9000support
Filesystems--->
[*]NetworkFileSystems(NEW)--->
<*>NFSclientsupport
[*]NFSclientsupportforNFSversion3(NEW)
[*]NFSclientsupportfortheNFSv3ACLprotocolextension
[*]RootfilesystemonNFS
4.重新编译内核并设置u-boot启动参数,通过NFS挂载根文件系统
TQ2440#setbootargsroot=/dev/nfsnfsroot=192.168.1.8:
/home/work/rootfsip=192.168.1.100init=/linuxrcconsole=ttySAC0,115200
TQ2440#save
5.下载内核并启动
TQ2440#tftp30000000uImage
TQ2440#bootm30000000
………………
[root@tq2440/]#
3、移植内核自带的LED驱动
1.在BSP文件arch/arm/mach-s3c2440/mach-smdk2440.c增加我们开发板的LED配置
#include
staticstructgpio_ledtq2440_leds[]={
[0]={
.name="led1",
.gpio=S3C2410_GPB(5),
.active_low=1,
},
[1]={
.name="led2",
.gpio=S3C2410_GPB(6),
.active_low=1,
},
[2]={
.name="led3",
.gpio=S3C2410_GPB(7),
.active_low=1,
},
[3]={
.name="led4",
.gpio=S3C2410_GPB(8),
.active_low=1,
}
};
staticstructgpio_led_platform_datatq2440_leds_pdata={
.num_leds=ARRAY_SIZE(tq2440_leds),
.leds=tq2440_leds,
};
staticstructplatform_devicetq2440_device_leds={
.name="leds-gpio",
.id=-1,
.dev={
.platform_data=&tq2440_leds_pdata,
},
};
在smdk2440_devices[]平台数组中添加
&tq2440_device_leds,
2.配置内核
DeviceDrivers--->
-*-LEDSupport--->
<*>LEDClassSupport
<>LEDSupportforSamsungS3C24XXGPIOLEDs
<*>LEDSupportforGPIOconnectedLEDs
[*]PlatformdevicebindingsforGPIOLEDs
3.重新编译内核
[root@tq2440/]#ll/sys/class/leds/
total0
drwxr-xr-x3rootroot0Jan100:
00led1
drwxr-xr-x3rootroot0Jan100:
00led2
drwxr-xr-x3rootroot0Jan100:
00led3
drwxr-xr-x3rootroot0Jan100:
00led4
[root@tq2440/]#echo1>sys/class/leds/led1/brightness点亮LED1
[root@tq2440/]#echo0>sys/class/leds/led1/brightness熄灭LED1
4、RTC驱动移植
1.在arch/arm/mach-s3c2440/mach-smdk2440.c的smdk2440_devices[]结构体数组添加rtc平台设备列表
&s3c_device_rtc,
2.配置内核
DeviceDrivers--->
[*]RealTimeClock--->
[*]SetsystemtimefromRTConstartupandresume(NEW)
(rtc0)RTCusedtosetthesystemtime
[*]/sys/class/rtc/rtcN(sysfs)(NEW)
[*]/proc/driver/rtc(procfsforrtc0)(NEW)
[*]/dev/rtcN(characterdevices)(NEW)
<*>SamsungS3CseriesSoCRTC
3.重新编译内核并下载到开发板
[root@tq2440/]#date
ThuJan100:
09:
48UTC1970
[root@tq2440/]#date-s2012.10.17-22:
30:
0设置时间
WedOct1722:
30:
00UTC2012
[root@tq2440/]#hwclock-w设置硬件时间为当前系统时间
这样系统重启后会自动更新到硬件时间
5、LCD驱动移植
1.在arch/arm/mach-s3c2440/mach-smdk2440.c中修改LCD参数
.width=480,
.height=272,
.pixclock=((2*1000000000000LL)/(60*(2+2+41+480)*(2+2+10+272))),
.xres=480,
.yres=272,
.bpp=16,
.left_margin=2,
.right_margin=2,
.hsync_len=41,
.upper_margin=2,
.lower_margin=2,
.vsync_len=10,
将下面这行注释掉
//.lpcsel=((0xCE6)&~7)|1<<4,/*lpc3600controlregister*/
2.在arch/arm/mach-s3c2440/mach-smdk2440.c的smdk2440_devices[]结构体数组中已经有lcd设备
&s3c_device_lcd,
3.配置内核
DeviceDrivers--->
Graphicssupport--->
<*>Supportforframebufferdevices--->
<*>S3C2410LCDframebuffersupport
[*]Bootuplogo--->
[]StandardblackandwhiteLinuxlogo
[]Standard16-colorLinuxlogo
[*]Standard224-colorLinuxlogo(NEW)
4.重新编译内核
将看到LCD显示开机logo
5.解决10分钟后黑屏:
修改drivers/char/vt.c
可修改staticintblankinterval=10*60;
默认为10分钟后LCD背光就自动关闭,当发生中断就会开启,改为0,LCD就常亮。
6.关闭光标:
修改/drivers/video/console/softcursor.c
intsoft_cursor(structfb_info*info,structfb_cursor*cursor)
{
#if0
structfbcon_ops*ops=info->fbcon_par;
unsignedintscan_align=info->pixmap.scan_align-1;
unsignedintbuf_align=info->pixmap.buf_align-1;
unsignedinti,size,dsize,s_pitch,d_pitch;
structfb_image*image;
u8*src,*dst;
if(info->state!
=FBINFO_STATE_RUNNING)
return0;
s_pitch=(cursor->image.width+7)>>3;
dsize=s_pitch*cursor->image.height;
if(dsize+sizeof(structfb_image)!
=ops->cursor_size){
if(ops->cursor_src!
=NULL)
kfree(ops->cursor_src);
ops->cursor_size=dsize+sizeof(structfb_image);
ops->cursor_src=kmalloc(ops->cursor_size,GFP_ATOMIC);
if(!
ops->cursor_src){
ops->cursor_size=0;
return-ENOMEM;
}
}
src=ops->cursor_src+sizeof(structfb_image);
image=(structfb_image*)ops->cursor_src;
*image=cursor->image;
d_pitch=(s_pitch+scan_align)&~scan_align;
size=d_pitch*image->height+buf_align;
size&=~buf_align;
dst=fb_get_buffer_offset(info,&info->pixmap,size);
if(cursor->enable){
switch(cursor->rop){
caseROP_XOR:
for(i=0;i src[i]=image->data[i]^cursor->mask[i]; break; caseROP_COPY: default: for(i=0;i src[i]=image->data[i]&cursor->mask[i]; break; } }else memcpy(src,image->data,ds
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- linux26364 移植 TQ2440