1./work/AP22_LSDK/lsdk-9.5.5.36/linux/kernels/mips-linux-2.6.31 // kernel path
2.tuboot // uboot bin
3.mi124_f1e-jffs2 // rootfs bin
4.build.sh // by myself edit build project
5.mkjffs2.sh // pack of rootfs
6.ar9342的热点发射不需要使用hostapd ,使用wlanconfig 工具创建的vap,设置参数后启动即可。
7.wifi的sta模式也是需要创建vap 不过是sta模式,使用wpa_supplicant工具来连接wifi
8.11n有两种频带模式:HT(High Throughput)20 和 HT40 频道带宽不一样,一个区域内存在11b/g信号,为了减少干扰,需设置成HT20,减少频带的重叠。HT40 需要40M带宽最好在5G使用。
9. 登陆名: root ,密码: ar9342-qual 。
10.rcS 文件运行 /etc/rc.d/rc.network 启动了ifconfig $LAN_IF up ( export LAN_IF=eth1)
/etc/rc.d/rc.bridge 创建了br0 , /etc/rc.d/rc.network 和/etc/rc.d/rc.bridge 和wifi 没有关系
wifi 启动脚本/etc/ath/apup
/etc/rc.d/rc.wlan 加载内核驱动
ap_startmode repeater-ind
makeVAP ap-wds-ind Atheros_XSpan_2G 0:RF:6:11NGHT20
makeVAP sta-wds-ind [essid] 0:RF:6:11NGHT20
MODE= ap SUB_MODE=wds ind 0 6 11NGHT20
ap:
iwpriv ${APNAME} bgscan 0
sta:
iwpriv ${APNAME} bgscan 0
桥接不等于中继
A B C 三台路由器
A 和 B 进行桥接 , B 和 C 进行桥接 , A C 不能桥接
A 和 B 中继 ,B和C 中继 A和C 可以中继
iwlist ath0 scan | grep -A 5 WiFi-1080P-141D06 | grep Channel | awk ‘/[0-9][0-9]+/{ print $4}’
13 awk -F " " ‘{if(NR==3) print $4 }’ ./awk_test.txt | grep -oE “[0-9]+” 取得通道号 , 板子不支持 -oE。
awk -F ‘:’ ‘{if (NR==1) print $2}’ ./awk_test.txt 取得wifi名
cat awk_test.txt | tail -n 1 取得最后一行
book@book-virtual-machine:/work/AP22_LSDK/lsdk-9.5.5.36$ cat awk_test.txt
ESSID:“WiFi-1080P-GPS-1434EC”
Mode:Master
Frequency:5.18 GHz (Channel 36)
Quality=94/94 Signal level=-42 dBm Noise level=-95 dBm
14 sed -r ‘s/[^0-9.]+//g’ 查找数字
iwlist ath0 scan | grep -A 2 “WiFi-1080P-GPS” | sed -n ‘1,3p’ > iwlist.txt 取第一次匹配的三行
cat iwlist.txt | tail -n 1 | sed -r ‘s/^.*Channel//g’ | sed -r ‘s/[^0-9.]+//g’ 取得通道号 。
grep “WiFi-1080P-GPS” ./iwlist.txt | sed -r ‘s/.*ESSID://g’ 取得wifi名
sed -i ‘s/ ssid=.*/ ssid=“WiFi-1080P-GPS-1434EC”/g’ /etc/wpa.conf 替换wifi名
15 shell 死循环
while [ 1 -eq 1 ]
do
if [ $? -eq 0 ]
then
echo “==0”
else
break
fi
done
获取行数
wc /tmp/.iwlist.txt -l | sed -r ‘s/[0-9]+//g’
删除掉字符串最后面-和后面的字符,并拼接-R-
ap_name= “WiFi-1080P-GPS-1434EC”
local_ap=`echo ${ap_name%-*}"-R-"`
local_ap 等于 WiFi-1080P-GPS-R-
16 排序
grep “Signal level” /tmp/.iwlist.txt | sed -r ‘s/.*Signal level//g’ | sort -n
17
6 cmdlinepart partitions found on MTD device ath-nor0
Creating 6 MTD partitions on "ath-nor0":
0x000000000000-0x000000008000 : "u-boot1"
mtd: partition "u-boot1" doesn't end on an erase block -- force read-only
0x000000008000-0x000000010000 : "u-boot2"
mtd: partition "u-boot2" doesn't start on an erase block boundary -- force read-only
0x000000010000-0x000000300000 : "rootfs"
0x000000300000-0x0000003e0000 : "uImage"
0x0000003e0000-0x0000003f0000 : "mib0"
0x0000003f0000-0x000000400000 : "ART"
setenv ipaddr 192.168.10.1;setenv serverip 192.168.10.157;tftp 0x80060000 mi124_f1e-jffs2;erase 0x9f000000 +0x70000;cp.b $fileaddr 0x9f000000 0x7e0000
setenv ipaddr 192.168.10.1;setenv serverip 192.168.10.157;tftp 0x80060000 mi124_f1e-jffs2;erase 0x9f010000 +0x7e0000;cp.b $fileaddr 0x9f010000 0x7e0000
tftp 0x80060000 ${dir}tuboot_mi124_f1e.bin&&erase 0x9f000000 +0x10000&&cp.b $fileaddr 0x9f000000 0x10000
18
/etc/rc.d # cat sta_connect.sh
#dd if=/dev/mtdblock5 of=/tmp/mac skip=4098 bs=1 count=6
#hexdump /tmp/mac > /tmp/mac_ascii
MAC_SUFFIX2=`sed -n '1p' /tmp/mac_ascii | cut -f3 -d' ' | cut -c3-4`
MAC_SUFFIX3=`sed -n '1p' /tmp/mac_ascii | cut -f4 -d' '`
while [ 1 -eq 1 ]
do
iwlist ath0 scan | grep -A 3 "WiFi-1080P-GPS" > /tmp/.iwlist.txt
if [ $? -eq 0 ]
then
singal_level=`grep "Signal level" /tmp/.iwlist.txt | sed -r 's/.*Signal level//g' | sort -n | awk -F "Noise" '{ if(NR==1) print $1}'`
grep -B 3 "$singal_level" /tmp/.iwlist.txt > /tmp/.iwlist.tmp
rm /tmp/.iwlist.txt
sed -n '1,3p' /tmp/.iwlist.tmp > /tmp/iwlist.txt
channel=`cat /tmp/iwlist.txt | tail -n 1 | sed -r 's/^.*Channel//g' | sed -r 's/[^0-9.]+//g'`
ap_name=`grep "ESSID" /tmp/iwlist.txt | sed -r 's/.*ESSID://g'`
echo $channel $ap_name
local_ap=`echo ${ap_name%-*}"-R-"`
echo $local_ap
iwconfig ath0 essid $local_ap$MAC_SUFFIX2$MAC_SUFFIX3
cp /etc/wpa.conf /tmp/wpa.conf
sed -i "s/ ssid=.*/ ssid=$ap_name/g" /tmp/wpa.conf
iwconfig ath0 channel $channel
if [ 161 -eq $channel ]
then
echo "161 is us"
iwpriv wifi0 setCountry US
else if [ 36 -eq $channel ]
then
echo "36 is JP"
iwpriv wifi0 setCountry JP
fi
fi
wpa_supplicant -i ath1 -b br0 -c /tmp/wpa.conf &
break;
else
echo "continue scan "
fi
sleep 5
done