Compare commits

...

6 Commits

3 changed files with 103 additions and 9 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

@@ -26,10 +26,10 @@
# replacement for WEXT and its use allows wpa_supplicant to properly control # replacement for WEXT and its use allows wpa_supplicant to properly control
# the driver to improve existing functionality like roaming and to support new # the driver to improve existing functionality like roaming and to support new
# functionality. # functionality.
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
@@ -91,7 +91,7 @@ CC=arm-uclinuxfdpiceabi-gcc
# Enable IEEE 802.1X Supplicant (automatically included if any EAP method or # Enable IEEE 802.1X Supplicant (automatically included if any EAP method or
# MACsec is included) # MACsec is included)
#CONFIG_IEEE8021X_EAPOL=y CONFIG_IEEE8021X_EAPOL=y
# EAP-MD5 # EAP-MD5
#CONFIG_EAP_MD5=y #CONFIG_EAP_MD5=y
@@ -100,16 +100,16 @@ CC=arm-uclinuxfdpiceabi-gcc
#CONFIG_EAP_MSCHAPV2=y #CONFIG_EAP_MSCHAPV2=y
# EAP-TLS # EAP-TLS
#CONFIG_EAP_TLS=y CONFIG_EAP_TLS=y
# Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly # Enable EAP-TLSv1.3 support by default (currently disabled unless explicitly
# enabled in network configuration) # enabled in network configuration)
#CONFIG_EAP_TLSV1_3=y #CONFIG_EAP_TLSV1_3=y
# EAL-PEAP # EAL-PEAP
#CONFIG_EAP_PEAP=y CONFIG_EAP_PEAP=y
# EAP-TTLS # EAP-TTLS
#CONFIG_EAP_TTLS=y CONFIG_EAP_TTLS=y
# EAP-FAST # EAP-FAST
#CONFIG_EAP_FAST=y #CONFIG_EAP_FAST=y
@@ -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.
@@ -255,7 +255,7 @@ CONFIG_CTRL_IFACE=y
#CONFIG_NO_WPA_PASSPHRASE=y #CONFIG_NO_WPA_PASSPHRASE=y
# Simultaneous Authentication of Equals (SAE), WPA3-Personal # Simultaneous Authentication of Equals (SAE), WPA3-Personal
#CONFIG_SAE=y CONFIG_SAE=y
# SAE Public Key, WPA3-Personal # SAE Public Key, WPA3-Personal
#CONFIG_SAE_PK=y #CONFIG_SAE_PK=y
@@ -639,7 +639,7 @@ 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