Wifi driver for Android KitKat 4.4 Wifi Transplantation

Source: Internet
Author: User

This article describes how to port the Realek RTL8723A Linux Wifi driver in Linux 3.10.

Prerequisites

Hardware Platform: Atmel SAMA5

Software Platform: Linux 3.10 + Android 4.4

Wifi module: RTL8723AU (USB Interface)

Realtek RTL8723A Wi-Fi Software & Driver for Linux and Android

Rtl8723a_wifi_linux_v4.1.6_7336.201301__ccc02.zip

Directory structure

Liaops @ ubuntu-server:/media/android/liaops/temp/RTL8723A_WiFi_linux_v4.1.6_7336.20130426 $ tree-L 2

.

── Android_ref_codes_JB_4.1

│ ── Linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff.

│ ── Realtek_wifi_SDK_for_android_JB_4.1_20130306.tar.gz

│ ── Realtek_Wi-Fi_SDK_for_Android_JB_4_1.pdf.

── Android_ref_codes_JB_4.2 // transplantation of Android JB 4.2 Realtek Wifi

│ ── Linux-3.0.42_STATION_INFO_ASSOC_REQ_IES.diff.

│ ── Realtek_wifi_SDK_for_android_JB_4.2_20130208.tar.gz

│ └─Realtek_wi-fi_sdk_for_android_jb_4_2.pdf // transplant the document

── Android_reference_codes

│ ── Realtek_wifi_SDK_for_android_20120618.tar.gz

│ ── Realtek_wifi_SDK_for_android.txt

── Android_reference_codes_ICS_nl80211

│ ── Realtek_wifi_SDK_for_android_ICS_20120621.tar.gz

│ ── Realtek_Wi-Fi_SDK_for_Android_ICS.pdf.

── Document

│ ── HowTo_enable_driver_to_support_80211d.pdf

│ ├─%Howto_enable_driver_to_support_wifi_certification_testication

│ ── Howto_enable_the_power_saving_functionality #

│ ── HowTo_support_more_VidPids.pdf

│ ── _Dhcp_server_notes.txt

│ ├ ── Quick_start_guide_for_bridge=

│ ├─Quick_start_guide_for_driver_compilation_and_installation.pdf

│ ├ ── Quick_Start_Guide_for_SoftAP.pdf

│ ├ ── Quick_Start_Guide_for_Station_Mode.pdf

│ ── Realtek_WiFi_concurrent_mode_Introduction.pdf .pdf

│ ── RTK_P2P_WFD_Programming_guide.pdf

│ ├ ── SoftAP_Mode_features.pdf

│ ── Wireless_tools_porting_guide.pdf

│ ── Wpa_cli_with_wpa_supplicant.pdf

── Driver

│ └─Rtl8723a_wifi_linux_v4.1.6_7336.201301__ccc02.tar.gz // Realek RTL8723A Linux Wifi driver

── Hardware_wps_pbc

│ ── Readme.txt

│ ── Sample. c

── Install. sh

── Mp_tools

│ ── RTL8723A_MPDoc

── Readme.txt

── ReleaseNotes.pdf

── WiFi_Direct_User_Interface

│ ── Android. mk

│ ── Install. sh

│ ── P2p_api_test_linux.c

│ ── P2p_test.h

│ ── P2p_ui_test_linux.c

│ ── Start_Guide_P2P_User_Interface_Linux.pdf .pdf

├ ── Wireless_tools

│ └─Wireless_tools.30.rtl.tar.gz // a tool for configuring wireless networks in Linux, including iwlist, iwpriv, and iwconfig.

── Wpa_supplicant_hostapd

── P2p_hostapd.conf

── Rtl_hostapd_2G.conf

── Rtl_hostapd_5G.conf

── Wpa_0_8.conf

├──Wpa_supplicant_8_jb_4.20.rtw_r7281.201302.16.tar.gz

├──Wpa_supplicant_8_jb_4.2_rtw_r7279.201302.16.tar.gz

└──Wpa_supplicant_hostapd-0.8_rtw_r7048.201302.16.tar.gz

Kernel configuration

Ensure Linux configuration before kernel Compilation

# Make menuconfig

Enable WLAN Network support:

[*] Networking support --->

-*-Wireless --->

Enable Wireless LAN Device Driver:

Device Drivers --->

[*] Network device support --->

[*] Wireless LAN --->

Enable RealTekRTL8712U wireless NIC Driver:

Device Drivers --->

[*] Staging drivers --->

RealTek RTL8712U (RTL8192SU) Wireless LAN NICdriver

The purpose is to enable CONFIG_WIRELESS_EXT = y and CONFIG_WEXT_PRIV = y

