Wifi driver No rule to make target

Hi there
I need to install/compile a driver for my wifi usb stick.
Bus 001 Device 004: ID 148f:761a Ralink Technology, Corp.

I used this driver on my gentoo-raspberry without any issues, so I tried it
on mate too:

What I did so far:

sudo apt install git build-essential
sudo apt-get install raspberrypi-kernel-headers
rpi-update

#uname -r
4.14.29-v7+

If I go then in the driver source directory and do a
make

I get this error:
~/build/mt7610u$ make
make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/4.14.29-v7+/build M=/home/astro/build/mt7610u modules
make[1]: Entering directory ‘/lib/modules/4.14.29-v7+/build’
make[1]: *** No rule to make target ‘modules’. Stop.
make[1]: Leaving directory ‘/lib/modules/4.14.29-v7+/build’
Makefile:370: recipe for target ‘modules’ failed
make: *** [modules] Error 2

I guess I miss something kernel related, maybe the whole kernel source?
Any ideas anyone?

You shouldn’t of run rpi-update. The installed kernel and header package will be out of sync.

Ok, so I started from scratch again, new clean ubuntu mate sdcard.

sudo apt install git
mkdir build
cd build
git clone https://github.com/ulli-kroll/mt7610u.git
cd mt7610u
make

results in error:

make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/4.4.38-v7+/build M=/home/astro/build/mt7610u modules
make[1]: *** /lib/modules/4.4.38-v7+/build: No such file or directory.  Stop.
Makefile:370: recipe for target 'modules' failed
make: *** [modules] Error 2

how to proceed?

You need to install the header package that matches the kernel you have installed. So if you want the latest released kernel package and header package:

sudo apt install raspberrypi-kernel raspberrypi-kernel-headers

If you want a header package to match a previous kernel, then you’ll have to look here: http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/

2 Likes

How To Fix No Wireless Network In Ubuntu 14.04 ,14.10 and 16.04. Here i am sharing my experience .I always got error when i reinstall ubuntu or install fresh ubuntu installed. When you install ubuntu , every one face two common issue touchpad or wifi related isuue.
it Working For me. please check blow link it help you

thnaks rdxravirajsinh but your suggestion has nothing to to with Ubuntu-Mate on an Raspberry PI. I guess your approach assumes that the wifi driver is already in the kernel source, but my wifi device driver has not found its way into the kernel yet (nor possibly will ever ), its only maintained by a few guys on github.

Forthermore If I read corretly I guess your approach would mix non-Rasperry Pi kernel with the Raspberry Pi kernel on my system.

Please correct me if I am wrong.

@stillwinter

thanks, “uname -r” tells me I am running 4.4.38-v7+ .
Now I am confused by your “if you want the latest released kernel”…
Is the kernel I run currently the “latest”? So I can do a

sudo apt install raspberrypi-kernel raspberrypi-kernel-headers

to get the matching headers?

And if I had to go to
http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/
how can I find the right headers? The files are all named by date, not by version?

Ok I probably found that version.

apt-cache show raspberrypi-kernel
gives me

raspberrypi-kernel_1.20161215-1~xenial1.0_armhf.deb

sudo apt install raspberrypi-kernel-headers

it then installed

raspberrypi-kernel-headers armhf 1.20161215-1~xenial1.0

solved!
After it installed the headers I only had to change the drivers Makefile line:
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(PWD) modules

to

$(MAKE) ARCH=arm -C $(KSRC) M=$(PWD) modules

compiling succeded,

sudo modprobe cfg80211
sudo insmod mt7610u.ko

device is now listed as:

iwconfig 
wlan0     Ralink STA

marking as solved. Any futher driver related issues will got to the corresponding github issues page.
Thanks for your help! :slight_smile:

Great stuff pauledd

If you run

sudo apt update sudo apt install raspberrypi-kernel raspberrypi-kernel-headers

you’ll have the latest kernel and you’ll probably need to recompile. Look into dkms to automate the re-compilation.