armbian / build

Armbian Linux build framework generates custom Debian or Ubuntu image for x86, aarch64, riscv64 & armhf
https://www.armbian.com
GNU General Public License v2.0
4.01k stars 2.26k forks source link

Mediatek Mt7601 usb wifi #311

Closed flexiti closed 8 years ago

flexiti commented 8 years ago

[SOLVED] Help please, How install this device driver now ? ( previous source not existing )

flexiti commented 8 years ago

Orange PI PC, Jessie desktop I downloaded the previous, ready to use image from [http://www.armbian.com/orange-pi-pc/] and I try as described here : [https://github.com/igorpecovnik/lib/blob/master/documentation/user-faq.md#how-to-build-a-wireless-driver-] but I have no success (errors below) . When I try to build from current sources, there is no sources of the MT7601 driver.


root@orangepipc:/usr/src/linux-headers-3.4.112-sun8i# make scripts scripts/kconfig/conf --silentoldconfig Kconfig fs/Kconfig:287: can't open file "fs/fs_compat.kconfig" /usr/src/linux-headers-3.4.112-sun8i/scripts/kconfig/Makefile:33: recipe for target 'silentoldconfig' failed make[2]: * [silentoldconfig] Error 1 /usr/src/linux-headers-3.4.112-sun8i/Makefile:493: recipe for target 'silentoldconfig' failed make[1]: * [silentoldconfig] Error 2 make: * No rule to make target 'include/config/auto.conf', needed by 'scripts'. Stop. root@orangepipc:/usr/src/linux-headers-3.4.112-sun8i# root@orangepipc:/usr/src# cd mt7601-3.0.0.4/ root@orangepipc:/usr/src/mt7601-3.0.0.4# make ARCH=arm make -C tools make[1]: Entering directory '/usr/src/mt7601-3.0.0.4/tools' gcc -g bin2h.c -o bin2h /usr/bin/ld: cannot open output file bin2h: Read-only file system collect2: error: ld returned 1 exit status Makefile:2: recipe for target 'all' failed make[1]: * [all] Error 1 make[1]: Leaving directory '/usr/src/mt7601-3.0.0.4/tools' Makefile:330: recipe for target 'build_tools' failed make: *\ [build_tools] Error 2 root@orangepipc:/usr/src/mt7601-3.0.0.4#

ThomasKaiser commented 8 years ago

Read-only file system

Seems you have a local problem too. And yes, it's already known that the sources aren't available any more at the old location but it needs some work to fix this

flexiti commented 8 years ago

Read-only file system

I suppose, however, that this may not be a local problem, simply copied the image from ambian.com and immediately ran this script. What kind of problem would that be? any suggestions ?

igorpecovnik commented 8 years ago

We will fix this driver eventually but for now it's disabled.

Read only file system indicates some troubles with media, file system corruption. Check SD card quality, use other one.

flexiti commented 8 years ago

All over again, another card (16G Kingston Class 10 UH1) image from [http://www.armbian.com/orange-pi-pc/] cd /usr/src/linux-headers-$(uname -r) make scripts

mariuszb@orangepipc:~$ cd /usr/src/linux-headers-$(uname -r) mariuszb@orangepipc:/usr/src/linux-headers-3.4.112-sun8i$ make scripts scripts/kconfig/conf --silentoldconfig Kconfig fs/Kconfig:287: can't open file "fs/fs_compat.kconfig" /usr/src/linux-headers-3.4.112-sun8i/scripts/kconfig/Makefile:33: recipe for target 'silentoldconfig' failed make[2]: * [silentoldconfig] Error 1 /usr/src/linux-headers-3.4.112-sun8i/Makefile:493: recipe for target 'silentoldconfig' failed make[1]: * [silentoldconfig] Error 2 make: *\ No rule to make target 'include/config/auto.conf', needed by 'scripts'. Stop. mariuszb@orangepipc:/usr/src/linux-headers-3.4.112-sun8i$

and second part: cd /usr/src/mt7601-3.0.0.4 make ARCH=arm

root@orangepipc:/usr/src/mt7601-3.0.0.4# make ARCH=arm make -C tools make[1]: Entering directory '/usr/src/mt7601-3.0.0.4/tools' gcc -g bin2h.c -o bin2h make[1]: Leaving directory '/usr/src/mt7601-3.0.0.4/tools' /usr/src/mt7601-3.0.0.4/tools/bin2h cp -f os/linux/Makefile.6 /usr/src/mt7601-3.0.0.4/os/linux/Makefile make -C /lib/modules/3.4.112-sun8i/build SUBDIRS=/usr/src/mt7601-3.0.0.4/os/linux modules make[1]: Entering directory '/usr/src/linux-headers-3.4.112-sun8i' CC [M] /usr/src/mt7601-3.0.0.4/os/linux/../../os/linux/rt_profile.o /bin/sh: 1: /usr/src/linux-headers-3.4.112-sun8i/scripts/recordmcount: not found scripts/Makefile.build:307: recipe for target '/usr/src/mt7601-3.0.0.4/os/linux/../../os/linux/rt_profile.o' failed make[2]: * [/usr/src/mt7601-3.0.0.4/os/linux/../../os/linux/rt_profile.o] Error 127 Makefile:1368: recipe for target 'module/usr/src/mt7601-3.0.0.4/os/linux' failed make[1]: * [module/usr/src/mt7601-3.0.0.4/os/linux] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-3.4.112-sun8i' Makefile:394: recipe for target 'LINUX' failed make: *\ [LINUX] Error 2 root@orangepipc:/usr/src/mt7601-3.0.0.4#

zador-blood-stained commented 8 years ago

Kernel headers scripts compilation is broken in this version. This will be fixed in new kernel release or you can install prebuilt kernel from here.

flexiti commented 8 years ago

I do not know if I understood you well (I'm not good in Linux), but

root@orangepipc:/home/mariuszb/Downloads# sudo dpkg --install linux-image-sun8i_5.11_armhf.deb (Reading database ... 152047 files and directories currently installed.) Preparing to unpack linux-image-sun8i_5.11_armhf.deb ... Unpacking linux-image-sun8i (5.11) over (5.10) ... Setting up linux-image-sun8i (5.11) ... update-initramfs: Generating /boot/initrd.img-3.4.112-sun8i root@orangepipc:/home/mariuszb/Downloads

-Then reboot and again make scripts, the effect is the same

mariuszb@orangepipc:/usr/src/linux-headers-3.4.112-sun8i$ make scripts scripts/kconfig/conf --silentoldconfig Kconfig fs/Kconfig:287: can't open file "fs/fs_compat.kconfig"

zador-blood-stained commented 8 years ago

You need to install linux-headers package too.

flexiti commented 8 years ago

Thank you. @zador-blood-stained I am one step further :)

cd /usr/src/linux-headers-$(uname -r) make scripts

is ok now

Now, I did this:

root@orangepipc:/usr/src/mt7601-3.0.0.4# make ARCH=arm

there were several warnings but finally:

CC [M] /usr/src/mt7601-3.0.0.4/os/linux/../../os/linux/usb_main_dev.o CC [M] /usr/src/mt7601-3.0.0.4/os/linux/../../common/rtusb_dev_id.o CC [M] /usr/src/mt7601-3.0.0.4/os/linux/../../common/frq_cal.o LD [M] /usr/src/mt7601-3.0.0.4/os/linux/mt7601Usta.o Building modules, stage 2. MODPOST 1 modules CC /usr/src/mt7601-3.0.0.4/os/linux/mt7601Usta.mod.o LD [M] /usr/src/mt7601-3.0.0.4/os/linux/mt7601Usta.ko make[1]: Leaving directory '/usr/src/linux-headers-3.4.112-sun8i' cp -f /usr/src/mt7601-3.0.0.4/os/linux/mt7601Usta.ko /tftpboot 2>/dev/null || : root@orangepipc:/usr/src/mt7601-3.0.0.4#

.... And I do not know what to do next :)

insmod mt7601Usta.ko

and dmesg: [ 812.087846] usbcore: registered new interface driver rt2870 why rt2870 ? iwconfig wlan0 shows nothing

zador-blood-stained commented 8 years ago

I don't have any MT7601 devices, so no idea, sorry. Please check output of modinfo mt7601Usta, lsmod and lsusb to confirm that this module is properly installed and can handle your device. BTW, you probably need to copy this module to some subdirectory in /lib/modules/$(uname -r)/ and execute depmod

flexiti commented 8 years ago

root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# lsmod

Module Size Used by mt7601Usta 564290 0
mali_drm 2732 1 drm 178255 2 mali_drm mali 123208 0 ump 29379 3 mali 8189es 994547 0

root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# modinfo mt7601Usta

modinfo: ERROR: Module mt7601Usta not found.

root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# lsusb

Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 002: ID 1997:2433 Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 002: ID 148f:7601 Ralink Technology, Corp. ;; its ok

root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# iwconfig wlan0

wlan0 No such device

Only one type Wifi dongle work on Armbian ?

igorpecovnik commented 8 years ago

Locate this file and try:

insmod mt7601Usta.ko

Check if driver was loaded

dmesg

flexiti commented 8 years ago

@igorpecovnik see above

insmod mt7601Usta.ko and dmesg: [ 812.087846] usbcore: registered new interface driver rt2870 why rt2870 ? iwconfig wlan0 shows nothing

root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# modinfo mt7601Usta.ko filename: /usr/src/mt7601-3.0.0.4/os/linux/mt7601Usta.ko version: 3.0.0.3 description: RT2870 Wireless Lan Linux Driver author: Paul Lin paul_lin@ralinktech.com license: GPL srcversion: B01112D667AAAA446F0A525 alias: usb:v2955p1003d_dc_dsc_dp_ic_isc_ip alias: usb:v2955p1001d_dc_dsc_dp_ic_isc_ip alias: usb:v2955p0001d_dc_dsc_dp_ic_isc_ip alias: usb:v2A5Fp1000d_dc_dsc_dp_ic_isc_ip 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 depends: vermagic: 3.4.112-sun8i SMP preempt mod_unload modversions ARMv7 p2v8 parm: mac:rt28xx: wireless mac addr (charp) root@orangepipc:/usr/src/mt7601-3.0.0.4/os/linux# iwconfig wlan0 wlan0 No such device

flexiti commented 8 years ago

@igorpecovnik @ThomasKaiser what types of wifi dongle work with Armbian? It can simply buy a instead of wasting time, although this type was described as acting - unfortunately does not work in the previous version and is no longer running in new version

igorpecovnik commented 8 years ago

No idea, we don't maintain list of all supported devices by Linux kernel. http://www.linux-drivers.org

Ask on forum what do they use.

BTW: I know this chip works on mainline kernel just fine, but it's low performance.

flexiti commented 8 years ago

Ufff, its working from current sources now :) I have compiled latest Armbian source and then added wifi driver. I have to organize everything what I've done but not today. I'll let you know what I did if it needed Most vital observation: This driver is shown as a ra0, not as wlan0 BTW. this is ubuntu image, I will check also on Debian mediatekmt6701

