• Anycloud37D平台移植wpa_supplicant


    1. 环境准备

    系统环境:
    Distributor ID: Ubuntu
    Description:    Ubuntu 22.04.3 LTS
    Release:        22.04
    Codename:       jammy
    
    • 1
    • 2
    • 3
    • 4
    • 5

    源码下载地址:
    libnl:

    https://www.linuxfromscratch.org/blfs/view/svn/basicnet/libnl.html
    
    • 1

    openssl:

    https://www.openssl.org/source/
    
    • 1

    wpa_supplicant、hostapd

    http://w1.fi/releases/
    
    • 1

    2. 代码编译

    2.1 libnl

    tar xzf libnl-3.8.0.tar.gz
    cd libnl-3.8.0/
    ./configure --prefix=/home/linux/tmp/wpa_supplicant/install --host=arm-anykav500-linux-uclibcgnueabi
    make
    make install
    
    • 1
    • 2
    • 3
    • 4
    • 5

    2.2 openssl

    tar xzf openssl-1.1.1v.tar.gz
    cd openssl-1.1.1v/
    ./config shared no-asm --prefix=/home/linux/tmp/wpa_supplicant/install --cross-compile-prefix=arm-anykav500-linux-uclibcgnueabi-
    
    • 1
    • 2
    • 3

    调整Makefile:

    # Variables starting with CNF_ are common variables for all product types
    
    CNF_CPPFLAGS=-DNDEBUG
    CNF_CFLAGS=-pthread -m64
    CNF_CXXFLAGS=-std=c++11 -pthread -m64
    
    • 1
    • 2
    • 3
    • 4
    • 5

    删除-m64,继续进行编译:

    make
    make install
    
    • 1
    • 2

    2.3 wpa_supplicant

    tar xzf wpa_supplicant-2.10.tar.gz
    cd wpa_supplicant-2.10/wpa_supplicant/
    
    • 1
    • 2

    修改defconfig:

     # Uncomment following two lines and fix the paths if you have installed OpenSSL
     # or GnuTLS in non-default location
    -#CFLAGS += -I/usr/local/openssl/include
    -#LIBS += -L/usr/local/openssl/lib
    +CFLAGS += -I/home/linux/tmp/wpa_supplicant/install/include
    +LIBS += -L/home/linux/tmp/wpa_supplicant/install/lib
    
     # Some Red Hat versions seem to include kerberos header files from OpenSSL, but
     # the kerberos files are not in the default include path. Following line can be
    @@ -37,8 +37,9 @@ CONFIG_DRIVER_NL80211=y
     # driver_nl80211.c requires libnl. If you are compiling it yourself
     # you may need to point hostapd to your version of libnl.
     #
    -#CFLAGS += -I$
    -#LIBS += -L$
    +CFLAGS += -I/home/linux/tmp/wpa_supplicant/install/include/libnl3
    +CFLAGS += -I/home/linux/tmp/wpa_supplicant/libnl-3.8.0/include/linux-private
    +LIBS += -L/home/linux/tmp/wpa_supplicant/install/lib
    
     # Additional directories for cross-compilation on Linux host for mingw target
     #CFLAGS += -I/opt/mingw/mingw32/include/ddk
     #LIBS += -L/opt/mingw/mingw32/lib
    -#CC=mingw32-gcc
    +CC=arm-anykav500-linux-uclibcgnueabi-gcc
    
     # Driver interface for wired Ethernet drivers
    -CONFIG_DRIVER_WIRED=y
    +#CONFIG_DRIVER_WIRED=y
    
     # internal = Internal TLSv1 implementation (experimental)
     # linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
     # none = Empty template
    -#CONFIG_TLS=openssl
    +CONFIG_TLS=openssl
    
     # Add support for new DBus control interface
     # (fi.w1.wpa_supplicant1)
    -CONFIG_CTRL_IFACE_DBUS_NEW=y
    +#CONFIG_CTRL_IFACE_DBUS_NEW=y
    
     # Add introspection support for new DBus control interface
    -CONFIG_CTRL_IFACE_DBUS_INTRO=y
    +#CONFIG_CTRL_IFACE_DBUS_INTRO=y
    
     # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
    -CONFIG_DEBUG_FILE=y
    +#CONFIG_DEBUG_FILE=y
    
     # should be noted that this is mainly aimed at simple cases like
     # WPA2-Personal while more complex configurations like WPA2-Enterprise with an
     # external RADIUS server can be supported with hostapd.
    -CONFIG_AP=y
    +#CONFIG_AP=y
    
     # P2P (Wi-Fi Direct)
     # This can be used to enable P2P support in wpa_supplicant. See README-P2P for
     # more information on P2P operations.
    -CONFIG_P2P=y
    +#CONFIG_P2P=y
    
     # Wi-Fi Display
     # 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.
    -CONFIG_WIFI_DISPLAY=y
    +#CONFIG_WIFI_DISPLAY=y
    
     # Support RSN on IBSS networks
     # 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).
    -CONFIG_IBSS_RSN=y
    +#CONFIG_IBSS_RSN=y
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71

    修改Makefile:

     _OBJS_VAR := OBJS
     include ../src/objs.mk
     wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
    -       $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
    +       $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) -static
            @$(E) "  LD " $@
    
     _OBJS_VAR := OBJS_t
    @@ -1909,13 +1909,13 @@ preauth_test: $(OBJS_t2)
     _OBJS_VAR := OBJS_p
     include ../src/objs.mk
     wpa_passphrase: $(OBJS_p)
    -       $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS)
    +       $(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p) $(LIBS) -static
            @$(E) "  LD " $@
    
     _OBJS_VAR := OBJS_c
     include ../src/objs.mk
     wpa_cli: $(OBJS_c)
    -       $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
    +       $(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c) -static
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    编译:

    cp defconfig .config
    export PKG_CONFIG_PATH=/home/linux/tmp/wpa_supplicant/install/lib/pkgconfig:$PKG_CONFIG_PATH
    make
    make DESTDIR=/home/linux/tmp/wpa_supplicant/install install
    
    • 1
    • 2
    • 3
    • 4

    2.4 hostapd

    tar xzf hostapd-2.10.tar.gz
    cd hostapd-2.10/hostapd
    
    • 1
    • 2

    修改defconfig:

     # driver_nl80211.c requires libnl. If you are compiling it yourself
     # you may need to point hostapd to your version of libnl.
     #
    -#CFLAGS += -I$
    -#LIBS += -L$
    +CFLAGS += -I/home/linux/tmp/wpa_supplicant/install/include
    +LIBS += -L/home/linux/tmp/wpa_supplicant/install/lib
    +CFLAGS += -I/home/linux/tmp/wpa_supplicant/install/include/openssl
    
     # internal = Internal TLSv1 implementation (experimental)
     # linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental)
     # none = Empty template
    -#CONFIG_TLS=openssl
    +CONFIG_TLS=openssl
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    修改Makefile:

     ALL=hostapd hostapd_cli
     CONFIG_FILE = .config
    
    +CC=arm-anykav500-linux-uclibcgnueabi-gcc
    +
     include ../src/build.rules
    
     hostapd: $(OBJS)
    -       $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
    +       $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) -static
            @$(E) "  LD " $@
    
     hostapd_cli: $(OBJS_c)
    -       $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
    +       $(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c) -static
            @$(E) "  LD " $@
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    编译:

    cp defconfig .config
    make
    make DESTDIR=/home/linux/tmp/wpa_supplicant/install install
    
    • 1
    • 2
    • 3
  • 相关阅读:
    【手把手带你学JavaSE】第二篇:Java的main函数、数据类型
    模块化---common.js
    数据标注工具 doccano | 文本分类(Text Classification)
    装修服务预约小程序的内容如何
    Eigen计算均值和标准差
    Resultf风格接口
    浪潮云海首席科学家张东:面向一云多芯的系统设计方法
    若依前后分离版框架下Springboot java引入Mqtt接受发送消息
    Python学习之编写学生信息管理系统
    Java基础- 浅谈javac和javap
  • 原文地址:https://blog.csdn.net/u010209897/article/details/132790928