ec192d3e7a0ce98004d52f555caf535c8a151556..91eb15abeb20457b93b86c4cfb3d653e206c27c9
2020-08-21 guowenxue
update openssl and hostapd_supplicant build shell script
91eb15 diff | tree
2020-08-21 guowenxue
Add hostapd_supplicant build shell script
7151c7 diff | tree
1 files modified
1 files added
153 ■■■■■ changed files
3rdparty/hostapd_supplicant/build.sh 152 ●●●●● patch | view | raw | blame | history
3rdparty/openssl/build.sh 1 ●●●● patch | view | raw | blame | history
3rdparty/hostapd_supplicant/build.sh
New file
@@ -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
3rdparty/openssl/build.sh
@@ -64,6 +64,7 @@
    PACK_SUFIX=tar.gz 
    if [ -f ${PREFIX_PATH}/lib/libcrypto.a ] ; then 
        msg_banner "$SRC_NAME already compile and installed"
        return 0;
    fi