igorpecovnik commented 8 years ago

Yes, not all of drivers show up as wlan0 ...area of (wireless) networking is big (mess). We only try to bring up chips which are soldered to the boards. Even this can be sometimes very challenging.

flexiti commented 8 years ago

So.. (I puted copy of Mediatek driver on my git)

sudo apt-get install linux-headers-generic build-essential git sudo apt-get install git git clone https://github.com/flexiti/mt7601.git cd mt7601 make clean make make install mkdir -p /etc/Wireless/RT2870STA/ cp RT2870STA.dat /etc/Wireless/RT2870STA/ modprobe mt7601Usta

in addition in desktop mode in the network options I have changed network Wifi prefix from wlan0 to ra0, and mark my Wifi network to be automatically connected

Tested on latest Armbian 5.11 Debian Jessy and Armbian 5.11 Ubuntu Trusty) Network config example:

auto ra0 iface ra0 inet static
address 192.168.0.56 netmask 255.255.255.0 gateway 192.168.0.1 wpa-ssid YOURSID wpa-psk YOURPASS dns-nameservers 8.8.8.8 8.8.4.4

The original vendor driver can be downloaded from MediaTek's website (http://www.mediatek.com/en/downloads1/downloads/mt7601u-usb/).

@igorpecovnik
Can You mark it as solved ? BTW. I have connected only Wifi (192.168.0.56), but on terminal welcome message I see wired eth1 address (192.168.0.55) Thank you for your help and for Armbian :+1:

