[Beijing Xunwei] i.MX6ULL Terminator Linux WIFI driver experiment Wpa_supplicant porting

1 libopenssl port

wpa_supplicant depends on libopenssl, so you need to port libopenssl first, first get the openssl-1.1.1-stable-SNAP-20190915.tar.gz compressed package, copy it to the Ubuntu system and decompress it to get openssl-1.1.1-stable-SNAP- 20190915 folder, and then create a new folder named "libopenssl" to store the compilation results of libopenssl. Enter the unzipped openssl-1.1.1-stable-SNAP-20190915 directory, and then execute the following command to configure: After the
./config shared no-asm --prefix=/home/topeet/tool/libopenssl/
configuration is successful, a Makefile will be generated, open the Makefile, and find all the contents containing "-m64". There are two places For the variables CNF_CFLAGS and CNF_CXXFLAGS, delete the "-m64" in these two variables, as shown in Figure 1.1 after modification:
Insert picture description here

Figure 1.1

After the Makefile is modified, use the following command to compile and install libopenssl:

make CROSS_COMPILE=arm-linux-gnueabihf- -j4
make install

After the compilation and installation are complete, there is content in the libopenssl directory as shown in Figure 1.2:
Insert picture description here

Figure 1.2

The lib directory is what we need. Copy all the files in the lib directory to the /usr/lib directory in the root file system of the development board. When using a USB flash drive to copy files, it may be "unable to create a symbolic link." Such files can be packaged in the lib directory into a compressed package in tar.gz format, and then copied to the root file system and decompressed to /usr/lib Under contents. Execute the following command:

cd /home/topeet/tool/libopenssl/lib/   		//进入lib目录下
tar -czvf lib.tar.gz *							//打包当前目录下的文件生成lib.tar.gz

Then copy it to the root file system via U disk and unzip it to the /usr/lib directory.

mount /dev/sda1 /mnt 				//挂载U盘到mnt目录下
tar -xvf /mnt/lib.tar.gz -C /usr/lib		//直接解压lib.tar.gz到/usr/lib目录下

"-C" specifies the decompressed directory.

2 libnl library porting

wpa_supplicant also depends on libnl, so you need to migrate the libnl library, get the libnl-3.2.23.tar.gz compressed package, then copy it to the Ubuntu system and decompress it to get the libnl-3.2.23 folder, and then create a new name The folder named "libnl" is used to store libnl compilation results. Enter the libnl-3.2.23 folder, and then execute the following command to configure:
./configure --host=arm-linux-gnueabihf --prefix=/home/topeet/tool/libnl/
-host is used to specify the prefix of the cross compiler, here is set to "arm-linux-gnueabihf", -prefix is ​​used to specify the directory where the compilation results are stored, This is to be set to the libnl folder we just created. After the configuration is complete, you can execute the following commands to compile and install the libnl library:

make -j12
make install

The libnl directory after compilation and installation is as shown in Figure 2.1:
Insert picture description here

Figure 2.1

Need to use the lib library file under the libnl file, copy the library file under lib to the /usr/lib directory through the U disk.

3 wpa_supplicant migration

Next, transplant wpa_supplicant, get the wpa_supplicant source package wpa_supplicant-2.7.tar.gz, copy it to the Ubuntu system and decompress it to get the wpa_supplicant-2.7 folder, enter the wpa_supplicant-2.7 directory, as shown in Figure 3.1:
Insert picture description here

Figure 3.1

Enter the wpa_supplicant directory in the figure, and then configure it. The configuration of wpa_supplicant is special. You need to copy the defconfig file under wpa_supplicant and rename it to .config. The command is as follows:

cd wpa_supplicant/ 
cp defconfig .config

After completion, open the .config file, specify the cross compiler, openssl, libnl library and header file path in it, and set it as follows:

 49 CC = arm-linux-gnueabihf-gcc
    /* openssl 库文件和头文件路径*/
 50 CFLAGS += -I/home/topeet/tool/libopenssl/include
 51 LIBS += -L/home/topeet/tool/libopenssl/lib -lssl -lcrypto
 52  /*libnl库文件和头文件路径*/
 53 CFLAGS += -I/home/topeet/tool/libnl/include/libnl3
 54 LIBS += -L/home/topeet/tool/libnl/lib

The CC variable is used to specify the cross compiler, here is arm-linux-gnueabihf-gcc, CFLAGS specifies the path of the library header file to be used, and LIBS specifies the library path to be used. The openssl and libnl libraries are needed when compiling wap_supplicant, so the library path and header file path of these two are specified in the code. The above content in .config is shown in Figure 3.2:
Insert picture description here

Figure 3.2

After the .config file is modified, you can compile wap_supplicant. Use the following command to compile in the wap_supplicant directory:

export PKG_CONFIG_PATH=/home/topeet/tool/libnl/lib/pkgconfig:$PKG_CONFIG_PATH
make

First, we use export to specify the pkgconfig path of the libnl library, and the environment variable PKG_CONFIG_PATH holds the pkgconfig package path. There is a directory named "pkgconfig" under tool/libnl/lib/, as shown in Figure 3.3;
Insert picture description here

Figure 3.3

When compiling wpa_supplicant, you need to specify the pkgconfig path of libnl, otherwise it will prompt "libnl-3.0" or "libnl-3.0.pc" not found error. After the compilation is completed, the two commands wpa_supplicant and wpa_cli will be generated in this directory, as shown in Figure 3.4:
Insert picture description here

Figure 3.4

Copy the compiled wpa_cli and wpa_supplicant files to the /usr/bin directory of the development board root file system. After the copy is completed, you can test whether these two commands can be used. Enter the following command in the terminal:
wpa_supplicant -v The
above command to check the version number of wpa_supplicant, if wpa_supplicant works normally, it will print the version number, as shown in Figure 3.5:
Insert picture description here

Figure 3.5

It can be seen that the version number of wpa_supplicant is output normally, indicating that the migration of wpa_supplicant is successful. The next step is to use wpa_supplicant to link the WIFI of the development board to the hotspot to realize the WIFI Internet access function.

Insert picture description here

Guess you like

Origin blog.csdn.net/BeiJingXunWei/article/details/112917025