The preceding operations enable the following CONFIG options in the kernel:

CONFIG_WIRELESS = y

CONFIG_WLAN = y

CONFIG_WIRELESS_EXT = y

CONFIG_WEXT_CORE = y

CONFIG_WEXT_PROC = y

CONFIG_WEXT_PRIV = y

Enable USB Host Support:

Device Drivers --->

[*] USB support --->

<*> Support for Host-side USB

<*> Ehci hcd (USB 2.0) support

Compile the kernel

Compile the kernel according to the preceding Kernel configuration.


Wifi driver configuration and compilation

Decompress the driver source code: rtl8723a_wifi_linux_v4.1.6_7336.201301__ccc02.tar.gz

Go to the driver source code directory:

── Autoconf_rtl8723a_sdio_linux.h

── Autoconf_rtl8723a_usb_linux.h

── Clean

── Core

── Hal

── Ifcfg-wlan0

── Include

── Kconfig

── Kconfig_rtl8723a_sdio_linux

── Kconfig_rtl8723a_usb_linux

── Make_drv

── Makefile

── OS _dep

── Runwpa

── Wlan0dhcp

Modify Makefile and add AT91 platform support

@-44,7 + 44,7 @ CONFIG_EXT_CLK = n

CONFIG_FTP_PROTECT = n

CONFIG_WOWLAN = n

-Config_platform_i1__pc = y

+ Config_platform_i1__pc = n

CONFIG_PLATFORM_ANDROID_X86 = n

CONFIG_PLATFORM_ARM_S3C2K4 = n

CONFIG_PLATFORM_ARM_PXA2XX = n

@-75,6 + 75,7 @ CONFIG_PLATFORM_ARM_SUN6I = n

Config_platform_actions_atm 702x = n

CONFIG_PLATFORM_MN10300 = n

CONFIG_PLATFORM_ACTIONS_ATV5201 = n

+ CONFIG_PLATFORM_ARM_AT91 = y

CONFIG_DRVEXT_MODULE = n

@-651,6 + 652,14 @ KVER: =$ (KERNEL_VER)

KSRC: = $ (kernel DIR)/.../../kernel/linux-$ (KERNEL_VER)

Endif

+ Ifeq ($ (CONFIG_PLATFORM_ARM_AT91), y)

+ EXTRA_CFLAGS + =-DCONFIG_LITTLE_ENDIAN

+ ARCH: = arm

+ CROSS_COMPILE: =/usr/local/CodeSourcery/Sourcery_G ++ _ Lite/bin/arm-none-eabi-

+ KSRC: =/media/android/liaops/miura/kernel

+ MODULE_NAME: = wlan

+ Endif

+

Ifneq ($ (USER_MODULE_NAME ),)

MODULE_NAME: = $ (USER_MODULE_NAME)

Endif

Modify autoconf_rtl8723a_usb_linux.h to enable Stas + P2P coexistence mode:

@-50, 7 + 50, 7 @@

# DefineSUPPORT_HW_RFOFF_DETECTED

-// # Defineconfig_ioctl_201780211

+ # Defineconfig_ioctl_201780211

# IfdefCONFIG_PLATFORM_ARM_SUNxI

# Ifndef config_ioctl_201780211

# Define config_ioctl_201780211

@-59,7 + 59,7 @@

# Ifdefconfig_ioctl_201780211

// # Define rtw_use_201780211_sta_event/* Indecate new sta asoc through1_80211_new_sta */

-# Define config_201780211_force_compatible_2_6_37_under

+ // # Define config_201780211_force_compatible_2_6_37_under

// # Define config_debug_201780211

# Define CONFIG_SET_SCAN_DENY_TIMER

# Endif

@-86,7 + 86,7 @@

// # Define CONFIG_DBG_P2P

# Define CONFIG_P2P_PS

-// # Define CONFIG_P2P_IPS

+ # Define CONFIG_P2P_IPS

# Endif

// Added by Kurt20110511

@-102,7 + 102,7 @@

# DefineCONFIG_LAYER2_ROAMING

# DefineCONFIG_LAYER2_ROAMING_RESUME

-// # DefineCONFIG_CONCURRENT_MODE

+ # DefineCONFIG_CONCURRENT_MODE

# IfdefCONFIG_CONCURRENT_MODE

# Define CONFIG_TSF_RESET_OFFLOAD // For 2 port tsf sync.

// # Define CONFIG_HWPORT_SWAP // Port0-> Sec, Port1-> Pri

Compilation driver

Make KSRC = <内核源代码码路径>

The Wifi driver module is obtained in the current directory: wlan. ko

