arm环境下,wpa_supplicant交错编译+wifi sta毗连详解

立山  论坛元老 | 2025-2-21 11:52:42 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 1004|帖子 1004|积分 3012

1、前言

        wpa_supplicant 是一个用于 WiFi 客户端的加密认证工具,支持 WEP、WPA、WPA2 等多种加密方式。它通常与 wpa_cli 共同使用,用于管理 WiFi 毗连。本文讲解wpa_supplicant 交错编译全过程以及开发板使用wpa_supplican和udhcpc毗连wifi全过程详解。
2、前期预备

假造机:ubuntu18.04
源码:
        libnl-3.11.0.tar.gz
        openssl-1.0.2u.tar.gz
        wpa_supplicant-2.10.tar.gz
代码以及配置文件都已经上传到我的gitee
wpa_supplicent: wpa_supplicent交错编译
3、源码编译

在所有源码目录下建一个文件夹,命名pkgconfig

后续将libnl和opssl编译天生的pkg文件都复制到这个目录下,这是为了wpa_supplicant编译时更好找到libnl和opssl的头文件和库
1、libopssl编译

  1. ./config  no-asm shared --prefix=$PWD/_install --cross-compile-prefix=arm-gcc7.3-linux-musleabi-
  2. make CC=arm-gcc7.3-linux-musleabi-gcc
  3. make install
复制代码
需要留意的是如果编译报错:unrecognized command line option '-m64' 
直接编辑Makefile,把-m64选项删除即可
将install目录下天生的lib/pkg目录下的.pc文件都复制到上面建的pkgconfig目录下

2、libnl编译

  1. ./configure --host=arm-gcc7.3-linux-musleabi --prefix=$PWD/_install
  2. make install
复制代码
编译完了,同理,将 .pc文件都复制到上面建的pkgconfig目录下
3、wpa_supplicant编译

wpa_supplicant源码的默认配置里有很多是不需要的,可以做一些裁剪,固然也可以用他的默认配置
使用默认配置:
  1. cp defconfig .config
