Hi!
I've been trying to compile a driver for a WiFi USB adapter with the MT7601U chipset.
On piCore 6.0rc1 I succeeded in compiling the driver using the modules and .config that Béla put available for download.
I now wanted to do the same on final release 6.0.
I can get the kernel compiled and all the modules. And the driver compiles too, but the insmod keeps failing with:
$ sudo insmod /home/tc/mt7601/src/os/linux/mt7601Usta.ko
insmod: can't insert '/home/tc/mt7601/src/os/linux/mt7601Usta.ko': invalid module format
Because I think I am doing something wrong, I want to show you the steps I am taking to compile the driver.
If anybody sees something wrong, please tell me.
Here it goes..
I've formatted a USB stick with the linux filesystem (first I didn't do that and had all kinds of case-sensitive problems), and put the kernel on it this way:
sudo mount /dev/sda1 /mnt/sda1
cd /mnt/sda1
sudo wget https://github.com/raspberrypi/linux/archive/rpi-3.12.y.tar.gz
sudo tar xvfz /home/pi/kernel/rpi-3.12.y.tar.gz
Next I installed the essential things for compiling:
tce-load -wi compile-essentials.tcz
tce-load -wi linux-3.12.y_api_headers.tcz
tce-load -wi git.tcz
Create a symbolic link to the usb stick called "build" in the modules directory:
cd /lib/modules/3.12.36-piCore+
sudo ln -s /mnt/sda1/linux-rpi-3.12.y build
And now I can start building the kernel:
cd /lib/modules/3.12.36-piCore+/build
make mrproper
Now retrieve the .config from the current running piCore:
cd /mnt/sda1/linux-rpi-3.12.y
sudo rm -r .config
sudo zcat /proc/config.gz > /home/tc/running.config
sudo mv /home/tc/running.config .config
Now prepare it for compiling:
sudo make prepare
sudo make modules_prepare
And then compile all modules to retreive Module.symvers. This takes long! About half a day on the pi.
I know that this goes faster when using cross-compiling. But I don't own a powerfull linux machine.
Anyway, compiling the modules:
sudo make modules
When this is done, the driver can be compiled. First get the sources (from:
https://github.com/porjo/mt7601):
cd /home/tc
git clone https://github.com/porjo/mt7601.git
And start compilation:
cd mt7601/src
make
These sources don't compile at the moment, one source (rt_linux.c) has to be changed. I won't go into details about it now, it will complicate this post.
After the modification it will compile.
Then I have to place a .dat file in the right directory:
sudo mkdir -p /etc/Wireless/RT2870STA/
sudo cp RT2870STA.dat /etc/Wireless/RT2870STA
And I can try to insmod the module:
sudo insmod /home/tc/mt7601/src/os/linux/mt7601Usta.ko
But this will result in this error:
insmod: can't insert '/home/tc/mt7601/src/os/linux/mt7601Usta.ko': invalid module format
And this is the message in dmesg:
[ 5206.098159] mt7601Usta: no symbol version for module_layout
I've researched all over the internet, and everything points to something with the Module.symvers. But I don't know how to check what's wrong with it..
Greetings,
Gerrelt.