AP Mode
First, you need to configure kernel config:
# cd kernel
# ARCH=arm make menuconfig
After each configuration modification, update defconfig:
# cp .config ./arch/arm/configs/infinity2m_spinand_ssc011a_s01a_minigui_double_net_defconfig -f
After the system is up, first load the WiFi driver:
# /config/wifi/ssw01bInit.sh
# ifconfig wlan0 up
Of course, as an AP hotspot, our WiFi module needs to configure the following hotspot information:
# vi /config/wifi/hostapd.conf
Next, open the AP hotspot:
# /config/wifi/hostapd -B /config/wifi/hostapd.conf
At this point, we can search for our AP hotspot on the mobile phone / computer:
Trying to connect, found that the connection was always connected but did not succeed because the DHCP service was not turned on, and the connection failed due to the failure of assigning the connection device to the IP,Therefore, we also need to start the DHCP service (using the dnsmasq tool):
# vi /config/wifi/dnsmasq.conf
Concern dhcp-range, which represents the range of IP addresses assigned to the ring-out device:
Note that the interface is set to wlan0 here:
Since DHCP range is set to 192.168.1.X, the static IP of WLAN0 is set to 192.168.0.1:
# ifconfig wlan0 192.168.0.1
# /config/wifi/dnsmasq -i wlan0 -C /config/wifi/dnsmasq.conf
At this time, the device can be connected normally, and the assigned IP is within the range of “dhcp-range”:
Now the device can normally connect to the hotspot, but at this time, I want to connect the device to the Internet, that is, use the board as a router, eth0 as a WAN and WLAN0 as a LAN.
First, you need to confirm that eth0 can access the Internet:
# ping www.baidu.com -I eth0
This can be achieved through the brctl bridging tool. This tool is not installed by default. As before, it is obtained from buildroot:
# cd buildroot-2020.05/
# ARCH=arm make menuconfig
# cp .config ./configs/ssd20x_defconfig -f
# make BR2_JLEVEL=4
# cd ../project/image/rootfs
# rm rootfs/* -rf
# cp ../../../buildroot-2020.05/output/images/rootfs.tar ./ -f
# tar -xvf rootfs.tar -C ./rootfs/
# tar -cvf rootfs.tar.gz ./rootfs
# cd ../../../
Recompile builderoot:
# ./Release_to_customer.sh -f nand -p ssd201 -o 2D06
After updating the firmware, the previous load driver, hostapd service and dnsmasq service need to be re executed, and then execute the following command to establish the bridge:
# brctl addbr br0
# brctl addif br0 wlan0
# brctl addif br0 eth0
# ifconfig br0 up
At this point, the connected device can access the Internet normally:
So far, the debugging of sta and AP modes of WiFi has been completed.