讓Openwrt 默認開啓wifi

源碼中位置
看起來是在一個mac80211的包裏面
openwrt/trunk/package/mac80211/files/lib/wifi/mac80211.sh
修改
關閉wifi,修改熱點名


實踐上更改上面的內容之後並沒有讓wifi開啓,根本原因是不同的平臺這個位置是不一定的(參考https://downloads.openwrt.org/kamikaze/docs/openwrt.html):所提到的,節選如下:
1.2.2 Wireless
The WiFi settings are configured in the file /etc/config/wireless (currently supported on Broadcom, Atheros and mac80211). When booting the router for the first time it should detect your card and create a sample configuration file. By default ’option network lan’ is commented. This prevents unsecured sharing of the network over the wireless interface.
Each wireless driver has its own configuration script in /lib/wifi/driver_name.sh which handles driver specific options and configurations. This script is also calling driver specific binaries like wlc for Broadcom, or hostapd and wpa_supplicant for atheros.
The reason for using such architecture, is that it abstracts the driver configuration.
Generic Broadcom wireless config:
  config wifi-device      "wl0"
      option type         "broadcom"
      option channel      "5"
  
  config wifi-iface
      option device       "wl0"
  #   option network  lan
      option mode         "ap"
      option ssid         "OpenWrt"
      option hidden       "0"
      option encryption   "none"
Generic Atheros wireless config:
  config wifi-device      "wifi0"
      option type         "atheros"
      option channel      "5"
      option hwmode "11g"
  
  config wifi-iface
      option device       "wifi0"
  #   option network  lan
      option mode         "ap"
      option ssid         "OpenWrt"
      option hidden       "0"
      option encryption   "none"
Generic mac80211 wireless config:
  config wifi-device      "wifi0"
      option type         "mac80211"
      option channel      "5"
  
  config wifi-iface
      option device       "wlan0"
  #   option network  lan
      option mode         "ap"
      option ssid         "OpenWrt"
      option hidden       "0"
      option encryption   "none"
Generic multi-radio Atheros wireless config:
  config wifi-device  wifi0
      option type     atheros
      option channel  1
  
  config wifi-iface
      option device   wifi0
  #   option network  lan
      option mode     ap
      option ssid     OpenWrt_private
      option hidden   0
      option encryption none
  
  config wifi-device  wifi1
      option type     atheros
      option channel  11
  
  config wifi-iface
      option device   wifi1
  #   option network  lan
      option mode     ap
      option ssid     OpenWrt_public
      option hidden   1
      option encryption none
There are two types of config sections in this file. The ’wifi-device’ refers to the physical wifi interface and ’wifi-iface’ configures a virtual interface on top of that (if supported by the driver).
A full outline of the wireless configuration file with description of each field:
  config wifi-device    wifi device name
      option type       broadcom, atheros, mac80211
      option country    us, uk, fr, de, etc.
      option channel    1-14
      option maxassoc   1-128 (broadcom only)
      option distance   1-n
      option hwmode     11b, 11g, 11a, 11bg (atheros, mac80211)
      option rxantenna  0,1,2 (atheros, broadcom)
      option txantenna  0,1,2 (atheros, broadcom)
      option txpower  transmission power in dBm
  
  config wifi-iface
      option network  the interface you want wifi to bridge with
      option device   wifi0, wifi1, wifi2, wifiN
      option mode     ap, sta, adhoc, monitor, or wds
      option txpower  (deprecated) transmission power in dBm
      option ssid     ssid name
      option bssid    bssid address
      option encryption none, wep, psk, psk2, wpa, wpa2
      option key      encryption key
      option key1     key 1
      option key2     key 2
      option key3     key 3
      option key4     key 4
      option server   ip address
      option port     port
      option hidden   0,1
      option isolate  0,1
      option doth     0,1 (atheros, broadcom)
      option wmm      0,1 (atheros, broadcom)

Openwrt中有很多的/lib/wifi/driver_name.sh,我們可以在串口、/etc/config/wireless中查看我們的option type來確定用的是哪個driver_name.sh,如下所示:


上圖我們可以看到用的是是高通平臺qcawifi,所以需要更改qcawifi.sh


將qcawifi.sh文件中option disable 改爲0後重新編譯升級時候,設備啓動時wifi就會自動開啓
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章