赞
踩
CONFIG_NETFILTER=y CONFIG_NF_CONNTRACK=y CONFIG_NF_TABLES=y CONFIG_NF_TABLES_INET=y CONFIG_NF_CONNTRACK_IPV4=y CONFIG_IP_NF_IPTABLES=y CONFIG_IP_NF_NAT=y CONFIG_IP_NF_TARGET_MASQUERADE=y CONFIG_BRIDGE=y CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_MANGLE=y CONFIG_IP_NF_NAT=y CONFIG_IP_NF_RAW=y CONFIG_NETFILTER_XT_MATCH_STATE=y CONFIG_WL_ROCKCHIP=y CONFIG_WIFI_BUILD_MODULE=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PLATFORM=y CONFIG_USB_NET_RNDIS_WLAN=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD_PLATFORM=y CONFIG_USB_CONFIGFS_RNDIS=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_OF_SIMPLE=y CONFIG_USB_DWC3_ROCKCHIP_INNO=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_HCD_PLATFORM=y CONFIG_USB_HID=y CONFIG_USB=y CONFIG_USB_USBNET=y CONFIG_PHY_ROCKCHIP_NANENG_USB2=y CONFIG_RFKILL=y CONFIG_RFKILL_RK=y CONFIG_CFG80211=y CONFIG_CFG80211_WEXT=y
wireless_wlan: wireless-wlan { compatible = "wlan-platdata"; rockchip,grf = <&grf>; /* clocks = <&rk809 1>; clock-names = "clk_wifi"; */ pinctrl-names = "default"; pinctrl-0 = <&wifi_init>; wifi_chip_type = "rtl8188fu"; WIFI,poweren_gpio = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>; /*WIFI,host_wake_irq = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>; */ status = "okay"; }; wireless-wlan { /omit-if-no-ref/ wifi_wake_host: wifi-wake-host { rockchip,pins = <0 RK_PB0 0 &pcfg_pull_up>; }; wifi_init: wifi-init { rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_output_high>,//wifi_enable <0 RK_PB1 RK_FUNC_GPIO &pcfg_output_high>,//usb_hub_enable //usb-switch <3 RK_PC1 RK_FUNC_GPIO &pcfg_output_high>, <3 RK_PC2 RK_FUNC_GPIO &pcfg_output_low>; }; };
删掉中间文件: buildroot/output/rockchip_rv1126_rv1109_xxx/target/etc/init.d/S45connman buildroot/output/rockchip_rv1126_rv1109_xxx/target/usr/bin/connmanctl buildroot/output/rockchip_rv1126_rv1109_xxx/target/usr/sbin/connmand app/netserver/main.c main函数直接return不执行 buildroot/output/rockchip_rv1126_rv1109/target/etc/init.d/S36load_rv1109_wifi_modules //注释掉下面这两行 printf "load wifi modules: " #insmod /system/lib/modules/"8188fu.ko" #[ $? = 0 ] && echo "OK" || echo "FAIL" #注etc/init.d/目录的文件在系统启动时会依次被调用,所以WiFi的驱动会被自动加载,这里我们注释掉它使用自己的wifi驱动 根目录external/下添加softapDemo.tgz.gz main.c下 +++ main.c/static char softap_name[64] = "wlan0"; +++ main.c/wlan_accesspoint_start(apName, apPassword); --- main.c/eth_accesspoint_start(); --- main.c/iftables_usb0_to_eth0(wan,lan); package/rockchip/Config.in 添加:source "package/rockchip/softap/Config.in" 根目录 make menuconfig BR2_PACKAGE_RKWIFIBT_RTL8188FU =y # 选择对应的WiFi型号 其实也可不选我们不用原厂wifi驱动 BR2_PACKAGE_IPC_DAEMON = n BR2_PACKAGE_NETSERVER = n BR2_PACKAGE_CONNMAN = n BR2_PACKAGE_DHCPCD = y BR2_PACKAGE_SOFTAP=y make savedefconfig make netserver-dirclean make connman-dirclean make ipc-daemon-dirclean make softap-dirclean make rkwifibt-dirclean #清除掉之前的 ./build.sh rootfs #编译文件系统 注意: 编译好看看buildroot/output/rockchip_rv1126_rv1109/target/etc/init.d/S36load_rv1109_wifi_modules 有没被覆盖,覆盖掉的话需要重新注释
修改配置
SDK\extern\rtl8188FU_linux_v5.11.5-13-g2482755ff.20210615\Makefile
CROSS_COMPILE := arm-linux-gnueabihf-
KSRC := rockchip_new_20220628/kernel
RTL模组: 使用p2p0作为softap功能,通过内核驱动的配置生成p2p0,如果没有p2p0节点请检查这里的配
置
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ANDROID
CONFIG_PLATFORM_ARM_RK2818 = y
CONFIG_AP_MODE = y
CONFIG_POWER_SAVING = n
CONFIG_MP_INCLUDED = y
make clean && make;
mkdir __install;
./configure CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar --prefix=$(pwd)/__install --host=arm-linux-gnueabihf;
make && make install;
mkdir __install;
./config no-asm no-shared --cross-compile-prefix=arm-linux-gnueabihf- --prefix=$(pwd)/__install
去掉CFLAG参数中的 -m64 ,SHARED_LDFLAGS参数中的 -m64
make && make install
cd SDK/extern/wifi_tool/wpa_supplicant_8_kk_4.4_rtw_r25669.20171213/wpa_supplicant;
cp defconfig .config;
#Makfefile中添加libnl和礼包ssl的路径
CC=arm-linux-gnueabihf-gcc
CFLAGS += -I../../libnl-1.1.4/__install/include
CFLAGS += -I../../openssl-1.0.2g/__install/include
LIBS += -L../../libnl-1.1.4/__install/lib -lnl -lm -lpthread
LIBS += -L../../openssl-1.0.2g/__install/lib -lssl -lcrypto -ldl
#编译
make clean && make; #生成wpa_supplicant和wpa_cli
arm-linux-gnueabihf-strip wpa_cli
arm-linux-gnueabihf-strip wpa_supplicant
cd SDK/extern/wifi_tool/wpa_supplicant_8_kk_4.4_rtw_r25669.20171213/hostapd;
cp defconfig .config;
#Makfefile中添加libnl和礼包ssl的路径
CC=arm-linux-gnueabihf-gcc
CFLAGS += -I../../libnl-1.1.4/__install/include
CFLAGS += -I../../openssl-1.0.2g/__install/include
LIBS += -L../../libnl-1.1.4/__install/lib -lnl -pthread
LIBS += -L../../openssl-1.0.2g/__install/lib -lssl -lcrypto -ldl
#编译
make clean &&& make;
开机后可以用lsusb命令看看是否有wifi节点(ID为下图:即为wifi模块)
运行脚本
./wifi_test.sh
cd /mnt/wifi_lib echo host > /sys/devices/platform/ff4c0000.usb2-phy/otg_mode #使能usb为Host模式,这个建议放到/etc/ini.d/rcS里面开机执行一次就好 killall softapDemo&&killall hostapd && killall udhcpd rmmod wlan sleep 1 insmod wlan.ko #加载后可以用iwlist wlan0 scan命令验证一下能不能搜索到热点 export LD_LIBRARY_PATH=/mnt/wifi_lib/nl_lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/mnt/wifi_lib/lib:$LD_LIBRARY_PATH ifconfig wlan0 up ./wpa_supplicant -B -iwlan0 -c wpa_supplicant.conf -Dnl80211 ./wpa_cli -i wlan0 status route del default;route del 255.255.255.255 udhcpc -iwlan0 -q& route add -net 255.255.255.255 netmask 255.255.255.255 dev wlan0
然后板子就可以通过wifi ping外网了
./hostapd.sh
killall wpa_supplicant
sleep 2
ifconfig wlan0 0.0.0.0
ifconfig wlan0 down
killall hostapd && killall udhcpd
softapDemo
然后可以用笔记本尝试连接热点ping板子wlan0 ip是否能通
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。