igorpecovnik commented 8 years ago

welcome screen is not working properly if connected via wlan ... need to fix once.

Valerkav commented 8 years ago

RaspberryPi. Raspbian Jessie. this error, by step "make":

pi@raspberrypi:~/mt7601 $ make
make -C tools
make[1]: Entering directory '/home/pi/mt7601/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory '/home/pi/mt7601/tools'
/home/pi/mt7601/tools/bin2h
cp -f os/linux/Makefile.6 /home/pi/mt7601/os/linux/Makefile
make -C /lib/modules/4.4.9+/build SUBDIRS=/home/pi/mt7601/os/linux modules
make[1]: *** /lib/modules/4.4.9+/build: No such file or directory.  Stop.
Makefile:394: recipe for target 'LINUX' failed
make: ***[LINUX] Error 2

What can i do?

flexiti commented 8 years ago

try .. sudo apt-get install linux-generic

saif619 commented 7 years ago

screenshot 303 i am not able to install the driver , I have attached the screenshot of the error Please help

btmerz commented 7 years ago

Hello, I have the same problem with my OrangePi PC with Armbian and a MT7601 wifi dongle not working. So I followd the instructions from flexiti: sudo apt-get install linux-headers-generic build-essential git sudo apt-get install git git clone https://github.com/flexiti/mt7601.git cd mt7601 make clean make make install mkdir -p /etc/Wireless/RT2870STA/ cp RT2870STA.dat /etc/Wireless/RT2870STA/ modprobe mt7601Usta

