Every now and then I get back to my Raspberry Pi, and realise that I have completely rebuilt my image. That makes it pretty hard to find my module building instructions, so here they are:
wget https://github.com/raspberrypi/linux/archive/rpi-3.6.y.tar.gz
tar xvfz rpi-3.6.y.tar.gz
su
mv linux-rpi-3.6.y /usr/src
ln -s /usr/src/linux-rpi-3.6.y /lib/modules/3.6.11+/build
cd /lib/modules/3.6.11+/build
make mrproper
gzip -dc /proc/config.gz > .config
make modules_prepare
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
exit
Then my makefile for the actual module is
obj-m := kcrDriver.o
all:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
What is particularly useful about this is that I don’t need to compile the entire kernel just to build my one module.
I had a problem with
cd /lib/modules/3.6.11+/build
then following commands failed
I did
cd /usr/src//linux-rpi-3.6.y/
and everything worked fine.
Don’t understand this – ls shows the same files in both places…
I looked at several files and they are the same.
It is almost like bash is not following the link properly. I created the link with ‘ln -s…’
Strange.
Thanks !!!!
It’s good that these instructions remain useful! Thanks for the feedback.
Your instructions work perfectly for me. Thanks!
Reblogged this on tecprojects and commented:
important, so keep in mind
Can’t thank you enough for this. Keep up the good work.
Thanks for the thanks, Dan. As I was primarily posting this so I wouldn’t forget, I love the fact that it is still useful.
Just a heads up that this stopped working 😦 due to changes to Module.symvers
I changed:
wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
to:
wget https://raw.github.com/raspberrypi/firmware/8a1dac251e06a44c61c13c664a2822f7c3026c50/extra/Module.symvers
Which picks up an earlier version of the file.
Thanks for the clear guide and thank you as well Dan, for the heads up, that got it working! 🙂
Actually i have followed your guide and it do not work.. I cannot get the module loaded..
I have opened a post, i will appreciate if you can take a look i am going crazy with this..
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=33&t=60927
Pingback: Making a Goat Webcam: Taming The TP-LINK TL-WDN3200 | Randy Builds Things
After so many hours of failed cross-compile, this method worked for me on 3.10.33+. I even used Module.symvers from https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
Thanks a lot.
Thanks for commenting. Did you update kernel using rpi-update, or are you just using the default? I have had a couple of people having issues withy these instructions, and occasionally try and find out why it works for most but not for all.
Pingback: Building the UT-100 driver on the Raspberry Pi – Servage Autoinstaller
Terrific writing on random topics. Im trying to currently
accomplish something such as what you have here except on
a different topic totally. Many thanks for the inspiration to
write better content.