内核版本:3.4.61

1. 配置内核,支持DHCP

  ~/kernel$ make menuconfig

  [*] Networking support  --->

    Networking options  --->

      <*> Packet socket

      [*]     IP: DHCP support

      [ ] Network packet filtering framework (Netfilter)  --->  //网上说需要选中该项,但是选择该项后功能不正常

2. 配置busybox,支持udhcp

  默认情况下,busybox已经支持udhcp

  (1)编译busybox

  (2)将生成的udhcpc复制到开发板/sbin下

  (3)从Busybox的examples/udhcp/下copy  simple.script文件到开发板/usr/share/udhcpc/下,并重命名为default.script

      修改default.script中RESOLV_CONF="/etc/resolv.conf" 为 RESOLV_CONF="/tmp/resolv.conf"  //可指定为其他路径

  

3. 测试

  (1)启动wifi:#ifconfig wlan0 up

  (2)连接热点:#iwconfig wlan0 essid "HWAP"

  (3)自动获取IP:#udhcpc -i wlan0

udhcpc (v1.19.3) started
Setting IP address 0.0.0.0 on wlan0
Sending discover...
Sending select for 192.168.43.22...
Lease of 192.168.43.22 obtained, lease time 3600
Setting IP address 192.168.43.22 on wlan0
Deleting routers
route: SIOCDELRT: No such process
Adding router 192.168.43.1
Recreating /etc/resolv.conf
 Adding DNS server 192.168.43.1

05-11 18:27