复制代码
裁剪后的配置文件.config
  1. # Example wpa_supplicant build time configuration
  2. #
  3. # This file lists the configuration options that are used when building the
  4. # hostapd binary. All lines starting with # are ignored. Configuration option
  5. # lines must be commented out complete, if they are not to be included, i.e.,
  6. # just setting VARIABLE=n is not disabling that variable.
  7. #
  8. # This file is included in Makefile, so variables like CFLAGS and LIBS can also
  9. # be modified from here. In most cases, these lines should use += in order not
  10. # to override previous values of the variables.
  11. BOARD_WIFI_VENDOR=realtek
  12. # Uncomment following two lines and fix the paths if you have installed OpenSSL
  13. # or GnuTLS in non-default location
  14. #CFLAGS += -I/usr/local/openssl/include
  15. #LIBS += -L/usr/local/openssl/lib
  16. # Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  17. # the kerberos files are not in the default include path. Following line can be
  18. # used to fix build issues on such systems (krb5.h not found).
  19. #CFLAGS += -I/usr/include/kerberos
  20. # Driver interface for generic Linux wireless extensions
  21. # Note: WEXT is deprecated in the current Linux kernel version and no new
  22. # functionality is added to it. nl80211-based interface is the new
  23. # replacement for WEXT and its use allows wpa_supplicant to properly control
  24. # the driver to improve existing functionality like roaming and to support new
  25. # functionality.
  26. #CONFIG_DRIVER_WEXT=y
  27. # Driver interface for Linux drivers using the nl80211 kernel interface
  28. CONFIG_DRIVER_NL80211=y
  29. # QCA vendor extensions to nl80211
  30. #CONFIG_DRIVER_NL80211_QCA=y
  31. # driver_nl80211.c requires libnl. If you are compiling it yourself
  32. # you may need to point hostapd to your version of libnl.
  33. #
  34. #CFLAGS += -I$<path to libnl include files>
  35. #LIBS += -L$<path to libnl library files>
  36. # Use libnl v2.0 (or 3.0) libraries.
  37. #CONFIG_LIBNL20=y
  38. # Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
  39. #CONFIG_LIBNL32=y
  40. # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  41. #CONFIG_DRIVER_BSD=y
  42. #CFLAGS += -I/usr/local/include
  43. #LIBS += -L/usr/local/lib
  44. #LIBS_p += -L/usr/local/lib
  45. #LIBS_c += -L/usr/local/lib
  46. # Driver interface for Windows NDIS
  47. #CONFIG_DRIVER_NDIS=y
  48. #CFLAGS += -I/usr/include/w32api/ddk
  49. #LIBS += -L/usr/local/lib
  50. # For native build using mingw
  51. #CONFIG_NATIVE_WINDOWS=y
  52. # Additional directories for cross-compilation on Linux host for mingw target
  53. #CFLAGS += -I/opt/mingw/mingw32/include/ddk
  54. #LIBS += -L/opt/mingw/mingw32/lib
  55. #CC=mingw32-gcc
  56. # By default, driver_ndis uses WinPcap for low-level operations. This can be
  57. # replaced with the following option which replaces WinPcap calls with NDISUIO.
  58. # However, this requires that WZC is disabled (net stop wzcsvc) before starting
  59. # wpa_supplicant.
  60. # CONFIG_USE_NDISUIO=y
  61. # Driver interface for wired Ethernet drivers
  62. #CONFIG_DRIVER_WIRED=y
  63. # Driver interface for the Broadcom RoboSwitch family
  64. #CONFIG_DRIVER_ROBOSWITCH=y
  65. # Driver interface for no driver (e.g., WPS ER only)
  66. #CONFIG_DRIVER_NONE=y
  67. # Solaris libraries
  68. #LIBS += -lsocket -ldlpi -lnsl
  69. #LIBS_c += -lsocket
  70. # Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  71. # included)
  72. CONFIG_IEEE8021X_EAPOL=y
  73. # EAP-MD5
  74. CONFIG_EAP_MD5=y
  75. # EAP-MSCHAPv2
  76. CONFIG_EAP_MSCHAPV2=y
  77. # EAP-TLS
  78. CONFIG_EAP_TLS=y
  79. # EAL-PEAP
  80. CONFIG_EAP_PEAP=y
  81. # EAP-TTLS
  82. CONFIG_EAP_TTLS=y
  83. # EAP-FAST
  84. # Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed
  85. # for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g.,
  86. # with openssl-0.9.8x-tls-extensions.patch, to add the needed functions.
  87. # CONFIG_EAP_FAST=y
  88. # EAP-GTC
  89. CONFIG_EAP_GTC=y
  90. # EAP-OTP
  91. CONFIG_EAP_OTP=y
  92. # EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  93. # CONFIG_EAP_SIM=y
  94. # EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  95. #CONFIG_EAP_PSK=y
  96. # EAP-pwd (secure authentication using only a password)
  97. #CONFIG_EAP_PWD=y
  98. # EAP-PAX
  99. #CONFIG_EAP_PAX=y
  100. # LEAP
  101. CONFIG_EAP_LEAP=y
  102. # EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  103. # CONFIG_EAP_AKA=y
  104. # EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  105. # This requires CONFIG_EAP_AKA to be enabled, too.
  106. # CONFIG_EAP_AKA_PRIME=y
  107. # Enable USIM simulator (Milenage) for EAP-AKA
  108. #CONFIG_USIM_SIMULATOR=y
  109. # EAP-SAKE
  110. #CONFIG_EAP_SAKE=y
  111. # EAP-GPSK
  112. #CONFIG_EAP_GPSK=y
  113. # Include support for optional SHA256 cipher suite in EAP-GPSK
  114. #CONFIG_EAP_GPSK_SHA256=y
  115. # EAP-TNC and related Trusted Network Connect support (experimental)
  116. #CONFIG_EAP_TNC=y
  117. # Wi-Fi Protected Setup (WPS)
  118. # CONFIG_WPS=y
  119. # Enable WPS external registrar functionality
  120. # CONFIG_WPS_ER=y
  121. # Disable credentials for an open network by default when acting as a WPS
  122. # registrar.
  123. #CONFIG_WPS_REG_DISABLE_OPEN=y
  124. # Enable WPS support with NFC config method
  125. # CONFIG_WPS_NFC=y
  126. # EAP-IKEv2
  127. #CONFIG_EAP_IKEV2=y
  128. # EAP-EKE
  129. #CONFIG_EAP_EKE=y
  130. # PKCS#12 (PFX) support (used to read private key and certificate file from
  131. # a file that usually has extension .p12 or .pfx)
  132. CONFIG_PKCS12=y
  133. # Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  134. # engine.
  135. CONFIG_SMARTCARD=y
  136. # PC/SC interface for smartcards (USIM, GSM SIM)
  137. # Enable this if EAP-SIM or EAP-AKA is included
  138. #CONFIG_PCSC=y
  139. # Support HT overrides (disable HT/HT40, mask MCS rates, etc.)
  140. #CONFIG_HT_OVERRIDES=y
  141. # Support VHT overrides (disable VHT, mask MCS rates, etc.)
  142. #CONFIG_VHT_OVERRIDES=y
  143. # Development testing
  144. #CONFIG_EAPOL_TEST=y
  145. # Select control interface backend for external programs, e.g, wpa_cli:
  146. # unix = UNIX domain sockets (default for Linux/*BSD)
  147. # udp = UDP sockets using localhost (127.0.0.1)
  148. # udp6 = UDP IPv6 sockets using localhost (::1)
  149. # named_pipe = Windows Named Pipe (default for Windows)
  150. # udp-remote = UDP sockets with remote access (only for tests systems/purpose)
  151. # udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
  152. # y = use default (backwards compatibility)
  153. # If this option is commented out, control interface is not included in the
  154. # build.
  155. CONFIG_CTRL_IFACE=y
  156. # Include support for GNU Readline and History Libraries in wpa_cli.
  157. # When building a wpa_cli binary for distribution, please note that these
  158. # libraries are licensed under GPL and as such, BSD license may not apply for
  159. # the resulting binary.
  160. #CONFIG_READLINE=y
  161. # Include internal line edit mode in wpa_cli. This can be used as a replacement
  162. # for GNU Readline to provide limited command line editing and history support.
  163. # CONFIG_WPA_CLI_EDIT=y
  164. # Remove debugging code that is printing out debug message to stdout.
  165. # This can be used to reduce the size of the wpa_supplicant considerably
  166. # if debugging code is not needed. The size reduction can be around 35%
  167. # (e.g., 90 kB).
  168. #CONFIG_NO_STDOUT_DEBUG=y
  169. # Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  170. # 35-50 kB in code size.
  171. #CONFIG_NO_WPA=y
  172. # Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  173. # This option can be used to reduce code size by removing support for
  174. # converting ASCII passphrases into PSK. If this functionality is removed, the
  175. # PSK can only be configured as the 64-octet hexstring (e.g., from
  176. # wpa_passphrase). This saves about 0.5 kB in code size.
  177. #CONFIG_NO_WPA_PASSPHRASE=y
  178. # Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  179. # This can be used if ap_scan=1 mode is never enabled.
  180. #CONFIG_NO_SCAN_PROCESSING=y
  181. # Select configuration backend:
  182. # file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  183. #        path is given on command line, not here; this option is just used to
  184. #        select the backend that allows configuration files to be used)
  185. # winreg = Windows registry (see win_example.reg for an example)
  186. CONFIG_BACKEND=file
  187. # Remove configuration write functionality (i.e., to allow the configuration
  188. # file to be updated based on runtime configuration changes). The runtime
  189. # configuration can still be changed, the changes are just not going to be
  190. # persistent over restarts. This option can be used to reduce code size by
  191. # about 3.5 kB.
  192. #CONFIG_NO_CONFIG_WRITE=y
  193. # Remove support for configuration blobs to reduce code size by about 1.5 kB.
  194. #CONFIG_NO_CONFIG_BLOBS=y
  195. # Select program entry point implementation:
  196. # main = UNIX/POSIX like main() function (default)
  197. # main_winsvc = Windows service (read parameters from registry)
  198. # main_none = Very basic example (development use only)
  199. #CONFIG_MAIN=main
  200. # Select wrapper for operating system and C library specific functions
  201. # unix = UNIX/POSIX like systems (default)
  202. # win32 = Windows systems
  203. # none = Empty template
  204. # CONFIG_OS=unix
  205. # Select event loop implementation
  206. # eloop = select() loop (default)
  207. # eloop_win = Windows events and WaitForMultipleObject() loop
  208. # CONFIG_ELOOP=eloop
  209. # Should we use poll instead of select? Select is used by default.
  210. #CONFIG_ELOOP_POLL=y
  211. # Should we use epoll instead of select? Select is used by default.
  212. #CONFIG_ELOOP_EPOLL=y
  213. # Should we use kqueue instead of select? Select is used by default.
  214. #CONFIG_ELOOP_KQUEUE=y
  215. # Select layer 2 packet implementation
  216. # linux = Linux packet socket (default)
  217. # pcap = libpcap/libdnet/WinPcap
  218. # freebsd = FreeBSD libpcap
  219. # winpcap = WinPcap with receive thread
  220. # ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  221. # none = Empty template
  222. # CONFIG_L2_PACKET=linux
  223. # Disable Linux packet socket workaround applicable for station interface
  224. # in a bridge for EAPOL frames. This should be uncommented only if the kernel
  225. # is known to not have the regression issue in packet socket behavior with
  226. # bridge interfaces (commit 'bridge: respect RFC2863 operational state')').
  227. #CONFIG_NO_LINUX_PACKET_SOCKET_WAR=y
  228. # PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  229. CONFIG_PEERKEY=y
  230. # IEEE 802.11w (management frame protection), also known as PMF
  231. # Driver support is also needed for IEEE 802.11w.
  232. # CONFIG_IEEE80211W=y
  233. # Select TLS implementation
  234. # openssl = OpenSSL (default)
  235. # gnutls = GnuTLS
  236. # internal = Internal TLSv1 implementation (experimental)
  237. # none = Empty template
  238. CONFIG_TLS=internal
  239. # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
  240. # can be enabled to get a stronger construction of messages when block ciphers
  241. # are used. It should be noted that some existing TLS v1.0 -based
  242. # implementation may not be compatible with TLS v1.1 message (ClientHello is
  243. # sent prior to negotiating which version will be used)
  244. #CONFIG_TLSV11=y
  245. # TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.2)
  246. # can be enabled to enable use of stronger crypto algorithms. It should be
  247. # noted that some existing TLS v1.0 -based implementation may not be compatible
  248. # with TLS v1.2 message (ClientHello is sent prior to negotiating which version
  249. # will be used)
  250. #CONFIG_TLSV12=y
  251. # If CONFIG_TLS=internal is used, additional library and include paths are
  252. # needed for LibTomMath. Alternatively, an integrated, minimal version of
  253. # LibTomMath can be used. See beginning of libtommath.c for details on benefits
  254. # and drawbacks of this option.
  255. CONFIG_INTERNAL_LIBTOMMATH=y
  256. #ifndef CONFIG_INTERNAL_LIBTOMMATH
  257. #LTM_PATH=/usr/src/libtommath-0.39
  258. #CFLAGS += -I$(LTM_PATH)
  259. #LIBS += -L$(LTM_PATH)
  260. #LIBS_p += -L$(LTM_PATH)
  261. #endif
  262. # At the cost of about 4 kB of additional binary size, the internal LibTomMath
  263. # can be configured to include faster routines for exptmod, sqr, and div to
  264. # speed up DH and RSA calculation considerably
  265. #CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  266. # Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  267. # This is only for Windows builds and requires WMI-related header files and
  268. # WbemUuid.Lib from Platform SDK even when building with MinGW.
  269. #CONFIG_NDIS_EVENTS_INTEGRATED=y
  270. #PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  271. # Add support for old DBus control interface
  272. # (fi.epitest.hostap.WPASupplicant)
  273. #CONFIG_CTRL_IFACE_DBUS=y
  274. # Add support for new DBus control interface
  275. # (fi.w1.hostap.wpa_supplicant1)
  276. #CONFIG_CTRL_IFACE_DBUS_NEW=y
  277. # Add introspection support for new DBus control interface
  278. #CONFIG_CTRL_IFACE_DBUS_INTRO=y
  279. # Add support for loading EAP methods dynamically as shared libraries.
  280. # When this option is enabled, each EAP method can be either included
  281. # statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  282. # Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  283. # be loaded in the beginning of the wpa_supplicant configuration file
  284. # (see load_dynamic_eap parameter in the example file) before being used in
  285. # the network blocks.
  286. #
  287. # Note that some shared parts of EAP methods are included in the main program
  288. # and in order to be able to use dynamic EAP methods using these parts, the
  289. # main program must have been build with the EAP method enabled (=y or =dyn).
  290. # This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  291. # unless at least one of them was included in the main build to force inclusion
  292. # of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  293. # in the main build to be able to load these methods dynamically.
  294. #
  295. # Please also note that using dynamic libraries will increase the total binary
  296. # size. Thus, it may not be the best option for targets that have limited
  297. # amount of memory/flash.
  298. #CONFIG_DYNAMIC_EAP_METHODS=y
  299. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  300. # CONFIG_IEEE80211R=y
  301. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  302. # CONFIG_DEBUG_FILE=y
  303. # Send debug messages to syslog instead of stdout
  304. #CONFIG_DEBUG_SYSLOG=y
  305. # Set syslog facility for debug messages
  306. #CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
  307. # Add support for sending all debug messages (regardless of debug verbosity)
  308. # to the Linux kernel tracing facility. This helps debug the entire stack by
  309. # making it easy to record everything happening from the driver up into the
  310. # same file, e.g., using trace-cmd.
  311. #CONFIG_DEBUG_LINUX_TRACING=y
  312. # Add support for writing debug log to Android logcat instead of standard
  313. # output
  314. # CONFIG_ANDROID_LOG=y
  315. # Enable privilege separation (see README 'Privilege separation' for details)
  316. #CONFIG_PRIVSEP=y
  317. # Enable mitigation against certain attacks against TKIP by delaying Michael
  318. # MIC error reports by a random amount of time between 0 and 60 seconds
  319. #CONFIG_DELAYED_MIC_ERROR_REPORT=y
  320. # Enable tracing code for developer debugging
  321. # This tracks use of memory allocations and other registrations and reports
  322. # incorrect use with a backtrace of call (or allocation) location.
  323. #CONFIG_WPA_TRACE=y
  324. # For BSD, uncomment these.
  325. #LIBS += -lexecinfo
  326. #LIBS_p += -lexecinfo
  327. #LIBS_c += -lexecinfo
  328. # Use libbfd to get more details for developer debugging
  329. # This enables use of libbfd to get more detailed symbols for the backtraces
  330. # generated by CONFIG_WPA_TRACE=y.
  331. #CONFIG_WPA_TRACE_BFD=y
  332. # For BSD, uncomment these.
  333. #LIBS += -lbfd -liberty -lz
  334. #LIBS_p += -lbfd -liberty -lz
  335. #LIBS_c += -lbfd -liberty -lz
  336. # wpa_supplicant depends on strong random number generation being available
  337. # from the operating system. os_get_random() function is used to fetch random
  338. # data when needed, e.g., for key generation. On Linux and BSD systems, this
  339. # works by reading /dev/urandom. It should be noted that the OS entropy pool
  340. # needs to be properly initialized before wpa_supplicant is started. This is
  341. # important especially on embedded devices that do not have a hardware random
  342. # number generator and may by default start up with minimal entropy available
  343. # for random number generation.
  344. #
  345. # As a safety net, wpa_supplicant is by default trying to internally collect
  346. # additional entropy for generating random data to mix in with the data fetched
  347. # from the OS. This by itself is not considered to be very strong, but it may
  348. # help in cases where the system pool is not initialized properly. However, it
  349. # is very strongly recommended that the system pool is initialized with enough
  350. # entropy either by using hardware assisted random number generator or by
  351. # storing state over device reboots.
  352. #
  353. # wpa_supplicant can be configured to maintain its own entropy store over
  354. # restarts to enhance random number generation. This is not perfect, but it is
  355. # much more secure than using the same sequence of random numbers after every
  356. # reboot. This can be enabled with -e<entropy file> command line option. The
  357. # specified file needs to be readable and writable by wpa_supplicant.
  358. #
  359. # If the os_get_random() is known to provide strong random data (e.g., on
  360. # Linux/BSD, the board in question is known to have reliable source of random
  361. # data from /dev/urandom), the internal wpa_supplicant random pool can be
  362. # disabled. This will save some in binary size and CPU use. However, this
  363. # should only be considered for builds that are known to be used on devices
  364. # that meet the requirements described above.
  365. #CONFIG_NO_RANDOM_POOL=y
  366. # IEEE 802.11n (High Throughput) support (mainly for AP mode)
  367. CONFIG_IEEE80211N=y
  368. # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode)
  369. # (depends on CONFIG_IEEE80211N)
  370. #CONFIG_IEEE80211AC=y
  371. # Wireless Network Management (IEEE Std 802.11v-2011)
  372. # Note: This is experimental and not complete implementation.
  373. # CONFIG_WNM=y
  374. # Interworking (IEEE 802.11u)
  375. # This can be used to enable functionality to improve interworking with
  376. # external networks (GAS/ANQP to learn more about the networks and network
  377. # selection based on available credentials).
  378. # CONFIG_INTERWORKING=y
  379. # Hotspot 2.0
  380. # CONFIG_HS20=y
  381. # Enable interface matching in wpa_supplicant
  382. #CONFIG_MATCH_IFACE=y
  383. # Disable roaming in wpa_supplicant
  384. # CONFIG_NO_ROAMING=y
  385. # AP mode operations with wpa_supplicant
  386. # This can be used for controlling AP mode operations with wpa_supplicant. It
  387. # should be noted that this is mainly aimed at simple cases like
  388. # WPA2-Personal while more complex configurations like WPA2-Enterprise with an
  389. # external RADIUS server can be supported with hostapd.
  390. # CONFIG_AP=y
  391. # P2P (Wi-Fi Direct)
  392. # This can be used to enable P2P support in wpa_supplicant. See README-P2P for
  393. # more information on P2P operations.
  394. # CONFIG_P2P=y
  395. # Enable TDLS support
  396. # CONFIG_TDLS=y
  397. # Wi-Fi Direct
  398. # This can be used to enable Wi-Fi Direct extensions for P2P using an external
  399. # program to control the additional information exchanges in the messages.
  400. # CONFIG_WIFI_DISPLAY=y
  401. # Autoscan
  402. # This can be used to enable automatic scan support in wpa_supplicant.
  403. # See wpa_supplicant.conf for more information on autoscan usage.
  404. #
  405. # Enabling directly a module will enable autoscan support.
  406. # For exponential module:
  407. #CONFIG_AUTOSCAN_EXPONENTIAL=y
  408. # For periodic module:
  409. #CONFIG_AUTOSCAN_PERIODIC=y
  410. # Password (and passphrase, etc.) backend for external storage
  411. # These optional mechanisms can be used to add support for storing passwords
  412. # and other secrets in external (to wpa_supplicant) location. This allows, for
  413. # example, operating system specific key storage to be used
  414. #
  415. # External password backend for testing purposes (developer use)
  416. #CONFIG_EXT_PASSWORD_TEST=y
  417. # Enable Fast Session Transfer (FST)
  418. #CONFIG_FST=y
  419. # Enable CLI commands for FST testing
  420. #CONFIG_FST_TEST=y
  421. # OS X builds. This is only for building eapol_test.
  422. #CONFIG_OSX=y
  423. # Automatic Channel Selection
  424. # This will allow wpa_supplicant to pick the channel automatically when channel
  425. # is set to "0".
  426. #
  427. # TODO: Extend parser to be able to parse "channel=acs_survey" as an alternative
  428. # to "channel=0". This would enable us to eventually add other ACS algorithms in
  429. # similar way.
  430. #
  431. # Automatic selection is currently only done through initialization, later on
  432. # we hope to do background checks to keep us moving to more ideal channels as
  433. # time goes by. ACS is currently only supported through the nl80211 driver and
  434. # your driver must have survey dump capability that is filled by the driver
  435. # during scanning.
  436. #
  437. # TODO: In analogy to hostapd be able to customize the ACS survey algorithm with
  438. # a newly to create wpa_supplicant.conf variable acs_num_scans.
  439. #
  440. # Supported ACS drivers:
  441. # * ath9k
  442. # * ath5k
  443. # * ath10k
  444. #
  445. # For more details refer to:
  446. # http://wireless.kernel.org/en/users/Documentation/acs
  447. #CONFIG_ACS=y
  448. # Support Multi Band Operation
  449. #CONFIG_MBO=y
  450. #CONFIG_MESH=y
复制代码
好了之后设置一下pkg文件的环境变量
  1. export PKG_CONFIG_PATH=/share/test/wpa/pkgconfig/:$PKG_CONFIG_PATH
  2. # /share/test/wpa/pkgconfig 一开始建的pkgconfig文件夹
复制代码
然后
  1. make CC=arm-gcc7.3-linux-musleabi-gcc
复制代码
如果有报错找不到-lnl和-lnl-genl-3,就在.config文件中添加libnl的install路径
  1. CFLAGS += -I/share/test/wpa/libnl-3.11.0/_install/include/libnl3/
  2. LIBS += -L/share/test/wpa/libnl-3.11.0/_install/lib
  3. # /share/test/wpa/libnl-3.11.0/_install libnl库install路径
复制代码
4、arm环境使用 

团体步骤:

1、安装wifi驱动
2、ifconfig wlan0 up
3、/opt/ipnc/wpa_supplicant -B -iwlan0 -c /opt/ipnc/wpa_supplicant.conf
4、udhcpc -i wlan0
留意点:

其中wpa_supplicant.conf是wifi账号和暗码的配置文件,一般配置为:
  1. ctrl_interface=/var/run/wpa_supplicant
  2. update_config=1
  3. network={
  4.         ssid="iphone30promax"
  5.         psk="12345678"
  6.         scan_ssid=1
  7. }
