Compare commits

...

8 Commits

3 changed files with 126 additions and 32 deletions

86
build.sh Executable file
View File

@@ -0,0 +1,86 @@
#!/usr/bin/env bash
set -euo pipefail
# Build wpa_supplicant for ARM toolchain with nl80211/libnl from sysroot.
#
# Usage:
# ./build.sh [SYSROOT]
#
# Example:
# ./build.sh /home/stargazer/arm-uclinuxfdpiceabi/sysroot
TOOLCHAIN_PREFIX="${TOOLCHAIN_PREFIX:-arm-uclinuxfdpiceabi}"
CC_BIN="${CC_BIN:-${TOOLCHAIN_PREFIX}-gcc}"
STRIP_BIN="${STRIP_BIN:-${TOOLCHAIN_PREFIX}-strip}"
JOBS="${JOBS:-$(nproc)}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WPA_DIR="${SCRIPT_DIR}/wpa_supplicant"
SYSROOT_DEFAULT="/home/stargazer/arm-uclinuxfdpiceabi/sysroot"
SYSROOT="${1:-${SYSROOT:-$SYSROOT_DEFAULT}}"
PKGCFG_LIBDIR_CANDIDATES=(
"${SYSROOT}/usr/lib/pkgconfig"
"${SYSROOT}/usr/lib64/pkgconfig"
"${SYSROOT}/usr/share/pkgconfig"
)
die() {
echo "ERROR: $*" >&2
exit 1
}
if ! command -v "${CC_BIN}" >/dev/null 2>&1; then
die "Compiler not found in PATH: ${CC_BIN}"
fi
if ! command -v "${STRIP_BIN}" >/dev/null 2>&1; then
die "Strip tool not found in PATH: ${STRIP_BIN}"
fi
if [ ! -d "${WPA_DIR}" ]; then
die "wpa_supplicant directory not found: ${WPA_DIR}"
fi
if [ ! -d "${SYSROOT}" ]; then
die "SYSROOT not found: ${SYSROOT}"
fi
PKG_CONFIG_LIBDIR=""
for d in "${PKGCFG_LIBDIR_CANDIDATES[@]}"; do
if [ -d "${d}" ]; then
if [ -z "${PKG_CONFIG_LIBDIR}" ]; then
PKG_CONFIG_LIBDIR="${d}"
else
PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR}:${d}"
fi
fi
done
if [ -z "${PKG_CONFIG_LIBDIR}" ]; then
die "No pkg-config directories found in SYSROOT"
fi
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT}"
export PKG_CONFIG_LIBDIR
unset PKG_CONFIG_PATH
if ! pkg-config --exists libnl-3.0; then
die "libnl-3.0.pc not found via pkg-config. Checked: ${PKG_CONFIG_LIBDIR}"
fi
if ! pkg-config --exists libnl-genl-3.0; then
die "libnl-genl-3.0.pc not found via pkg-config. Checked: ${PKG_CONFIG_LIBDIR}"
fi
echo "Compiler: ${CC_BIN}"
echo "SYSROOT: ${SYSROOT}"
echo "PKG_CONFIG_LIBDIR: ${PKG_CONFIG_LIBDIR}"
echo "libnl-3.0 version: $(pkg-config --modversion libnl-3.0)"
echo "libnl-genl-3.0 version: $(pkg-config --modversion libnl-genl-3.0)"
cd "${WPA_DIR}"
make clean
make -j"${JOBS}" CC="${CC_BIN}"
"${STRIP_BIN}" wpa_supplicant wpa_cli wpa_passphrase
echo "Build completed successfully."

View File