Compile Android source code

Compile wireless_tools wireless network management tool

Decompress wireless_tools.30.rtl.tar.gz to the Android source code external/directory.

(1) tar zxvf wireless_tools.30.rtl.tar.gz

(2) cp wireless_tools.30.rtl/external/

(3) cd

(4) make iwconfig iwlist iwpriv

Install the Wifi Driver Module

Copy wlan. ko to the out/target/product/sama5d3/system/lib/modules directory of the Android file system.

ProductionAndroidRoot file system and download to Development Board

Test

USB Wifi module inserted after startup

Usb 1-2: newhigh-speed USB device number 2 using atmel-ehci

Usb 1-2: NewUSB device found, idVendor = 0133, idProduct = 0724

Usb 1-2: NewUSB device strings: Mfr = 1, Product = 2, SerialNumber = 3

Usb 1-2: Product: 802.11n WLAN Adapter

Usb 1-2: Manufacturer: Realtek

Usb 1-2: SerialNumber: 00e04c000001

Before loading a module

Root @ sama5d3:/# netcfg

Eth0 UP 0.0.0.0/0 0x0000000033a: 1f: 34: 08: 54: 54

Can0 DOWN 0.0.0.0/0 0x0000008000: 00: 00: 00: 00: 00

Sit0 DOWN 0.0.0.0/0 0x0000008000: 00: 00: 00: 00: 00

Lo UP 127.0.0.1/8 0x0000004900: 00: 00: 00: 00: 00

Load Module

Root @ sama5d3:/# insmod/system/lib/modules/wlan. ko

Usbcore: registered new interface driver rtl8723au

After the module is loaded

Root @ sama5d3:/# netcfg

Wlan0 DOWN 0.0.0.0/0 0x00001002 00: 02: 72: 3c: 0c: c1

Wlan1 DOWN 0.0.0.0/0 0x00001002 02: 02: 72: 3c: 0c: c1

Eth0 UP 0.0.0.0/0 0 0x00001043 3a: 1f: 34: 08: 54: 54

Can0 DOWN 0.0.0.0/0 0 0x00000080 00: 00: 00: 00: 00: 00

Sit0 DOWN 0.0.0.0/0 0 0x00000080 00: 00: 00: 00: 00: 00

Lo UP 127.0.0.1/8 0x00000049 00: 00: 00: 00: 00: 00

We can see two more interfaces: wlan0 and wlan1.

Open wlan0

Root @ sama5d3:/# netcfg wlan0 up

IPv6: ADDRCONF (NETDEV_UP): wlan0: link is not ready

RTL871X: nolinked power save enter

Run the command iwlist wlan0 scanning to search for available wireless APs.

Some results are as follows:

Root @ sama5d3:/# iwlist wlan0 scanning

RTL871X: nolinked power save leave

Wlan0Scan completed:

Cell 01-Address: D8: 15: 0D: D9: 1F: F0

ESSID: "Intest_Hardware"

Protocol: IEEE 802.11bgn

Mode: Master

Frequency: 2.412 GHz (Channel 1)

Encryption key: on

Bit Rates: 300 Mb/s

Extra: wpa_ie = dd160050f201010950f204010950f204010950f202

IE: WPA Version 1

Group Cipher: CCMP

Pairwise Ciphers (1): CCMP

Authentication Suites (1): PSK

Extra: rsn_ie = 30140100000fac040100000fac040100000fac020000

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher: CCMP

Pairwise Ciphers (1): CCMP

Authentication Suites (1): PSK

IE: Unknown: dd180050f204254a00011010440001021049000600372a000120

Quality = 0/100 Signal level =-74 dBm

Cell 02-Address: A8: 57: 4E: FC: 4B: 3E

ESSID: "\ xBE \ xDE \ xC3 \ xC0 \ xB9 \ xFA \ xBC \ xCA"

Protocol: IEEE 802.11bgn

Mode: Master

Frequency: 2.437 GHz (Channel 6)

Encryption key: on

Bit Rates: 300 Mb/s

Extra: wpa_ie = dd160050f201010950f204010950f204010950f202

IE: WPA Version 1

Group Cipher: CCMP

Pairwise Ciphers (1): CCMP

Authentication Suites (1): PSK

Extra: rsn_ie = 30140100000fac040100000fac040100000fac020000

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher: CCMP

Pairwise Ciphers (1): CCMP

Authentication Suites (1): PSK

IE: Unknown

Quality = 0/100 Signal level =-71 dBm

Cell 03-Address: 1C: BD: B9: C7: 84: 98

ESSID: "hikvision"

Protocol: IEEE 802.11bgn

Mode: Master

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.