From 91eb15abeb20457b93b86c4cfb3d653e206c27c9 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Fri, 21 Aug 2020 21:19:32 +0800 Subject: [PATCH] update openssl and hostapd_supplicant build shell script --- 3rdparty/hostapd_supplicant/build.sh | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) diff --git a/3rdparty/hostapd_supplicant/build.sh b/3rdparty/hostapd_supplicant/build.sh new file mode 100755 index 0000000..d6fba17 --- /dev/null +++ b/3rdparty/hostapd_supplicant/build.sh @@ -0,0 +1,152 @@ +#!/bin/bash + +#+-------------------------------------------------------------------------------------------- +#|Description: This shell script used download and compile hostapd & wpa_supplicant for ARM +#| Author: GuoWenxue <guowenxue@gmail.com> +#| ChangeLog: +#| 1, Initialize 1.0.0 on 2011.04.12 +#+-------------------------------------------------------------------------------------------- + +PREFIX_PATH=`pwd`/../install/ +mkdir -p ${PREFIX_PATH}/{bin,sbin,include,lib} + +LYFTP_SRC=ftp://master.iot-yun.club/src/ + +CROSSTOOL=/opt/xtools/arm920t/bin/arm-linux- + +function msg_banner() +{ + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" +} + +function check_result() +{ + if [ $? != 0 ] ; then + echo "" + echo "+-----------------------------------------------------------------------" + echo "| $1 " + echo "+-----------------------------------------------------------------------" + echo "" + exit ; + fi +} + +function export_cross() +{ + # export cross toolchain + export CC=${CROSSTOOL}gcc + export AS=${CROSSTOOL}as + export AR=${CROSSTOOL}ar + export LD=${CROSSTOOL}ld + export NM=${CROSSTOOL}nm + export RANLIB=${CROSSTOOL}ranlib + export OBJDUMP=${CROSSTOOL}objdump + export STRIP=${CROSSTOOL}strip + + # export cross configure + export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux " + + # Clear LDFLAGS and CFLAGS + export LDFLAGS= + export CFLAGS= +} + +function compile_hostapd() +{ + SRC_NAME=hostapd-2.9 + PACK_SUFIX=tar.gz + IMG_NAME=hostapd + + if [ -f ${PREFIX_PATH}/sbin/${IMG_NAME} ] ; then + msg_banner "$SRC_NAME already compile and installed" + return 0; + fi + + msg_banner "Start cross compile $SRC_NAME " + + if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then + #wget http://w1.fi/releases/hostapd-2.9.tar.gz + wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX + check_result "ERROR: download ${SRC_NAME} failure" + fi + + tar -xzf ${SRC_NAME}.${PACK_SUFIX} + cd ${SRC_NAME}/hostapd + + cp defconfig .config + sed -i -e "s|^.*libnl include files.*|CFLAGS += -I${PREFIX_PATH}/include/libnl3|g" .config + sed -i -e "s|^.*libnl library files.*|LIBS += -L${PREFIX_PATH}/lib|g" .config + + sed -i -e "s|^.*CONFIG_LIBNL32=.*|CONFIG_LIBNL32=y|g" .config + + export PKG_CONFIG_PATH=${PREFIX_PATH}/lib/pkgconfig/:$PKG_CONFIG_PATH + + export CFLAGS="-I${PREFIX_PATH}/include" + export LIBS="-L${PREFIX_PATH}/lib" + + make + + cp hostapd ${PREFIX_PATH}/sbin + check_result "ERROR: compile ${SRC_NAME} failure" + + cd - +} + +function compile_supplicant() +{ + SRC_NAME=wpa_supplicant-2.9 + PACK_SUFIX=tar.gz + IMG_NAME=wpa_supplicant + + if [ -f ${PREFIX_PATH}/sbin/${IMG_NAME} ] ; then + msg_banner "$SRC_NAME already compile and installed" + return 0; + fi + + msg_banner "Start cross compile $SRC_NAME " + + if [ ! -f ${SRC_NAME}.${PACK_SUFIX} ] ; then + #wget http://w1.fi/releases/wpa_supplicant-2.9.tar.gz + wget $LYFTP_SRC/$SRC_NAME.$PACK_SUFIX + check_result "ERROR: download ${SRC_NAME} failure" + fi + + tar -xzf ${SRC_NAME}.${PACK_SUFIX} + cd ${SRC_NAME}/wpa_supplicant + + cp defconfig .config + sed -i -e "s|^.*libnl include files.*|CFLAGS += -I${PREFIX_PATH}/include/libnl3|g" .config + sed -i -e "s|^.*libnl library files.*|LIBS += -L${PREFIX_PATH}/lib|g" .config + + sed -i -e "s|^.*CONFIG_LIBNL32=.*|CONFIG_LIBNL32=y|g" .config + + sed -i -e "s|^.*CONFIG_CTRL_IFACE_DBUS_NEW=.*|#CONFIG_CTRL_IFACE_DBUS_NEW=n|g" .config + sed -i -e "s|^.*CONFIG_CTRL_IFACE_DBUS_INTRO=.*|#CONFIG_CTRL_IFACE_DBUS_INTRO=n|g" .config + + export PKG_CONFIG_PATH=${PREFIX_PATH}/lib/pkgconfig/:$PKG_CONFIG_PATH + + export CFLAGS="-I${PREFIX_PATH}/include" + export LIBS="-L${PREFIX_PATH}/lib" + + make + + cp wpa_supplicant ${PREFIX_PATH}/sbin + check_result "ERROR: compile ${SRC_NAME} failure" + + cd - +} + +cd ../libnl/ && ./build.sh && cd - + +cd ../openssl/ && ./build.sh && cd - + +export_cross + +compile_hostapd + +compile_supplicant + -- Gitblit v1.9.1