Wednesday, 16 May 2012

Raspberry Pi Kernel Headers

As i mentiomed in my last post I have been trying to follow some instructions for building a driver for my WG111T usb wifi. I have got as far as the module assistant step which fails due to the kernel headers Debian package not being available:


pi@raspberrypi:~$ sudo m-a a-i ar5523
Updated infos about 1 packages
Getting source for kernel version: 3.1.9+
apt-get install kernel-headers-3.1.9+
Reading package lists... Done
Building dependency tree      
Reading state information... Done
E: Unable to locate package kernel-headers-3.1.9
E: Couldn't find any package by regex 'kernel-headers-3.1.9'
apt-get install build-essential
Reading package lists... Done
Building dependency tree      
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
Done!
Since then I have been trying to find out how to install the kernel headers but have so far failed to get a simple answer. 

I managed to find a forum thread which included some commands that sounded like they might do the right thing.

sudo apt-get install git
git clone –depth 1 https://github.com/raspberrypi/linux.git
sudo mv linux /lib/modules/3.1.9+/build
cd /lib/modules/3.1.9+/build
make mrproper
gzip -dc /proc/config.gz > .config
make modules_prepare

I tried to follow these instructions but only got as far as "make mrproper" before hitting an error.

pi@raspberrypi:/lib/modules/3.1.9+/build$ sudo make mrproper
Makefile:327: /lib/modules/3.1.9+/build/scripts/Kbuild.include: No such file or directory
/bin/bash: /lib/modules/3.1.9+/build/scripts/gcc-goto.sh: No such file or directory
make[1]: scripts/Makefile.clean: No such file or directory
make[1]: *** No rule to make target `scripts/Makefile.clean'.  Stop.
make: *** [_clean_.] Error 2


I can't see how this is meant to work and I'm now a bit stuck again. The key question is how I should get the kernel headers installed.

EDIT: I have got this working in my next post.

2 comments:

  1. You shouldn't need to sudo - you can build the kernel as an ordinary user, you just need to be root to install it.

    Obvious questions - does the file exist, does it have the right permissions, what is the Makefile actually doing, etc etc.

    ReplyDelete
    Replies
    1. I think I had to sudo because of the location on disk.

      Delete