NUC980webServer development

Table of Contents

1.RTL8189FTV driver transplantation

2. Transplantation of wifi configuration tool hostapd

1.openssl-1.0.2r cross compilation

2.libnl-3.2.25.tar.gz cross compilation

3.hostapd-2.9.tar.gz cross compilation

4. Migrate related tools to the development board


1.RTL8189FTV driver transplantation

1. Place the driver file source code in the drivers/net/wireless/realtek/rtlwifi/ directory of the Linux source code, and rename the driver file source code directory to rtl8189

2. Enter the drivers/net/wireless/realtek/rtlwifi/rtl8189 directory

Open the Makefile to modify it and add the following words

CONFIG_PLATFORM_NEW = y

ifeq ($(CONFIG_PLATFORM_NEW), y)
EXTRA_CFLAGS + = -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /usr/local/arm_linux_4.8/bin/arm-linux-
KSRC := /NUC980-linux-4.4.y
MODULE_NAME := wlan
endif



3. Enter the upper-level directory drivers/net/wireless/realtek/rtlwifi and open the Makefile

join in

obj-$(CONFIG_RTL8189) + = rtl8189/

4. Enter drivers/net/wireless/ and open Kconfig

Add at the bottom

source "drivers/net/wireless/realtek/rtlwifi/rtl8189/Kconfig"

5. Return to the top-level directory of the linux source code

make menuconfig to configure

Configure 80211, mmc and rtl8189

Then make and compile

2. Wifi configuration tool hostapd transplantation

hostapd is a wireless access point (access point: AP) program with encryption function on Linux systems. Hostapd can switch the wireless network card to master mode, simulate the AP (router) function, and serve as the AP authentication server, responsible for controlling and managing the access and authentication of stations. hostapd is a user-space daemon for access points and authentication servers. It implements IEEE 802.11 access point management, and the current version supports Linux (Host AP, madwifi, mac80211-based driver) and FreeBSD (net80211).

Note: When porting hostapd, you must obtain the libnl source code and openssl source code

Obtain relevant source code

hostapd-2.9.tar.gz, wpa_supplicant-2.9.tar.gz http://w1.fi/releases/
libnl-3.2.25.tar.gz http://www.infradead.org/~tgr/libnl/
openssl-1.0.2r https://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2r.tar.gz

1.openssl-1.0.2r cross-compilation

1. Obtain openssl source code

https://ftp.openssl.org/source/old/1.0.2/openssl-1.0.2r.tar.gz

2. Unzip openssl, enter the openssl directory, and create the _install directory to obtain the compiled library files and related header files

3. Generate Makefile

./config no-asm shared --prefix=$(pwd)/_install

4. Modify the Makefile

CROSS_COMPILE= arm-linux-
CC= $(CROSS_COMPILE)gcc
CFLAG= -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -O3 -Wall
DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_LIBUNBOUND -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_SSL_TRACE -DOP ENSSL_NO_SSL2 -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST -DOPENSSL_NO_WEAK_SSL_CIPHERS
PEX_LIBS=
EX_LIBS= -ldl
EXE_EXT=
ARFLAGS=
AR= $(CROSS_COMPILE)ar $(ARFLAGS) r
RANLIB= $(CROSS_COMPILE)ranlib
RC= $(CROSS_COMPILE)windres
NM= $(CROSS_COMPILE)nm
PERL= /usr/bin/perl
TAR=tar
TARFLAGS= --no-recursion
MAKEDEPPROG= makedepend
LIBDIR=lib

Remove -m64 in the CFLAG parameter and -m64 in the SHARED_LDFLAGS parameter

5. Compile and install

make & amp; & amp; make install 

2.libnl-3.2.25.tar.gz cross-compile

1. Obtain the source code from http://www.infradead.org/~tgr/libnl/

2. Unzip

tar -xvf libnl-3.2.25.tar.gz
cd libnl-3.2.25/
 mkdir_install
./configure CC=arm-linux-gnueabihf-gcc --prefix=$(pwd)/_install --host=arm-linux-gnueabihf
 make
 make install

3.Create the _install folder

 mkdir_install

4. Generate Makefile

./configure CC=arm-linux-gcc --prefix=$(pwd)/_install --host=arm-linux

5.make & amp; & amp; make install

3.hostapd-2.9.tar.gz cross-compilation

1. Unzip the file

tar -xvf hostapd-2.9.tar.gz

2. Generate .config file

cd hostapd-2.9/hostapd
cp defconfig .config

3. Modify the .config file

Add the following statement

CFLAGS + = -I/home/wpa_tools/libnl-3.2.25/_install/include/libnl3
LIBS + = -L/home/wpa_tools/libnl-3.2.25/_install/lib
CFLAGS + = -I/home/wpa_tools/openssl-1.0.2r/_install/include/openssl
LIBS + = -L/home/wpa_tools/openssl-1.0.2r/_install/lib

4. Modify Makefile

Modify here

5. Output environment variables

 export PKG_CONFIG_PATH=/home/wpa_tools/libnl-3.2.25/_install/lib/pkgconfig/

6.Compile

make CC=arm-linux-gcc

1. Copy libnl related libraries to the development board/lib directory

2. Copy openssl related libraries to the /lib directory

3. Migrate hostapd related tools to the /sbin directory and transplant the configuration files to the /etc directory.

4. Modify the configuration file hostap.conf

interface=wlan0

ssid=123456789 //This is the wifi name

channel=1 //channel

wpa=2 //Encryption level

wpa_passphrase=123456789 //wifi password

3. Turn on wifi

Although you can open the hotspot directly by using the hostapd tool, the device cannot connect because the IP is not configured for the device connected to the hotspot. To automatically configure the IP, you must use the udhcpd tool.

Before using udhcpd, you must create the udhcpd.conf file under /etc

The following is the udhcpd.conf file that can be used directly

start 192.168.175.2
end 192.168.175.254
interface wlan0
max_leases 234
opt router 192.168.175.1

1. Load wifi driver

insmod wlan0.ko

2. Check whether wlan0 exists

ifconfig -a

3. Turn on wlan0

ifconfig wlan0 up

4. Configure the IP address for wlan0

ifconfig wlan0 192.168.175.1

5. Start the hostapd tool

hostapd /etc/hostapd.conf

6. Start udchpcd to assign IP to the device

udhcpd /etc/udhcpd.conf &

7. You can use cat /proc/net/arp to view connected devices

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge. Cloud native entry-level skills treeHomepageOverview 15306 people are learning the system