hisi3518ev200 transplant MT7601

Note: this blog comes from the fifth season of Mr. Zhu Haisi project. This blog is only for learning and communication

Virtual machine: VMware 15 five
System: Ubuntu 18 04
Platform: hisi3518ev300

MT7601 driver, including station mode and access point mode: https://pan.baidu.com/s/1i_hPImFTZN-afyHh4f54bQ
Extraction code: vcge

Working in sta mode

1. Unzip the file

tar -jxvf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.bz2

2. Modify Makefile
(1) Comment out PLATFORM = SMDK on line 49
(2) Add in line 67: PLATFORM = HISI_3518E
(3) Continue to search for SMDK, find it on line 276, follow the corresponding format, and add it at 282 blank lines

ifeq ($(PLATFORM),HISI_3518E)
LINUX_SRC = /home/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/kernel/linux-3.4.y
CROSS_COMPILE = arm-hisiv300-linux-
1.Pay attention to modifying the path of your kernel source tree
2.If the cross compilation tool chain does not export If it comes out, you need to add an absolute path.

3. Modification/ os/linux/config.mk
(1) Search HAS_WPA_SUPPLICNAT, confirm


(2) Search for SMDK, and then add it under it according to the format

ifeq ($(PLATFORM),HISI_3518E)

4. Modify the output path of ko file. If not, it will be in the current directory
(1) Open Makefile
(2) Modify 439 lines

cp -f $(RT28xx_DIR)/os/linux/mt$(MODULE)sta.ko /Self modified output path 2>/dev/nul    l || :

5. make directly
Error report found

make[1]: Enter directory“/home/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/kernel/linux-3.4.y"
  CC [M]  /home/MT7601_driver/sta/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_profile.o
arm-hisiv300-linux-gcc: Error: unrecognized command line option '-m64'
arm-hisiv300-linux-gcc: Error: unrecognized command line option '-mno-red-zone'
arm-hisiv300-linux-gcc: Error: unrecognized command line option '-mcmodel=kernel'
arm-hisiv300-linux-gcc: Error: unrecognized command line option '-maccumulate-outgoing-args'

Modify the Makefile of the home directory,
At line 406, change FREESCALEE8377 to HISI_3518E
In line 407, change it to ARCH=arm, and leave the rest unchanged


  LD [M]  /home/MT7601_driver/sta/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/mt7601Usta.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/MT7601_driver/sta/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/mt7601Usta.mod.o
  LD [M]  /home/MT7601_driver/sta/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/mt7601Usta.ko
make[1]: Leave directory“/home/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/kernel/linux-3.4.y"
cp -f /home/MT7601_driver/sta/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/mt7601Usta.ko /home/nfs_server 2>/dev/null || :

I changed the exported directory to / home/nfs_server, so my ko file is exported in / home / NFS_ In the server directory

root@czp-PC:/home/nfs_server# ls -l mt7601Usta.ko 
-rw-r--r-- 1 root root 909244 10 April 24-15:38 mt7601Usta.ko

7. Confirmation
Confirm the vermagic information of the module. The version is 3.4.35

root@czp-PC:/home/nfs_server# modinfo mt7601Usta.ko 
filename:       /home/nfs_server/mt7601Usta.ko
description:    RT2870 Wireless Lan Linux Driver
author:         Paul Lin <paul_lin@ralinktech.com>
license:        GPL
srcversion:     B2632BD2D7AD40A63B72D9E
alias:          usb:v148Fp760Bd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v148Fp7601d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v148Fp6370d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v148Fp7650d*dc*dsc*dp*ic*isc*ip*
vermagic:       3.4.35 mod_unload ARMv5 p2v8 
parm:           mac:rt28xx: wireless mac addr (charp)

8. Change your name
Now the network card obtained by insmod loading the driver is ra0, which can be renamed by modifying the driver
Enter vim include/rtmp_def.h
Search ra and change it to wlan.
Finally, go back to the root directory ls and make again to get the new ko file

