移植uboot2010.06到TQ2440开发板详解之二

六、支持网卡DM9000

1、修改板子头文件include/configs/tq2440.h

1)        增加DM9000支持

71 //#define CONFIG_CS8900         /* we have a CS8900 on-board */

72 //#define CONFIG_CS8900_BASE    0x19000300

73 //#define CONFIG_CS8900_BUS16   /* the Linux driver does accesses as shorts*/

74 #define CONFIG_DRIVER_DM9000 1

75 #define CONFIG_DM9000_BASE 0x20000000

76 #define DM9000_IO CONFIG_DM9000_BASE

77 #define DM9000_DATA (CONFIG_DM9000_BASE + 4)

78 #define CONFIG_DM9000_USE_16BIT

……

120 #define CONFIG_ETHADDR         10:23:45:67:89:AB

121 #define CONFIG_NETMASK         255.255.255.0

122 #define CONFIG_IPADDR          192.168.10.88

123 #define CONFIG_SERVERIP        192.168.10.96

 

Uboot2010.06版本相对于uboot-1.1.6有所变化,查看驱动的Makefile文件时可以发现这个变化。前者的Makefile是在drivers/net/下面,打开后发现其驱动都是条件编译的,即定义相应的宏以增加相应的编译项。正式由于在这个Makefile里发现了如下一行,才得知上面增加DM9000驱动应加的宏定义。

37 COBJS-$(CONFIG_DRIVER_DM9000) +=dm9000x.o

2)       增加ping命令

在上述文件增加一行:

115 #defineCONFIG_CMD_PING

2、修改板子初始化文件,对网卡进行初始化

    修改board/samsung/tq2440/tq2440.c文件中网卡的初始化部分:

128 #ifdef CONFIG_CMD_NET

129 int board_eth_init(bd_t *bis)

130 {

131        int rc = 0;

132 /*

133 #ifdef CONFIG_CS8900

134        rc = cs8900_initialize(0, CONFIG_CS8900_BASE);

135 #endif

136 */

137 #ifdef CONFIG_DRIVER_DM9000

138         rc = dm9000_initialize(bis);

139 #endif 

140        return rc;

141 }

142 #endif

3、编译下载


其中192.168.10.96为虚拟机IP地址。


4、设置TFTP服务器

1)       解压源码包

首先下载tftp服务器源码包opentftpmtV1.65.tar.gz,并解压,将其移动到/opt目录下:

[root@arm 21:17 /home/zhang]# tar -zxv -fopentftpmtV1.65.tar.gz

[root@arm 21:18 /home/zhang]# mv opentftp//opt/

2)       设置TFTP服务目录

修改配置文件'opentftp.ini'来指定tftpserver 的工作目录, 也就是向外提供tftp 服务的目录,这里我们选择为/home/zhang/tftp

[root@arm21:19 /opt/opentftp]# vim opentftp.ini

 

32#deposited like:-

33'/home/me/firmware/

34 /home/zhang/tftp

3)       设置开机自启动

启动tftpserver:

[root@arm21:22 /opt/opentftp]# ./rc.opentftp start

Open TFTPServer started

其实,如果需要使用TFTP服务器,需要将其设置为开机自动启动,并重启系统。我们可以将如下两行文字添加到文件'/etc/rc.d/rc.local'中,使得tftpserver 可以在开机时自动启动,并重启操作系统。

[root@arm21:25 /opt/opentftp]# vim /etc/rc.d/rc.local

添加:

/opt/opentftp/rc.opentftpstart

/opt/opentftp/rc.opentftpstatus

重启操作系统。

5、通过TFTP烧写文件

1)       关闭防火墙

 [root@arm 21:41 /opt/opentftp]# serviceiptables stop

2)       下载文件:

下载一个可执行文件hello:

TQ2440 # tftp 0x30000000 hello

dm9000 i/o:0x20000000, id: 0x90000a46

DM9000:running in 16 bit mode

MAC:10:23:45:67:89:ab

could notestablish link

Usingdm9000 device

TFTP from server192.168.10.96; our IP address is 192.168.10.66

Filename'hello'.

Loadaddress: 0x30000000

Loading: #

done

Bytestransferred = 6499 (1963 hex)

TQ2440 #

 

好了,到这里网卡移植已经完成,并可以通过tftp下载文件了。下一步是开发板从NAND启动。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值