Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cross Compile MT7610U Driver for RPi2/3

Cross Compile MT7610U Driver for RPi2/3

$ mkdir bcm-staging
$ export WORK=`pwd`/bcm-staging

RPi2/3 Kernel

Setup toolchain

$ cd ${WORK}
$ git clone https://github.com/raspberrypi/tools
$ export PATH=${PATH}:`pwd`/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

Build

$ cd ${WORK}
$ git clone -b rpi-4.4.y https://github.com/raspberrypi/linux.git
$ cd linux
$ export KERNEL=kernel7
$ export ARCH=arm
$ export CROSS_COMPILE=arm-linux-gnueabihf-
$ make bcm2709_defconfig
$ make -j 4 zImage modules dtbs

MT7610U Driver

Build

$ cd ${WORK}
$ git clone -b rpi https://github.com/FantomJAC/mt7610u_wifi_sta_v3002_dpo_20130916.git
$ cd mt7610u_wifi_sta_v3002_dpo_20130916
$ export PI_SRC=${WORK}/linux
$ make

Install

Copy driver files over rootfs. (Kernel version may vary.)

Note: Ideally, you should use the kernel built above. But the driver may work while the kernel version 4.4 is used.

$ cp ./os/linux/mt7650u_sta.ko ${RPI_ROOTFS}/modules/4.4.21-v7+
$ mkdir -p ${RPI_ROOTFS}/etc/Wireless/RT2870STA
$ cp RT2870STA.dat ${RPI_ROOTFS}/etc/Wireless/RT2870STA

Add the following line on /etc/network/interfaces

allow-hotplug ra0
iface ra0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

On Raspberry PI system, do depmod.

# depmod -a
@danielschmalhofer

This comment has been minimized.

Copy link

@danielschmalhofer danielschmalhofer commented Feb 13, 2020

i get this error :(

pi@raspberrypi:~/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916 $ make
make -C tools
make[1]: Entering directory '/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory '/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/tools'
/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/tools/bin2h
chipset = mt7650u
chipset = mt7630u
chipset = mt7610u
cp -f os/linux/Makefile.6 /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/Makefile
make -C /home/pi/bcm-staging/linux SUBDIRS=/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux modules
make[1]: Entering directory '/home/pi/bcm-staging/linux'

WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.

CC [M] /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../os/linux/rt_profile.o
In file included from include/linux/mmzone.h:18:0,
from include/linux/gfp.h:5,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/include/os/rt_linux.h:31,
from /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/include/rtmp_os.h:44,
from /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/include/rtmp_comm.h:75,
from /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/include/rt_config.h:33,
from /home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../os/linux/rt_profile.c:28:
include/linux/page-flags-layout.h:5:30: fatal error: generated/bounds.h: No such file or directory
#include <generated/bounds.h>
^
compilation terminated.
scripts/Makefile.build:258: recipe for target '/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../os/linux/rt_profile.o' failed
make[2]: *** [/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/../../os/linux/rt_profile.o] Error 1
Makefile:1402: recipe for target 'module/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux' failed
make[1]: *** [module/home/pi/bcm-staging/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux] Error 2
make[1]: Leaving directory '/home/pi/bcm-staging/linux'
Makefile:399: recipe for target 'LINUX' failed
make: *** [LINUX] Error 2

@tdwebste

This comment has been minimized.

Copy link

@tdwebste tdwebste commented Aug 9, 2020

Did you find a way to generate the bounds.h file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.