9. Copy rt2870sta dat
Create a new path / etc/Wireless/RT2870STA on the development board and put rt2870sta Copy dat to this folder

cp RT2870STA.dat  /etc/Wireless/RT2870STA/RT2870STA.dat

In fact, most of the steps are in the readme folder_ STA_ USB is mentioned. You can refer to the steps here and refer to readme at the same time_ STA_ USB for operation.

Working in ap mode

1. After decompression, enter the Makefile in the main directory
(1) Note out PLATFORM=pc and add platform = hisi later_ 3518E
(2) Search the SMDK in line 270, take its format as the blueprint, and then copy a copy below for modification,

ifeq ($(PLATFORM),HISI_3518E)
LINUX_SRC = /home/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/kernel/linux-3.4.y
CROSS_COMPILE = arm-hisiv300-linux-
export ARCH=arm

(3) Go to line 399 and change FREESCALE8377 to HISI_3518E,ARCH=arm
report errors

  CC [M]  /home/MT7601_driver/ap/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/../../os/linux/rt_profile.o
/home/MT7601_driver/ap/MT7601U_LinuxAP_3.0.0.1_20130802/os/linux/../../os/linux/rt_profile.c:26:23: Fatal error: rt_config.h: There is no such file or directory

Enter the os/linux directory and open config MK file
Search SMDK, follow its format, and add

ifeq ($(PLATFORM),HISI_3518E)

Under os/linux, you can also modify the makefile according to the above method to modify the output path of the ko file

4. Modify rt2870ap dat
Create a new path / etc/Wireless/RT2870AP on the development board and put rt2870ap Copy dat to this folder
Modify project

SSID=MT7601AP_WPA(The name here is in pc Connections seen on the machine ssid Name)
AuthMode=WPA2PSK(Encryption method)
WPAPSK=1234567890((this is the password)


/mnt # insmod mt7601Uap.ko
rtusb init rt2870 --->

=== pAd = c2f14000, size = 866712 ===

<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
Endpoint(8) is for In-band Command
Endpoint(4) is for WMM0 AC0
Endpoint(5) is for WMM0 AC1
Endpoint(6) is for WMM0 AC2
Endpoint(7) is for WMM0 AC3
Endpoint(9) is for WMM1 AC0
Endpoint(84) is for Data-In
Endpoint(85) is for Command Rsp
usbcore: registered new interface driver rt2870

6. Set ip address

/mnt # ifconfig ra0
FW Version:0.1.00 Build:7640
Build Time:201302052146____
ILM Length = 45380(bytes)
DLM Length = 0(bytes)
Loading FW....
RTMP_TimerListAdd: add timer obj c2fa2cd4!
RTMP_TimerListAdd: add timer obj c2f17f70!
RTMP_TimerListAdd: add timer obj c2f17b5c!
RTMP_TimerListAdd: add timer obj c2f17f3c!
............(Omit some, too long, debugging information)
wmode_band_equal(): Band Equal!
............(Omit some, too long, debugging information)
key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
1. Phy Mode = 14
2. Phy Mode = 14
NVM is Efuse and its size =1d[1e0-1fc]
ERROR!!! MT7601 E2PROM: WRONG VERSION 0xd, should be 12
3. Phy Mode = 14
AntCfgInit: primary/secondary ant 0/1
MCS Set = ff 00 00 00 01
Main bssid = 00:e0:2d:4a:41:7c
<==== rt28xx_init, Status=0
0x1300 = 00064320
RTMPDrvOpen(1):Check if PDMA is idle!
RTMPDrvOpen(2):Check if PDMA is idle!

7. Search the Internet with your mobile phone
According to the ssid name and psk set in step 4

8. Set the ip address of the pc

ping test

Posted by kkurkowski on Tue, 10 May 2022 02:52:20 +0300