复制代码
udhcpc运行时有个默认脚本,这个脚本需要你自己添加,udhcpc -h可查看到脚本默认路径

default.script文件:
  1. #!/bin/sh
  2. # udhcpc script edited by Tim Riker <Tim@Rikers.org>
  3. [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
  4. RESOLV_CONF="/etc/resolv.conf"
  5. [ -e $RESOLV_CONF ] || touch $RESOLV_CONF
  6. [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
  7. [ -n "$subnet" ] && NETMASK="netmask $subnet"
  8. case "$1" in
  9.         deconfig)
  10.                 /sbin/ifconfig $interface up
  11.                 /sbin/ifconfig $interface 0.0.0.0
  12.                 # drop info from this interface
  13.                 # resolv.conf may be a symlink to /tmp/, so take care
  14.                 TMPFILE=$(mktemp)
  15.                 grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
  16.                 cat $TMPFILE > $RESOLV_CONF
  17.                 rm -f $TMPFILE
  18.                 if [ -x /usr/sbin/avahi-autoipd ]; then
  19.                         /usr/sbin/avahi-autoipd -k $interface
  20.                 fi
  21.                 ;;
  22.         leasefail|nak)
  23.                 if [ -x /usr/sbin/avahi-autoipd ]; then
  24.                         /usr/sbin/avahi-autoipd -wD $interface --no-chroot
  25.                 fi
  26.                 ;;
  27.         renew|bound)
  28.                 if [ -x /usr/sbin/avahi-autoipd ]; then
  29.                         /usr/sbin/avahi-autoipd -k $interface
  30.                 fi
  31.                 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
  32.                 if [ -n "$router" ] ; then
  33.                         echo "deleting routers"
  34.                         while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
  35.                                 :
  36.                         done
  37.                         for i in $router ; do
  38.                                 route add default gw $i dev $interface
  39.                         done
  40.                 fi
  41.                 # drop info from this interface
  42.                 # resolv.conf may be a symlink to /tmp/, so take care
  43.                 TMPFILE=$(mktemp)
  44.                 grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
  45.                 cat $TMPFILE > $RESOLV_CONF
  46.                 rm -f $TMPFILE
  47.                 # prefer rfc3359 domain search list (option 119) if available
  48.                 if [ -n "$search" ]; then
  49.                         search_list=$search
  50.                 elif [ -n "$domain" ]; then
  51.                         search_list=$domain
  52.                 fi
  53.                 [ -n "$search_list" ] &&
  54.                         echo "search $search_list # $interface" >> $RESOLV_CONF
  55.                 for i in $dns ; do
  56.                         echo adding dns $i
  57.                         echo "nameserver $i # $interface" >> $RESOLV_CONF
  58.                 done
  59.                 ;;
  60. esac
  61. HOOK_DIR="$0.d"
  62. for hook in "${HOOK_DIR}/"*; do
  63.     [ -f "${hook}" -a -x "${hook}" ] || continue
  64.     "${hook}" "${@}"
  65. done
  66. exit 0
复制代码
这几个文件我都已经上传到我的gitee。
盼望我的文章有帮助到你。 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

立山

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表