@@ -66,6 +66,14 @@ enum nlmsgerr_attrs {
#ifndef SOL_NETLINK #ifndef SOL_NETLINK
#define SOL_NETLINK 270 #define SOL_NETLINK 270
#endif #endif
#ifndef NLA_S8
/* libnl < 3.3 does not define signed 8-bit attr helpers */
#define NLA_S8 NLA_U8
static inline s8 nla_get_s8(struct nlattr *nla)
{
return (s8) nla_get_u8(nla);
}
#endif /* NLA_S8 */
#ifdef ANDROID #ifdef ANDROID

View File

@@ -29,7 +29,7 @@
#CONFIG_DRIVER_WEXT=y #CONFIG_DRIVER_WEXT=y
# Driver interface for Linux drivers using the nl80211 kernel interface # Driver interface for Linux drivers using the nl80211 kernel interface
#CONFIG_DRIVER_NL80211=y CONFIG_DRIVER_NL80211=y
# QCA vendor extensions to nl80211 # QCA vendor extensions to nl80211
#CONFIG_DRIVER_NL80211_QCA=y #CONFIG_DRIVER_NL80211_QCA=y
@@ -94,10 +94,10 @@ CC=arm-uclinuxfdpiceabi-gcc
CONFIG_IEEE8021X_EAPOL=y CONFIG_IEEE8021X_EAPOL=y
# EAP-MD5 # EAP-MD5
CONFIG_EAP_MD5=y #CONFIG_EAP_MD5=y
# EAP-MSCHAPv2 # EAP-MSCHAPv2
CONFIG_EAP_MSCHAPV2=y #CONFIG_EAP_MSCHAPV2=y
# EAP-TLS # EAP-TLS
CONFIG_EAP_TLS=y CONFIG_EAP_TLS=y
@@ -112,7 +112,7 @@ CONFIG_EAP_PEAP=y
CONFIG_EAP_TTLS=y CONFIG_EAP_TTLS=y
# EAP-FAST # EAP-FAST
CONFIG_EAP_FAST=y #CONFIG_EAP_FAST=y
# EAP-TEAP # EAP-TEAP
# Note: The current EAP-TEAP implementation is experimental and should not be # Note: The current EAP-TEAP implementation is experimental and should not be
@@ -125,10 +125,10 @@ CONFIG_EAP_FAST=y
#CONFIG_EAP_TEAP=y #CONFIG_EAP_TEAP=y
# EAP-GTC # EAP-GTC
CONFIG_EAP_GTC=y #CONFIG_EAP_GTC=y
# EAP-OTP # EAP-OTP
CONFIG_EAP_OTP=y #CONFIG_EAP_OTP=y
# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used) # EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
#CONFIG_EAP_SIM=y #CONFIG_EAP_SIM=y
@@ -143,10 +143,10 @@ CONFIG_EAP_OTP=y
CONFIG_EAP_PWD=y CONFIG_EAP_PWD=y
# EAP-PAX # EAP-PAX
CONFIG_EAP_PAX=y #CONFIG_EAP_PAX=y
# LEAP # LEAP
CONFIG_EAP_LEAP=y #CONFIG_EAP_LEAP=y
# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used) # EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
#CONFIG_EAP_AKA=y #CONFIG_EAP_AKA=y
@@ -159,18 +159,18 @@ CONFIG_EAP_LEAP=y
#CONFIG_USIM_SIMULATOR=y #CONFIG_USIM_SIMULATOR=y
# EAP-SAKE # EAP-SAKE
CONFIG_EAP_SAKE=y #CONFIG_EAP_SAKE=y
# EAP-GPSK # EAP-GPSK
CONFIG_EAP_GPSK=y #CONFIG_EAP_GPSK=y
# Include support for optional SHA256 cipher suite in EAP-GPSK # Include support for optional SHA256 cipher suite in EAP-GPSK
CONFIG_EAP_GPSK_SHA256=y #CONFIG_EAP_GPSK_SHA256=y
# EAP-TNC and related Trusted Network Connect support (experimental) # EAP-TNC and related Trusted Network Connect support (experimental)
CONFIG_EAP_TNC=y #CONFIG_EAP_TNC=y
# Wi-Fi Protected Setup (WPS) # Wi-Fi Protected Setup (WPS)
CONFIG_WPS=y #CONFIG_WPS=y
# Enable WPS external registrar functionality # Enable WPS external registrar functionality
#CONFIG_WPS_ER=y #CONFIG_WPS_ER=y
# Disable credentials for an open network by default when acting as a WPS # Disable credentials for an open network by default when acting as a WPS
@@ -180,21 +180,21 @@ CONFIG_WPS=y
#CONFIG_WPS_NFC=y #CONFIG_WPS_NFC=y
# EAP-IKEv2 # EAP-IKEv2
CONFIG_EAP_IKEV2=y #CONFIG_EAP_IKEV2=y
# EAP-EKE # EAP-EKE
#CONFIG_EAP_EKE=y #CONFIG_EAP_EKE=y
# MACsec # MACsec
CONFIG_MACSEC=y #CONFIG_MACSEC=y
# PKCS#12 (PFX) support (used to read private key and certificate file from # PKCS#12 (PFX) support (used to read private key and certificate file from
# a file that usually has extension .p12 or .pfx) # a file that usually has extension .p12 or .pfx)
CONFIG_PKCS12=y #CONFIG_PKCS12=y
# Smartcard support (i.e., private key on a smartcard), e.g., with openssl # Smartcard support (i.e., private key on a smartcard), e.g., with openssl
# engine. # engine.
CONFIG_SMARTCARD=y #CONFIG_SMARTCARD=y
# PC/SC interface for smartcards (USIM, GSM SIM) # PC/SC interface for smartcards (USIM, GSM SIM)
# Enable this if EAP-SIM or EAP-AKA is included # Enable this if EAP-SIM or EAP-AKA is included
@@ -213,7 +213,7 @@ CONFIG_SMARTCARD=y
#CONFIG_EAPOL_TEST=y #CONFIG_EAPOL_TEST=y
# Support IPv6 # Support IPv6
CONFIG_IPV6=y #CONFIG_IPV6=y
# Select control interface backend for external programs, e.g, wpa_cli: # Select control interface backend for external programs, e.g, wpa_cli:
# unix = UNIX domain sockets (default for Linux/*BSD) # unix = UNIX domain sockets (default for Linux/*BSD)
@@ -241,7 +241,7 @@ CONFIG_CTRL_IFACE=y
# This can be used to reduce the size of the wpa_supplicant considerably # This can be used to reduce the size of the wpa_supplicant considerably
# if debugging code is not needed. The size reduction can be around 35% # if debugging code is not needed. The size reduction can be around 35%
# (e.g., 90 kB). # (e.g., 90 kB).
#CONFIG_NO_STDOUT_DEBUG=y CONFIG_NO_STDOUT_DEBUG=y
# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save # Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
# 35-50 kB in code size. # 35-50 kB in code size.
@@ -418,13 +418,13 @@ CONFIG_BACKEND=file
#CONFIG_NO_LOAD_DYNAMIC_EAP=y #CONFIG_NO_LOAD_DYNAMIC_EAP=y
# IEEE Std 802.11r-2008 (Fast BSS Transition) for station mode # IEEE Std 802.11r-2008 (Fast BSS Transition) for station mode
CONFIG_IEEE80211R=y #CONFIG_IEEE80211R=y
# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt) # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
CONFIG_DEBUG_FILE=y #CONFIG_DEBUG_FILE=y
# Send debug messages to syslog instead of stdout # Send debug messages to syslog instead of stdout
CONFIG_DEBUG_SYSLOG=y #CONFIG_DEBUG_SYSLOG=y
# Set syslog facility for debug messages # Set syslog facility for debug messages
#CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON #CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
@@ -500,10 +500,10 @@ CONFIG_DEBUG_SYSLOG=y
#CONFIG_GETRANDOM=y #CONFIG_GETRANDOM=y
# IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode)
CONFIG_IEEE80211AC=y #CONFIG_IEEE80211AC=y
# IEEE 802.11ax HE support (mainly for AP mode) # IEEE 802.11ax HE support (mainly for AP mode)
CONFIG_IEEE80211AX=y #CONFIG_IEEE80211AX=y
# IEEE 802.11be EHT support (mainly for AP mode) # IEEE 802.11be EHT support (mainly for AP mode)
# CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE. # CONFIG_IEEE80211AX is mandatory for setting CONFIG_IEEE80211BE.
@@ -520,10 +520,10 @@ CONFIG_IEEE80211AX=y
# This can be used to enable functionality to improve interworking with # This can be used to enable functionality to improve interworking with
# external networks (GAS/ANQP to learn more about the networks and network # external networks (GAS/ANQP to learn more about the networks and network
# selection based on available credentials). # selection based on available credentials).
CONFIG_INTERWORKING=y #CONFIG_INTERWORKING=y
# Hotspot 2.0 # Hotspot 2.0
CONFIG_HS20=y #CONFIG_HS20=y
# Enable interface matching in wpa_supplicant # Enable interface matching in wpa_supplicant
#CONFIG_MATCH_IFACE=y #CONFIG_MATCH_IFACE=y
@@ -544,12 +544,12 @@ CONFIG_HS20=y
#CONFIG_P2P=y #CONFIG_P2P=y
# Enable TDLS support # Enable TDLS support
CONFIG_TDLS=y #CONFIG_TDLS=y
# Wi-Fi Display # Wi-Fi Display
# This can be used to enable Wi-Fi Display extensions for P2P using an external # This can be used to enable Wi-Fi Display extensions for P2P using an external
# program to control the additional information exchanges in the messages. # program to control the additional information exchanges in the messages.
CONFIG_WIFI_DISPLAY=y #CONFIG_WIFI_DISPLAY=y
# Autoscan # Autoscan
# This can be used to enable automatic scan support in wpa_supplicant. # This can be used to enable automatic scan support in wpa_supplicant.
@@ -617,7 +617,7 @@ CONFIG_WIFI_DISPLAY=y
# Support RSN on IBSS networks # Support RSN on IBSS networks
# This is needed to be able to use mode=1 network profile with proto=RSN and # This is needed to be able to use mode=1 network profile with proto=RSN and
# key_mgmt=WPA-PSK (i.e., full key management instead of WPA-None). # key_mgmt=WPA-PSK (i.e., full key management instead of WPA-None).
CONFIG_IBSS_RSN=y #CONFIG_IBSS_RSN=y
# External PMKSA cache control # External PMKSA cache control
# This can be used to enable control interface commands that allow the current # This can be used to enable control interface commands that allow the current
@@ -639,12 +639,12 @@ CONFIG_BGSCAN_SIMPLE=y
# Opportunistic Wireless Encryption (OWE) # Opportunistic Wireless Encryption (OWE)
# Experimental implementation of draft-harkins-owe-07.txt # Experimental implementation of draft-harkins-owe-07.txt
#CONFIG_OWE=y CONFIG_OWE=y
# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) # Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect)
CONFIG_DPP=y #CONFIG_DPP=y
# DPP version 2 support # DPP version 2 support
CONFIG_DPP2=y #CONFIG_DPP2=y
# DPP version 3 support (experimental and still changing; do not enable for # DPP version 3 support (experimental and still changing; do not enable for
# production use) # production use)
#CONFIG_DPP3=y #CONFIG_DPP3=y