Android Wifi Realtek rtl8822bu bring up on phytec board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android Wifi Realtek rtl8822bu bring up on phytec board

1,091 Views
akshayd
Contributor I

Hi ,

I am working on Realtek wifi driver bring up realtek rtl8822bu bring upon imx8mp phytec phyboard pollux platform.

phytec module name :phyboard pollux

Wifi driver module name to integrate and port to the android kernel :Realtek Wifi USB rtl8822bu module

I have followed the below steps for Porting the realdriver to android :

1) Downloaded and extracted the android release source code package and synced the repo

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
$ source ~/imx-android-11.0.0_1.2.1/imx_android_setup.sh

2) Did a complete build of the android after repo syncing by the following steps :

export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-
gnu/bin/aarch64-linux-gnu-

source build/envsetup.sh

lunch 72

./imx-make.sh -j16

3) Cloned the Realtek Wifi USB driver from the below git repo :

https://github.com/ulli-kroll/rtl8822bu

Cloned the folder in drivers/net/wireless/realtek and compiled successfully .

4)  Inserted the comfig CONFIG_RTL8822BU=M in the below file in the path :

device/nxp/imx8m/phyboard_pollux/android_addition_defconfig

5) Added the output .ko file path in the BoardConfig.mk file in the below path :

android_build/device/nxp/imx8m/phyboard_pollux/BoardConfig.mk

+ BOARD_WLAN_DEVICE := bcmdhd
+ WPA_SUPPLICANT_VERSION := VER_0_8_X
+ BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+ BOARD_HOSTAPD_DRIVER := NL80211
+ BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
+ BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
+ WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/brcmfmac/parameters/alternative_fw_path"
+ BOARD_VENDOR_KERNEL_MODULES += \
+ $(KERNEL_OUT)/drivers/net/wireless/realtek/rtl8822bu/rtl8822bu.ko #added

6) Added the output .ko file path in the BoardConfig.mk file in the below path :

device/nxp/imx8m/phyboard_pollux/SharedBoardConfig.mk

+ $(KERNEL_OUT)/drivers/net/wireless/realtek/rtl8822bu/rtl8822bu.ko \ #added

7) Added the firmware in the below path and inserted the path of the firmware inserted in the phyboardpollux.mk file .THis line is inserted in the below file in the path :device/nxp/imx8m/phyboard_pollux/phyboard_pollux.mk

+device/nxp/imx8m/phyboard_pollux/lib/firmware/rtlwifi/rtl8822bufw.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rtlwifi/rtl8822bufw.bin #added

Compiled and generated rtl8822bu.ko and inserted(insmod) the module after flashing the android images.

9)After booting and connecting to HDMI ,I switched on Wifi and it turned back off automatically and captured the logs .There was a issue in the HAL layer while communicating from the java framework side.

WifiHAL path:hardware/broadcom/wlan/bcmdhd/

WifiHAL : Calling preInit
08-02 12:53:45.233 371 371 I WifiHAL : wifi_hal_preInit, handle = 0xb400f596575ec2d0
08-02 12:53:45.233 371 371 E WifiHAL : Hal preInit
08-02 12:53:45.233 371 371 I libnl : >nl_sendmsg: sk->s_cb
08-02 12:53:45.233 371 371 I libnl : >nl_sendmsg: Final return value in nl_sendmsg136
08-02 12:53:45.233 371 371 E WifiHAL : Error code nl_send_auto_complete136
08-02 12:53:45.233 371 371 E WifiHAL : Error code before while condition nl_recvmsgs1
08-02 12:53:45.233 371 371 E WifiHAL : BEFORE error result recvmsgs =1
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: nl_recv return value n156
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: recvmsgs(0xb400f596175ec510): Read 156 bytes
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: error result NLMSG_ERROR0
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: error result NL_SKIP1
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: error code err=nrecv0
08-02 12:53:45.233 371 371 I libnl : >recvmsgs: Final error code returning from nl_recvmsgs func 1
08-02 12:53:45.233 371 371 E WifiHAL : AFTER error result recvmsgs =-95
08-02 12:53:45.233 371 371 E WifiHAL : return value nl_recvmsgs0
08-02 12:53:45.233 371 371 E WifiHAL : error result nl_cb_put-95
08-02 12:53:45.233 371 371 E WifiHAL : error result after nl_cb_put-95
08-02 12:53:45.233 371 371 E WifiHAL : error result after mutex unlock-95
08-02 12:53:45.234 371 371 E WifiHAL : Failed to register set Hal preInit; result = -95
08-02 12:53:45.234 371 371 E WifiHAL : wifi_hal_preInit failed

I am attaching the logs for the same.Please help and guide for the same.

These messages are getting printed from logcat in the cpp_bindings.cpp in the file path :android_build/hardware/broadcom/wlan/bcmdhd/cpp_bindings.cpp.

0 Kudos
Reply
4 Replies

1,017 Views
akshayd
Contributor I

Hi Team,Thanks a lot for the help and support. I wanted to know whether I need to print logs in the hal layer in the path:hardware/broadcom/wlan/bcmdhd/

0 Kudos
Reply

1,055 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @akshayd 

Can you provide the kernel log? Please confirm that the kernel driver has been loaded.

0 Kudos
Reply

1,049 Views
akshayd
Contributor I

Hi Team,

The module was already loaded as I checked in lsmod.Below is the kernel log(dmesg) while booting from the beginning.

After flashing the image,I am able to see the module rtl8822bu.ko inserted.

I am hereby attaching the kernel logs(dmesg logs) hereby.

 

0 Kudos
Reply

1,031 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @akshayd 

The kernel driver and firmware seems has been loaded correctly. You may need debug HAL driver from beginning..try to print more logs.

0 Kudos
Reply