------------------------------------------------------------------------------------------------------------------------------
交叉编译器:arm-linux-gcc-4.5.4
Linux内核版本:Linux-3.0
开发板:FL2440
本文章的内核已经已经添加了DM9000的网卡,USB驱动,使用的是initramfs的文件系统。
------------------------------------------------------------------------------------------------------------------------------
一、配置内核
[*] Networking support --->
Networking options ---><*> Packet socket<*> Unix domain sockets[*] TCP/IP networking[*] IP: kernel level autoconfiguration[*] IP: DHCP support[*] Network packet filtering framework (Netfilter) --->二、配置busybox
[*]udhcp server(udhcpd)
[*]udhcp client(udhcpc) 都选上 udhcpd就是终端设备作为DHCP服务器 ;udhcpc就是终端设备作为DHCP客户端
Networking Utilities --->
[*] udhcp client for DHCPv6 (udhcpc6)[*] udhcp server (udhcpd) //生成udhcpc命令
sudo make install
从Busybox的examples/udhcp/下拷贝simple.script文件到开发板的/usr/share/udhcpc/下,并重命名为default.script,然后更改文件default.script的权限为可执行文件。
三、测试
>: mv simple.script default.script
>: chmod a+x default.script >: mkdir -p /usr/share/udhcpc>: cp default.script /usr/share/udhcpc/>: ping 192.168.199.1PING 192.168.199.1 (192.168.199.1): 56 data bytes64 bytes from 192.168.199.1: seq=0 ttl=64 time=50.549 ms64 bytes from 192.168.199.1: seq=1 ttl=64 time=47.244 ms--- 192.168.199.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet lossround-trip min/avg/max = 47.244/48.896/50.549 ms>: udhcpc -i wlan0udhcpc (v1.20.2) startedSetting IP address 0.0.0.0 on wlan0Sending discover...Sending select for 192.168.199.181...Lease of 192.168.199.181 obtained, lease time 43200Setting IP address 192.168.199.181 on wlan0Deleting routersroute: SIOCDELRT: No such processAdding router 192.168.199.1Recreating /etc/resolv.conf Adding DNS server 192.168.199.1>: ifconfigeth0 Link encap:Ethernet HWaddr D6:10:9A:CD:CD:91 inet addr:192.168.1.111 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:248 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:23616 (23.0 KiB) TX bytes:786 (786.0 B) Interrupt:51 Base address:0x4300wlan0 Link encap:Ethernet HWaddr 00:A1:B0:40:6F:9A
inet addr:192.168.199.181 Bcast:192.168.199.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1635 errors:0 dropped:431 overruns:0 frame:0 TX packets:39 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:150647 (147.1 KiB) TX bytes:4231 (4.1 KiB)>: route
Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault Hiwifi.lan 0.0.0.0 UG 0 0 0 wlan0192.168.1.0 * 255.255.255.0 U 0 0 0 eth0192.168.199.0 * 255.255.255.0 U 0 0 0 wlan0