Skip to content

Instantly share code, notes, and snippets.

@drygdryg
Last active February 4, 2023 03:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drygdryg/3fa715b109ac217d1a5c07e8019d8d30 to your computer and use it in GitHub Desktop.
Save drygdryg/3fa715b109ac217d1a5c07e8019d8d30 to your computer and use it in GitHub Desktop.
Сборка статично скомпонованных беспроводных утилит для Linux ARM (Android): iw и wpa_supplicant
Сборка статичного iw в Alpine:
# Установка базового инструментария для сборки
apk add build-base
mkdir iw_static
cd iw_static/
wget https://github.com/thom311/libnl/releases/download/libnl3_5_0/libnl-3.5.0.tar.gz
mkdir prefix
tar xvf libnl-3.5.0.tar.gz
cd libnl-3.5.0/
apk add bison flex gawk linux-headers pkgconf
./configure --enable-static --disable-shared --disable-cli --prefix=/root/iw_static/prefix
# - Headers will be installed in /root/iw_static/prefix/include/libnl3, therefore you will need to add "-I/usr/include/libnl3" to CFLAGS
make -j`nproc --all` && make install
cd ..
wget https://mirrors.edge.kernel.org/pub/software/network/iw/iw-5.8.tar.xz
tar xvf iw-5.8.tar.xz
cd iw-5.8/
export PKG_CONFIG_PATH="/root/iw_static/prefix/lib/pkgconfig"
make -j`nproc --all` V=1 LDFLAGS+='-static'
Сборка статичного wpa_supplicant в Alpine:
# Повторить действия, аналогичные действиям для iw (собрать libnl)
mkdir wpas_static && cd wpas_static/
wget https://www.w1.fi/releases/wpa_supplicant-2.9.tar.gz
tar xvf wpa_supplicant-2.9.tar.gz
cd wpa_supplicant-2.9/wpa_supplicant/
export PKG_CONFIG_PATH="/root/iw_static/prefix/lib/pkgconfig"
# Добавить в Makefile после блока "ifndef CFLAGS":
# CFLAGS += '-I/root/iw_static/prefix/include/libnl3 -L/root/iw_static/prefix/lib lnl-genl-3 -lnl-3'
make -j`nproc --all` LIBS+='-L/root/iw_static/prefix/lib -lnl-genl-3 -lnl-3' LDFLAGS+='-static'
Ресурсы, которые помогли мне составить эту заметку:
1) https://github.com/kimocoder/android_tools_iw/blob/master/build_all.sh
2) https://www.infradead.org/~tgr/libnl/doc/core.html
3) https://stackoverflow.com/questions/27959079/libnl-3-netlink-library-undefined-reference-to-nl-and-genl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment