S3C2440实现wifi、3G上网和迷你无线路由的制作(一)
S3C2440实现wifi、3G上网和迷你无线路由的制作
fulinux 凌云实验室
本文将通过ARM、linux平台,借助RT2070/RT3070芯片的无线模块(或使用RT2070/RT3070芯片的USB无线上网卡)、3G无线上网卡,实现无线上网、通过ADSL和3G的迷你无线路由器的制作。
wifi上网
首先是利用s3c2440开发板和RT2070/RT3070芯片的无线模块实现无线上网的功能,即让无线模块工作在STA模式,所谓的STA在WLAN中一般为客户端,可以是装有无线网卡的计算机,也可以是有WiFi模块的智能手机。STA可以是移动的,也可以是固定的,是无线局域网的最基本组成单元。
这里假定已经成功移植了linux-3.0内核和可读写的文件系统,例如ubifs、yaffs和jffs2文件系统,这里使用jffs2。下图是已经运行好的系统在secure CRT上的显示的结果:
~ >: ls
apps data home lib media proc stat usr
backup dev info linuxrc mnt root sys var
bin etc init logs opt sbin tmp
~ >:
这里使用一个集成RT2070芯片的USB无线网卡(或其他无线模块,注明一点就是3070和2070的模块是完全兼容的,下面我们只以RT2070模块作介绍),是下面是要用到的实物图:
(上图中的一些次要部件没有列出来,需要的部分会提到)
先测试USB无线模块是否正常,我把它插在电脑上并且连接在普通无线路由器上,显示如下所示,则说明正常。
之后拔出,因为我的电脑用有线。
内核配置
从Linux-3.0开始,RT2070/3070的STA驱动已经作为正式版本加入了Linux内核源码中了(从Linux-2.6.32开始以实验版本加入Linux内核中)。本篇文章主要介绍如何在内核中编译支持RT2070的STA模式驱动,并连接到我的无线路由器上去。
1, 配置Linux-3.0内核支持RT2070,我们以Build-in的方式将RT2070的驱动集成到内核里去,一下是一些需要的选项,其他配置可以自己试试:
[*] Networking support --->
-*- Wireless --->
<*> cfg80211 - wireless configuration API
[ ] nl80211 testmode command
[ ] enable developer warnings
[ ] cfg80211 regulatory debugging
[*] enable powersave by default
[ ] use statically compiled regulatory rules database
[ ] cfg80211 wireless extensions compatibility
<*> Common routines for IEEE802.11 drivers
[ ] lib80211 debugging messages
<*> Generic IEEE 802.11 Networking Stack (mac80211)
[ ] PID controller based rate control algorithm
[*] Minstrel
[*] Minstrel 802.11n support
Default rate control algorithm (Minstrel) --->
[ ] Enable mac80211 mesh networking (pre-802.11s) support
[ ] Select mac80211 debugging features --->
Device Drivers --->
Generic Driver Options --->
(/sbin/hotplug) path to uevent helper
[ ] Maintain a devtmpfs filesystem to mount at /dev
[ ] Select only drivers that don't need compile-time external firmware
[ ] Prevent firmware from being built
-*- Userspace firmware loading support
[*] Include in-kernel firmware blobs in kernel binary
() External firmware blobs to build into the kernel binary
[*] Network device support --->
[*] Wireless LAN --->
<*> Ralink driver support --->
--- Ralink driver support
< > Ralink rt2500 (USB) support
< > Ralink rt2501/rt73 (USB) support
<*> Ralink rt27xx/rt28xx/rt30xx (USB) support
[ ] rt2800usb - Include support for rt33xx devices
[ ] rt2800usb - Include support for rt35xx devices (EXPERIMENTAL)
[ ] rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)
[ ] rt2800usb - Include support for unknown (USB) devices
[*] Ralink debug output
注明:
a、cfg80211:
cfg80211 is the Linux 802.11 configuration API. cfg80211 replaces Wireless-Extensions. nl80211 is used to configure a cfg80211 device and is used for kernel <–> userspace communication. Wireless extensions is now in maintenance mode, no new features will be added to it, we'll only fix bugs for it. cfg80211 is now feature-par complete with wireless-extensions, it actually has a lot more features that are simply not available and will never be available through wireless extensions. When implementing a cfg80211 driver wireless extensions support is still provided automatically for you through cfg80211 through CONFIG_CFG80211_WEXT. Distributions no longer needing wireless extensions can remove this and are encouraged to do so. cfg80211 also provides full regulatory support, this is done through wireless-regdb and the usage of CRDA.
All new Linux wireless drivers should be written targeting either cfg80211 for fullmac devices or mac80211 for softmac devices.
(摘自:http://wireless.kernel.org/en/developers/Documentation/cfg80211)
b、Minstrel:
minstrel is a mac80211 rate control algorithm ported over from MadWifi which supports multiple rate retries and claimed to be one of the best, if not the best, rate control algorithm.
(摘自:http://wireless.kernel.org/en/developers/Documentation/mac80211/RateControl/minstrel/)
c、hotplug
这里是支持热插拔。
d、Firmware
固件的目的是初始化,() External firmware blobs to build into the kernel binary这一选项可以加入固件路径。
e、[*] Ralink debug output
这个选项选了后容易出现下面的警告。
cfg80211: Calling CRDA to update world regulatory domain
2、插入RT2070无线网卡并加载新内核启动
………..
RAMDISK: gzip image found at block 0
usb 1-1: new full speed USB device number 2 using at91_ohci
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.3: new full speed USB device number 3 using at91_ohci
phy0 -> rt2x00_set_chip: Info - Chipset detected - 070, rf: 0006, rev: 0201.
ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
EXT2-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 128K
使用lsusb命令查看:
~ >: lsusb
Bus 001 Device 001: ID 1d6b:0001
Bus 001 Device 002: ID 05e3:0606
Bus 001 Device 003: ID 148f:2070
~ >:
如果是热插拔的话会,在插入的那一刻,串口会打印如下信息:
~ >: usb 1-1.1: new full speed USB device number 3 using s3c2410-ohci
usb 1-1.1: New USB device found, idVendor=148f, idProduct=
usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.1: Product: 802.11 g WLAN
usb 1-1.1: Manufacturer: Ralink
usb 1-1.1: SerialNumber: 1.0
ifconfig是查看网卡的信息。
ifconfig [Interface]
Interface是可选项,如果不加此项,则显示系统中所有网卡的信息。如果添加此选项则显示所指定的网卡信息,例如:
~ >: ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr C8:3A:35:C6:A2:B5
inet addr:192.168.5.1 Bcast:192.168.5.255 Mask:255.255.255.0
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
我们可以看到
第一行:连接类型:Ethernet(以太网)HWaddr(硬件mac地址)
第二行:网卡的IP地址、子网、掩码
第三行:MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节
第四、五行:接收、发送数据包情况统计
第七行:接收、发送数据字节数统计信息。
~ >: ifconfig wlan0 up
phy0 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'.
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
ifconfig: SIOCSIFFLAGS: No such file or directory
这时我们在使用RT2070的驱动时发现,RT2070的驱动还需要rt2870.bin这个系统固件(firmware)。
1, Linux内核官方站点下载rt2870.bin这个系统固件
I. PC上下载rt2870.bin这个系统固件:
[guowenxue@centos6 ~]$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
[guowenxue@centos6 ~]$ ls -l linux-firmware/rt2870.bin
-rw-rw-r-- 1 guowenxue guowenxue 8192 Dec 23 09:37 linux-firmware/rt2870.bin
II. 在AT91SAM9260开发板上将rt2870.bin下载到/lib/firmware路径下,这时能重启网卡:
/lib >: mkdir -p /lib/firmware
/lib >: cd firmware/
/lib/firmware >: tget rt2870.bin
rt2870.bin 100% |*******************************| 8192 0:00:00 ETA
/lib/firmware >: ls
rt2870.bin
iwconfig命令来自下面交叉编译的wireless_tools程序
~ >: iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
~ >: ifconfig wlan0 up
phy1 -> rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'.
phy1 -> rt2x00lib_request_firmware: Info - Firmware detected - version: 0.29.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 102.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 4, CWmax: 5, Aifs: 2, TXop: 188.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 5, CWmax: 10, Aifs: 3, TXop: 0.
phy1 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 5, CWmax: 10, Aifs: 7, TXop: 0.
2, 下载/交叉编译wireless_tools的shell脚本,这些工具包括iwconfig, iwlist, iwpriv等:
[guowenxue@centos6 wireless]$ ls
openssl wireless_tools wpa_supplicant
[guowenxue@centos6 wireless]$ cd wireless_tools/
[guowenxue@centos6 wireless_tools]$ ls
build.sh
[guowenxue@centos6 wireless_tools]$ cat build.sh
#!/bin/sh
#+--------------------------------------------------------------------------------------------
#|Description: This shell script used to download tree wireless_tools code and cross compile it.
#| Author: GuoWenxue <guowenxue@gmail.com>
#| ChangeLog:
#+--------------------------------------------------------------------------------------------
PRJ_PATH=`pwd`
APP_NAME="wireless_tools.29"
PACK_SUFIX="tar.gz"
DL_ADDR="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/$APP_NAME.$PACK_SUFIX"
INST_PATH=${PRJ_PATH}/../mnt/usr/sbin/
ARCH=arm926t
CROSS=
sup_arch=("" "arm926t" "arm920t" )
function select_arch()
{
echo "Current support ARCH: "
i=1
len=${#sup_arch[*]}
while [ $i -lt $len ]; do
echo "$i: ${sup_arch[$i]}"
let i++;
done
echo "Please select: "
index=
read index
ARCH=${sup_arch[$index]}
}
function decompress_packet()
(
echo "+---------------------------------------------+"
echo "| Decompress $1 now"
echo "+---------------------------------------------+"
ftype=`file "$1"`
case "$ftype" in
"$1: Zip archive"*)
unzip "$1" ;;
"$1: gzip compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xzf $1
else
gzip -d "$1"
fi ;;
"$1: bzip2 compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xjf $1
else
bunzip2 "$1"
fi ;;
"$1: POSIX tar archive"*)
tar -xf "$1" ;;
*)
echo "$1 is unknow compress format";;
esac
)
if [ -z $ARCH ] ; then
select_arch
fi
if [ "arm920t" != $ARCH -a "arm926t" != $ARCH ] ; then
echo "+------------------------------------------------------------------+"
echo "| ERROR: Unsupport platform $ARCH to cross compile "
echo "+------------------------------------------------------------------+"
exit -1;
else
CROSS="/opt/buildroot-2011.11/${ARCH}/usr/bin/arm-linux-"
fi
# Download source code packet
if [ ! -s $APP_NAME.$PACK_SUFIX ] ; then
echo "+------------------------------------------------------------------+"
echo "| Download $APP_NAME.$PACK_SUFIX now "
echo "+------------------------------------------------------------------+"
wget $DL_ADDR
fi
# Decompress source code packet
if [ ! -d $APP_NAME ] ; then
decompress_packet $APP_NAME.$PACK_SUFIX
fi
echo "+------------------------------------------------------------------+"
echo "| Build $APP_NAME for $ARCH "
echo "| Crosstool: $CROSS"
echo "+------------------------------------------------------------------+"
cd $APP_NAME
FILE=Makefile
line=`sed -n '/^CC =/=' $FILE`
sed -n "$line p" $FILE | grep "$CROSS"
if [ 0 != $? ] ; then
sed -i -e ${line}s"|.*|CC = ${CROSS}gcc|" $FILE
line=`sed -n '/^AR =/=' $FILE`
sed -i -e ${line}s"|.*|AR = ${CROSS}ar|" $FILE
line=`sed -n '/^RANLIB =/=' $FILE`
sed -i -e ${line}s"|.*|RANLIB = ${CROSS}ranlib|" $FILE
line=`sed -n '/BUILD_STATIC =/=' $FILE`
sed -i -e ${line}s"|.*|BUILD_STATIC = y|" $FILE
fi
make clean
make
cd -
[guowenxue@centos6 wireless_tools]$ sh build.sh
[guowenxue@centos6 wireless_tools]$ ls wireless_tools.29/
*** iwlist *** iwspy *** iwgetid *** iwconfig ***
*** ifrename *** iwpriv *** iwevent ***
/****************************转载声明**********************************/
3, 由于wpa_supplicant依赖openssl库,所以这里我们得先交叉编译openssl,在交叉编译之前,我们得把wpa_supplicant-0.7.3.tar.gz源码中的openssl的补丁给打了,参见下面的编译脚本:
[guowenxue@centos6 wireless]$ cd openssl/
[guowenxue@centos6 openssl]$ ls
build.sh
[guowenxue@centos6 openssl]$ cat build.sh
#!/bin/sh
#+--------------------------------------------------------------------------------------------
#|Description: This shell script used to download tree wireless_tools code and cross compile it.
#| Author: GuoWenxue <guowenxue@gmail.com>
#| ChangeLog:
#+--------------------------------------------------------------------------------------------
PRJ_PATH=`pwd`
APP_NAME="openssl-0.9.8i"
PACK_SUFIX="tar.gz"
DL_ADDR="http://www.openssl.org/source/$APP_NAME.$PACK_SUFIX"
INST_PATH=$PRJ_PATH/install
#INST_PATH=../install
ARCH=arm926t
CROSS=
sup_arch=("" "arm926t" "arm920t" )
function select_arch()
{
echo "Current support ARCH: "
i=1
len=${#sup_arch[*]}
while [ $i -lt $len ]; do
echo "$i: ${sup_arch[$i]}"
let i++;
done
echo "Please select: "
index=
read index
ARCH=${sup_arch[$index]}
}
function decompress_packet()
(
echo "+---------------------------------------------+"
echo "| Decompress $1 now"
echo "+---------------------------------------------+"
ftype=`file "$1"`
case "$ftype" in
"$1: Zip archive"*)
unzip "$1" ;;
"$1: gzip compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xzf $1
else
gzip -d "$1"
fi ;;
"$1: bzip2 compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xjf $1
else
bunzip2 "$1"
fi ;;
"$1: POSIX tar archive"*)
tar -xf "$1" ;;
*)
echo "$1 is unknow compress format";;
esac
)
if [ -z $ARCH ] ; then
select_arch
fi
if [ "arm920t" != $ARCH -a "arm926t" != $ARCH ] ; then
echo "+------------------------------------------------------------------+"
echo "| ERROR: Unsupport platform $ARCH to cross compile "
echo "+------------------------------------------------------------------+"
exit -1;
else
CROSS="/opt/buildroot-2011.11/${ARCH}/usr/bin/arm-linux-"
fi
export CC=${CROSS}gcc
export CXX=${CROSS}g++
export AR=${CROSS}ar
export AS=${CROSS}as
export LD=${CROSS}ld
export NM=${CROSS}nm
export RANLIB=${CROSS}ranlib
export STRIP=${CROSS}strip
# Download source code packet
if [ ! -s $APP_NAME.$PACK_SUFIX ] ; then
echo "+------------------------------------------------------------------+"
echo "| Download $APP_NAME.$PACK_SUFIX now "
echo "+------------------------------------------------------------------+"
wget $DL_ADDR
fi
# Decompress source code packet
if [ ! -d $APP_NAME ] ; then
decompress_packet $APP_NAME.$PACK_SUFIX
fi
if [ ! -d $INST_PATH ] ; then
mkdir -p $INST_PATH
else
echo "$APP_NAME already cross compiled, exit now..."
exit;
fi
echo "+------------------------------------------------------------------+"
echo "| Build $APP_NAME for $ARCH "
echo "| Crosstool: $CROSS"
echo "+------------------------------------------------------------------+"
cd $APP_NAME
set –x
#该补丁来自wpa_supplicant源码
patch -p1 < ../patch/$APP_NAME-tls-extensions.patch
#Modify the compiler
FILE=Makefile
line=`sed -n '/^CC= cc/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|CC = ${CROSS}gcc|" $FILE
fi
line=`sed -n '/^AR=ar/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|AR = ${CROSS}ar \$(ARFLAGS) r|" $FILE
fi
line=`sed -n '/^RANLIB= /=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|RANLIB = ${CROSS}ranlib|" $FILE
fi
#Support build shared library
line=`sed -n '/^OPTIONS= /=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|OPTIONS=enable-shared no-camellia no-capieng no-cms no-gmp no-krb5 no-mdc2 no-montasm no-rc5 no-rfc3779 no-seed no-tlsext no-zlib no-zlib-dynamic|" $FILE
fi
line=`sed -n '/^SHLIB_EXT=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|SHLIB_EXT=.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)|" $FILE
fi
line=`sed -n '/^SHLIB_TARGET/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|SHLIB_TARGET=linux-shared|" $FILE
fi
line=`sed -n '/^build_all:/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|build_all: build_libs build_apps build_tests build_tools build-shared|" $FILE
fi
#Modify install path
line=`sed -n '/^INSTALLTOP=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|INSTALLTOP = $INST_PATH|" $FILE
fi
line=`sed -n '/^OPENSSLDIR=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|OPENSSLDIR = $INST_PATH|" $FILE
fi
make && make install
#cp -af *.so* $INST_PATH/lib
cd –
[guowenxue@centos6 openssl]$ sh build.sh
[guowenxue@centos6 openssl]$ ls
build.sh install openssl-0.9.8i openssl-0.9.8i.tar.gz patch
[guowenxue@centos6 openssl]$ ls install/
bin certs include lib man misc openssl.cnf private
4, 下载交叉编译wpa_supplicant的脚本
[guowenxue@centos6 wireless]$ cd wpa_supplicant/
[guowenxue@centos6 wpa_supplicant]$ ls
build.sh
[guowenxue@centos6 openssl]$ cat build.sh
#!/bin/sh
#+--------------------------------------------------------------------------------------------
#|Description: This shell script used to download tree wireless_tools code and cross compile it.
#| Author: GuoWenxue <guowenxue@gmail.com>
#| ChangeLog:
#+--------------------------------------------------------------------------------------------
PRJ_PATH=`pwd`
APP_NAME="openssl-0.9.8i"
PACK_SUFIX="tar.gz"
DL_ADDR="http://www.openssl.org/source/$APP_NAME.$PACK_SUFIX"
INST_PATH=$PRJ_PATH/install
#INST_PATH=../install
ARCH=arm926t
CROSS=
sup_arch=("" "arm926t" "arm920t" )
function select_arch()
{
echo "Current support ARCH: "
i=1
len=${#sup_arch[*]}
while [ $i -lt $len ]; do
echo "$i: ${sup_arch[$i]}"
let i++;
done
echo "Please select: "
index=
read index
ARCH=${sup_arch[$index]}
}
function decompress_packet()
(
echo "+---------------------------------------------+"
echo "| Decompress $1 now"
echo "+---------------------------------------------+"
ftype=`file "$1"`
case "$ftype" in
"$1: Zip archive"*)
unzip "$1" ;;
"$1: gzip compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xzf $1
else
gzip -d "$1"
fi ;;
"$1: bzip2 compressed"*)
if [ 0 != `expr "$1" : ".*.tar.*" ` ] ; then
tar -xjf $1
else
bunzip2 "$1"
fi ;;
"$1: POSIX tar archive"*)
tar -xf "$1" ;;
*)
echo "$1 is unknow compress format";;
esac
)
if [ -z $ARCH ] ; then
select_arch
fi
if [ "arm920t" != $ARCH -a "arm926t" != $ARCH ] ; then
echo "+------------------------------------------------------------------+"
echo "| ERROR: Unsupport platform $ARCH to cross compile "
echo "+------------------------------------------------------------------+"
exit -1;
else
CROSS="/opt/buildroot-2011.11/${ARCH}/usr/bin/arm-linux-"
fi
export CC=${CROSS}gcc
export CXX=${CROSS}g++
export AR=${CROSS}ar
export AS=${CROSS}as
export LD=${CROSS}ld
export NM=${CROSS}nm
export RANLIB=${CROSS}ranlib
export STRIP=${CROSS}strip
# Download source code packet
if [ ! -s $APP_NAME.$PACK_SUFIX ] ; then
echo "+------------------------------------------------------------------+"
echo "| Download $APP_NAME.$PACK_SUFIX now "
echo "+------------------------------------------------------------------+"
wget $DL_ADDR
fi
# Decompress source code packet
if [ ! -d $APP_NAME ] ; then
decompress_packet $APP_NAME.$PACK_SUFIX
fi
if [ ! -d $INST_PATH ] ; then
mkdir -p $INST_PATH
else
echo "$APP_NAME already cross compiled, exit now..."
exit;
fi
echo "+------------------------------------------------------------------+"
echo "| Build $APP_NAME for $ARCH "
echo "| Crosstool: $CROSS"
echo "+------------------------------------------------------------------+"
cd $APP_NAME
set -x
patch -p1 < ../patch/$APP_NAME-tls-extensions.patch
#Modify the compiler
FILE=Makefile
line=`sed -n '/^CC= cc/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|CC = ${CROSS}gcc|" $FILE
fi
line=`sed -n '/^AR=ar/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|AR = ${CROSS}ar \$(ARFLAGS) r|" $FILE
fi
line=`sed -n '/^RANLIB= /=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|RANLIB = ${CROSS}ranlib|" $FILE
fi
#Support build shared library
line=`sed -n '/^OPTIONS= /=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|OPTIONS=enable-shared no-camellia no-capieng no-cms no-gmp no-krb5 no-mdc2 no-montasm no-rc5 no-rfc3779 no-seed no-tlsext no-zlib no-zlib-dynamic|" $FILE
fi
line=`sed -n '/^SHLIB_EXT=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|SHLIB_EXT=.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)|" $FILE
fi
line=`sed -n '/^SHLIB_TARGET/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|SHLIB_TARGET=linux-shared|" $FILE
fi
line=`sed -n '/^build_all:/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|build_all: build_libs build_apps build_tests build_tools build-shared|" $FILE
fi
#Modify install path
line=`sed -n '/^INSTALLTOP=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|INSTALLTOP = $INST_PATH|" $FILE
fi
line=`sed -n '/^OPENSSLDIR=/=' $FILE`
if [ -n "$line" ] ; then
sed -i -e ${line}s"|.*|OPENSSLDIR = $INST_PATH|" $FILE
fi
make && make install
#cp -af *.so* $INST_PATH/lib
cd –
[guowenxue@centos6 wpa_supplicant]$ ls
build.sh wpa_supplicant-0.7.3 wpa_supplicant-0.7.3.tar.gz
[guowenxue@centos6 wpa_supplicant]$ ls wpa_supplicant-0.7.3/wpa_supplicant/
*** wpa_supplicant *** wpa_cli *** wpa_passphrase
5, 安装上面交叉编译出来的一些二进制可执行文件到ARM开发板上:
~ >: ls /apps/tools/
iwlist wpa_passphrase iwpriv
wpa_supplicant iwconfig
使用wpa_passphrase创建wpa_supplicant的配置文件,使用加密后的密码,不用明文。当然使用明文密码也可以连接到无线路由器:
~ >: wpa_passphrase Router_Kernel password >> wpa_supplicant.conf
~ >: cat wpa_supplicant.conf
network={
ssid="Router_Kernel"
#psk="password"
psk=81a8c46543f339bbcd0381b4d7a13673d4e02f67108d978fb545435a15d95ea5
}
修改后的配置文件如下:
~ >: cat /apps/etc/wireless/wpa_supplicant.conf
# WPA-PSK/TKIP
# wpa_supplicant -Dwext -iwlan0 -c/apps/etc/wireless/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="Router_Kernel"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
#psk="password" 这里使用明文密码也可以
psk=81a8c46543f339bbcd0381b4d7a13673d4e02f67108d978fb545435a15d95ea5
}
运行wpa_supplicant来连接无线路由器
~ >: wpa_supplicant -Dwext -iwlan0 -c/apps/etc/wireless/wpa_supplicant.conf &
Trying to associate with d8:5d:4c:18:04:7a (SSID='Router_Kernel' freq=2437 MHz)
phy2 -> rt2x00mac_conf_tx: Info - Configured TX queue 0 - CWmin: 2, CWmax: 3, Aifs: 2, TXop: 47.
phy2 -> rt2x00mac_conf_tx: Info - Configured TX queue 1 - CWmin: 3, CWmax: 4, Aifs: 2, TXop: 94.
phy2 -> rt2x00mac_conf_tx: Info - Configured TX queue 2 - CWmin: 4, CWmax: 10, Aifs: 3, TXop: 0.
phy2 -> rt2x00mac_conf_tx: Info - Configured TX queue 3 - CWmin: 4, CWmax: 10, Aifs: 7, TXop: 0.
Associated with d8:5d:4c:18:04:7a
WPA: Key negotiation completed with d8:5d:4c:18:04:7a [PTK=TKIP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to d8:5d:4c:18:04:7a completed (auth) [id=0 id_str=]
WPA: Group rekeying completed with d8:5d:4c:18:04:7a [GTK=TKIP]
~ >: iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
eth1 no wireless extensions.
wlan0 IEEE 802.11bg ESSID:"Router_Kernel"
Mode:Managed Frequency:2.437 GHz Access Point: D8:5D:4C:18:04:7A
Bit Rate=1 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=69/70 Signal level=-41 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:49 Missed beacon:0
~ >: udhcpc -i wlan0
udhcpc (v1.19.3) started
Sending discover...
Sending select for 192.168.1.100...
Lease of 192.168.1.100 obtained, lease time 7200
deleting routers
route: SIOCDELRT: No such process
adding dns 4.2.2.2
adding dns 8.8.8.8
~ >: ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:E0:4C:D4:04:76
inet addr:192.168.1.100 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:575 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26672 (26.0 KiB) TX bytes:1300 (1.2 KiB)
~ >: ifconfig eth1 down
~ >: ifconfig eth0 down
~ >: ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:510 (510.0 B) TX bytes:510 (510.0 B)
wlan0 Link encap:Ethernet HWaddr 00:E0:4C:D4:04:76
inet addr:192.168.1.100 Bcast:255.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5521 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:244469 (238.7 KiB) TX bytes:5454 (5.3 KiB)
~ >: ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=11.123 ms
64 bytes from 192.168.1.2: seq=1 ttl=64 time=3.467 ms
^C
--- 192.168.1.2 ping statistics ---
3 packets transmitted, 2 packets received, 33% packet loss
round-trip min/avg/max = 3.467/7.295/11.123 ms
参考:
wpa_supplicant的编译,使用参考:
http://blog.csdn.net/farsight2009/article/details/5660878
http://www.linuxidc.com/Linux/2011-10/45202.htm
http://www.cnblogs.com/zhuqing/archive/2011/04/06/2006763.html
http://blog.chinaunix.net/space.php?uid=22915173&do=blog&id=88182
S3C2440实现wifi、3G上网和迷你无线路由的制作(一)的更多相关文章
- 人不在囧途 便携式3G上网设备+套餐推介
来源: http://network.pconline.com.cn/317/3174920_all.html [PConline资讯]过年回家,本该是再高兴不过的事,可一想到要在路上颠簸数十个小时, ...
- 电脑能上网,手机连上wifi不能上网
电脑能上网,手机连上wifi不能上网 ,其实只要把手机的dhcp 改为我们熟悉的就行了 我此处就设置为114.114.114.114
- 简单两行,实现无线WiFi共享上网,手机抓包再也不用愁了
你是否为WiFi共享而发愁,各个无线共享软件,某某共享精灵,某某免费WiFi,某某共享大师,某某随身WiFi,一个比一个难用,一个比一个私货多,一个比一个广告多,如果装上了它们,你的电脑就基本沦陷了, ...
- 每次开机后需要重新连接wifi才能上网
这几天打开电脑后,每次都要重新连接wifi才能上网, 网上查到如下解决方法: 打开网络和共享中心->右键无线网络->配置->电源管理->允许计算机关闭此设备以节约电源(勾选去掉 ...
- 手动设置3G的wifi迷你无线路由
1.插入中兴的3G无线网卡,终端上显示如下内容: ~ >: usb 1-1.3: new full speed USB device number 11 using s3c2410-ohci u ...
- Win7笔记本电脑启用虚拟WIFI共享上网
今天看了一个帖子,win7系统通过笔记本的无线网卡,启用虚拟Wifi功能共享上网,自己尝试了一下,感觉很好用,至少没有无线路由的自己,手机可以上wifi了,更新软件玩微信等等,都方便多了,好了,废话不 ...
- 房间WIFI信号不好怎么办?——无线路由桥接(WDS)
背景 1.无线路由在客厅,房间的WIFI信号很差,只有1-2格,虽说是100M的网速,但是从客厅到房间要经过3道墙!电脑的无线接收功能一般都很一般,网速不好理所当然. 2.弄一根网线从客厅连接起来很傻 ...
- [置顶] Android系统移植与调试之------->如何修改Android设备添加3G上网功能
1.首先先来看一下修改前后的效果对比图 step1.插上3G设备前 step2.插上3G设备后,获取信号中.... step3.插上3G设备后,获取到信号 step4.使用3G信号浏览网页 2.下面讲 ...
- 简单的方法来改善手机3G上网速度(2G转3G)
这里提到的方法是将手机信号不好的地方(也就是2G信号)强制转换为3G信号上网以至于提高上网速度,大家常常看到在某个地方(比方坐地铁)手机明明是3G卡,却显示的是2G信号,这就是手机老在2 ...
随机推荐
- delete 多表删除的使用(连表删除)
delete 多表删除的使用 1.从数据表t1中把那些id值在数据表t2里有匹配的记录全删除掉 DELETE t1 FROM t1,t2 WHERE t1.id=t2.id 或 DELETE ...
- jquery $ dollar符号用法总结
参考:https://github.com/chyingp/blog/blob/master/jquery/jQuery%E6%BA%90%E7%A0%81-%E7%BE%8E%E5%85%83$%E ...
- perl tk说明
介绍: perl/Tk(也被称为pTK) 是一个模块和代码的收集,尝试 简单的配置Tk 8 部件工具包到强大的词素文文字, 动态内存,I/O, 和面向对象,它是一种解释脚本语言 来制作部件和程序 使用 ...
- codevs1039 数的划分
题目描述 Description 将整数n分成k份,且每份不能为空,任意两种划分方案不能相同(不考虑顺序). 例如:n=7,k=3,下面三种划分方案被认为是相同的. 1 1 5 1 5 1 5 1 1 ...
- Sublime Text 3 Build 3047 32bit/64bit 简体中文安装破解版
Sublime Text 3 Build 3047 32bit/64bit 简体中文安装破解版 Sublime Text 3 Build 3047 32bit 简体中文安装破解版下载:http://y ...
- Linux常用C函数---字符测试篇
函数讲解部分参考http://net.pku.edu.cn/~yhf/linux_c/ isalnum(测试字符是否为英文或数字) 相关函数 isalpha,isdigit,islower,isupp ...
- (续)顺序表之单循环链表(C语言实现)
单循环链表和单链表的唯一区别在于单循环链表的最后一个节点的指针域指向第一个节点, 使得整个链表形成一个环. C实现代码如下: #include<stdio.h> typedef struc ...
- 可执行文件(ELF)格式的理解
摘自http://www.cnblogs.com/xmphoenix/archive/2011/10/23/2221879.html 可执行文件(ELF)格式的理解 ELF(Executable an ...
- uva 748 Exponentiation 浮点数乘方运算 高精度水题
输入的前六位数表示一个小数,然后输入一个数表示几次方.要求用高精度算出结果. 高精度水题,主要注意处理小数点,先在输入时把小数点提取出来并记录位置,用普通乘法计算出结果后由后向前计算位置添加小数点. ...
- ajax封装
/** * ITCAST WEB * Created by zhousg on 2016/5/24. */ /* * 1. 请求的类型 type get post * 2. 请求地址 url * 3. ...