The commands ran all without any error. But after a reboot and checking with ifconfig there is still no new device visible. Any help yould be great. Bernd

igorpecovnik commented 7 years ago

https://forum.armbian.com/index.php?/search/&q=MT7601

EliasKotlyar commented 7 years ago

Hello everyone,

My personal experience on compiling on a Olinuxino A20:

  1. sudo apt-get install build-essential git (linux-headers-generic - is not avaible)
  2. cd /usr/src/linux-headers-4.11.6-sunxi/scripts/
  3. make recordmcount (needed cause its failing if not compiled)
  4. cd /tmp
  5. git clone https://github.com/EliasKotlyar/mt7601 cd mt7601 make clean make make install mkdir -p /etc/Wireless/RT2870STA/ cp RT2870STA.dat /etc/Wireless/RT2870STA/ modprobe mt7601Usta
martinayotte commented 7 years ago

From what I know, MT7601 is already part of the Mainline kernel ...

EliasKotlyar commented 7 years ago

Hello martinayotte,

Yes, you are right. Its avaible on the mainline kernel from 4.2 upwards(https://github.com/art567/mt7601usta). Unfortunately, it was not working as expected - it gave me a lot of kernel messages when trying to connect. The connection was not working at all. After searching around, i found this issue and tried to compile this solution: https://github.com/flexiti/mt7601. It was not succesfull, because of some changes in the new kernels. After patching, and compiling, it started working...so i shared my solution for this problem.

Greetings Elias

pansila commented 6 years ago

It works on kernel 4.9 (armbian 5.25) but crashs on kernel 4.11 (armbian 5.31) when associating to an AP.

igorpecovnik commented 6 years ago

Modern kernels have this driver build in. I am not sure from which version but they are present in latest 4.14.y

pansila commented 6 years ago

@igorpecovnik New mac80211-based mt7601 driver had been merged to upstream since 4.2. https://github.com/torvalds/linux/commit/c869f77d6abb5d5f9f2f1a661d5c53862a9cad34

pansila commented 6 years ago

Afte upgraded to 4.14 (Armbian 5.31), it works again.