joe2act
Posts: 40
Joined: Tue Jul 24, 2012 4:21 am

cannot found linux-header for 3.2.27

Mon Sep 17, 2012 11:46 pm

Hi,

I tried to compile simple device driver (hello.c) in RasPi. I already installed tool and some linux-headers in Raspbian. The current version is 3.2.27. But, I cannot find the 3.2.27's linux-header. How can I compile device driver with the right version of linux-header in Raspbian?

By the way, I can compile and run the same simple driver hello.c in Ubuntu Desktop.
pi@raspberrypi ~ $ sudo apt-cache search linux-header*
linux-headers-2.6-mx5 - Header files for Linux mx5 configuration (dummy package)
linux-headers-2.6-omap - Header files for Linux omap configuration (dummy package)
linux-headers-3.2.0-3-all - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-3-all-armhf - All header files for Linux 3.2 (meta-package)
linux-headers-3.2.0-3-common - Common header files for Linux 3.2.0-3
linux-headers-3.2.0-3-rpi - Header files for Linux 3.2.0-3-rpi
linux-headers-mx5 - Header files for Linux mx5 configuration (meta-package)
linux-headers-omap - Header files for Linux omap configuration (meta-package)
linux-headers-vexpress - Header files for Linux vexpress configuration (meta-package)
$
pi@raspberrypi ~ $ sudo apt-get install linux-headers-3.2.0-3-rpi linux-headers-3.2.0-3-all
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-3.2.0-3-all is already the newest version.
linux-headers-3.2.0-3-rpi is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded
$

pi@raspberrypi ~ $ gcc -v
Using built-in specs ....
gcc version 4.6.3 (Debian 4.6.3-8+rpi1)

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.2.27+ #102 PREEMPT Sat Sep 1 01:00:50 BST 2012 armv6l GNU/Linux
Thank you in advance.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: cannot found linux-header for 3.2.27

Thu Sep 20, 2012 7:14 am

You could download the kernel src and do a make_headers

ivanohé
Posts: 9
Joined: Sat Sep 22, 2012 3:05 pm

Re: cannot found linux-header for 3.2.27

Sat Sep 22, 2012 4:29 pm

up, please

shig
Posts: 1
Joined: Sun Sep 23, 2012 6:07 am

Re: cannot found linux-header for 3.2.27

Sun Sep 23, 2012 6:31 am

So, as the standard debian kernel packaging system isn't used (the kernel and module are all in the raspberrypi-bootloader package), and the headers aren't distributed, you will need to download the source tree from the github at https://github.com/raspberrypi/linux/. You won't have to recompile it however.

Here a quick guide. I'm assuming that you already have build-essential/compiler/everything else you need in place anyhow, and just need the kernel specific headers and symbols.

Download the kernel source and unpack it with:

Code: Select all

sudo bash
cd /usr/src
wget  https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
mv rpi-3.2.27
tar xzf rpi-3.2.27
Then we'll grab the config from the raspberry pi's running kernel, and get the source tree to prepare itself for module builds:

Code: Select all

cd raspberrypi-linux-*
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare
What you will also need to build modules that will actually go into the new kernel is Modules.symvers. Luckily, someone has nicely put it in the raspberrypi/firmware github along with the pre-compiled kernel and firmware binaries, so we can just download the latest one from there:

Code: Select all

wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
Then just make symlinks available in /lib/modules/[kernelversion]/ for the stuff you're compiling. Might as well put a symlink in for /usr/src/linux etc as well

Code: Select all

KSRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r`
ln -s ${KSRC} linux
popd
Apart from the time downloading, the rest should take about 10 minutes or so hopefully, depending on how fast the storage you've got available is. This will also take up about 630MB of space under /usr/src until you clean it up

Hope this helps

ivanohé
Posts: 9
Joined: Sat Sep 22, 2012 3:05 pm

Re: cannot found linux-header for 3.2.27

Mon Sep 24, 2012 6:44 am

Yes it does. I needed such a clear tutorial. I'm bookmarking this page, thank you.

greavette
Posts: 83
Joined: Thu Oct 04, 2012 4:25 pm

Re: cannot found linux-header for 3.2.27

Thu Oct 04, 2012 6:21 pm

Hello,

I'm following these instructions and from the get go I'm having trouble. Anyone else having trouble with:

wget https://github.com/raspberrypi/linux/tarball/rpi-3.2.27

I'm getting an "ERROR 500: Internal Server Error".

Thanks.

geronymo80
Posts: 3
Joined: Fri Oct 05, 2012 7:21 pm

Re: cannot found linux-header for 3.2.27

Fri Oct 05, 2012 7:40 pm

Hi, I have a problem to make simlinks and so usb director won't to install (./installer.sh install-server => error E : Unable to locate package linux-headers-3.2.27)
Can you help me ?

Thanks


shig wrote:So, as the standard debian kernel packaging system isn't used (the kernel and module are all in the raspberrypi-bootloader package), and the headers aren't distributed, you will need to download the source tree from the github at https://github.com/raspberrypi/linux/. You won't have to recompile it however.

Here a quick guide. I'm assuming that you already have build-essential/compiler/everything else you need in place anyhow, and just need the kernel specific headers and symbols.

Download the kernel source and unpack it with:

Code: Select all

sudo bash
cd /usr/src
wget  https://github.com/raspberrypi/linux/tarball/rpi-3.2.27
mv rpi-3.2.27
tar xzf rpi-3.2.27
Then we'll grab the config from the raspberry pi's running kernel, and get the source tree to prepare itself for module builds:

Code: Select all

cd raspberrypi-linux-*
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare
What you will also need to build modules that will actually go into the new kernel is Modules.symvers. Luckily, someone has nicely put it in the raspberrypi/firmware github along with the pre-compiled kernel and firmware binaries, so we can just download the latest one from there:

Code: Select all

wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers
Then just make symlinks available in /lib/modules/[kernelversion]/ for the stuff you're compiling. Might as well put a symlink in for /usr/src/linux etc as well

Code: Select all

KSRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r`
ln -s ${KSRC} linux
popd
Apart from the time downloading, the rest should take about 10 minutes or so hopefully, depending on how fast the storage you've got available is. This will also take up about 630MB of space under /usr/src until you clean it up

Hope this helps

joe2act
Posts: 40
Joined: Tue Jul 24, 2012 4:21 am

Re: cannot found linux-header for 3.2.27

Sat Oct 06, 2012 3:47 am

shig wrote:So, as the standard debian kernel packaging system isn't used (the kernel and module are all in the raspberrypi-bootloader package), and the headers aren't distributed, you will need to download the source tree from the github at https://github.com/raspberrypi/linux/. You won't have to recompile it however.
...
Hope this helps
Thank you very much for your quick guide. It is a very clear and very helpful quick guide.

joe2act
Posts: 40
Joined: Tue Jul 24, 2012 4:21 am

Re: cannot found linux-header for 3.2.27

Sat Oct 06, 2012 3:52 am

greavette wrote:Hello,

I'm following these instructions and from the get go I'm having trouble. Anyone else having trouble with:

wget https://github.com/raspberrypi/linux/tarball/rpi-3.2.27

I'm getting an "ERROR 500: Internal Server Error".

Thanks.
Just try download RasPi kernel source code again. I can download it. The "ERROR 500: Internal Server Error" error is not your problem. It maybe a github server's temporary problem.

geronymo80
Posts: 3
Joined: Fri Oct 05, 2012 7:21 pm

Re: cannot found linux-header for 3.2.27

Sat Oct 06, 2012 12:07 pm

Ok it's done for me.

I don't know why the first time it doesn't work.
Now it's working :-)

Thanks for the tutorial


neldlbk
Posts: 3
Joined: Wed Oct 10, 2012 11:47 am

Re: cannot found linux-header for 3.2.27

Wed Oct 10, 2012 10:19 pm

I'm having the same problem as the one stated in the start of this topic but I must admit that I am a complete novice when it comes to linux. I've been trying to install drivers for my Iburst Usb pppoe modem and I need the full 3.2.27+ headers to get it done and I've had no luck following this tutorial to get things working.
I've listed the exact commands that I've tried using. I would really appreciate any help on a step I may have missed or that was assumed I should know.

I boot up my raspberry pi with the latest Raspbian image released 18-09-2012 which has also gone through the process of apt-get update and apt-get upgrade.

I log in with my username and password and then from the command prompt I have entered the following

sudo bash
cd /usr/src
wget https://github.com/raspberrypi/linux/tarball/rpi-3.2.27

The file then proceeds to download and completes without errors. (Should there not be a .tar or .gz extension?)

mv rpi-3.2.27
The mv rpi-3.2.27 command fails with an error about further parameters expected, which makes sense since it is a move command and a destination is required. But I don't know what that destination should be.

I then follow the rest of the commands which work but I think that by messing up the previous step, I have messed everything else up.

tar xzf rpi-3.2.27
cd raspberrypi-linux-*
zcat /proc/config.gz > .config
make oldconfig
make modules_prepare
wget https://github.com/raspberrypi/firmware ... le.symvers

KSRC=`pwd`
(what does the 'pwd' do and should I be placing it there or should it be something else?)
pushd /lib/modules/`uname -r`
(I'm not sure but I guess that by 'uname -r' it is meant that I should use 3.2.27+ as the value inside the ' ' since that is what is returned when I use the uname -r command seperately.)
ln -s ${KSRC} source
ln -s ${KSRC} build
popd

pushd /usr/src
ln -s ${KSRC} linux-`uname -r` (again, should this be 3.2.27+ instead of 'uname -r' ?)
ln -s ${KSRC} linux
popd

All the commands above are typed exactly in the sequence shown and I have not moved to different folders or run other commands in between.

To be honest, I'm stumped. I would really appreciate some help with this.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: cannot found linux-header for 3.2.27

Thu Oct 11, 2012 10:55 am

You should be checking out the kernel from github using git
and not wget,
git clone https://github.com/raspberrypi/linux.git

Kernels and zips dont get on well

neldlbk
Posts: 3
Joined: Wed Oct 10, 2012 11:47 am

Re: cannot found linux-header for 3.2.27

Thu Oct 11, 2012 11:49 am

I'll give it a go and see how it turns out. Thanks

girishadurrel
Posts: 2
Joined: Wed May 30, 2012 3:23 am

Re: cannot found linux-header for 3.2.27

Fri Nov 02, 2012 9:13 am

Hey

For $KSRC='pwd'

very simply you could just type $pwd and copy paste the output $KSRC='output of pwd'.

Yes. For ln -s ${KSRC} linux-`uname -r` just replace uname -r with 3.2.27+ :)

I use wget and there is no problem with that as well :)

Hope you will get it working.

girishadurrel
Posts: 2
Joined: Wed May 30, 2012 3:23 am

Re: cannot found linux-header for 3.2.27

Fri Nov 02, 2012 9:14 am

It really did help. Thanks a lot for the nice tutorial :)

Thank again :)

bgirardot
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: cannot found linux-header for 3.2.27

Wed Nov 21, 2012 10:12 pm

Following the step-by-step as shig posted, with the sole exception of the incomplete mv command, I managed to compile a wireless driver module.

However, when I try to modprobe the driver into the running kernel, I get the following error:

Code: Select all

Nov 21 21:54:47 raspberrypi kernel: [14319.160912] rt5370sta: disagrees about version of symbol wake_up_process
Nov 21 21:54:47 raspberrypi kernel: [14319.160950] rt5370sta: Unknown symbol wake_up_process (err -22)
Is there any chance something in the step by step needs to be changed for the most recent version of raspbian wheezy 2012-10-28?

bgirardot
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: cannot found linux-header for 3.2.27

Fri Nov 23, 2012 3:00 am

bgirardot wrote:Following the step-by-step as shig posted, with the sole exception of the incomplete mv command, I managed to compile a wireless driver module.

However, when I try to modprobe the driver into the running kernel, I get the following error:

Code: Select all

Nov 21 21:54:47 raspberrypi kernel: [14319.160912] rt5370sta: disagrees about version of symbol wake_up_process
Nov 21 21:54:47 raspberrypi kernel: [14319.160950] rt5370sta: Unknown symbol wake_up_process (err -22)
Is there any chance something in the step by step needs to be changed for the most recent version of raspbian wheezy 2012-10-28?
For what it is worth, installing rpi-update and then running rpi-update eliminated the error and allowed the module to load.

bastler
Posts: 4
Joined: Wed Jan 02, 2013 10:38 am

Re: cannot found linux-header for 3.2.27

Wed Jan 02, 2013 11:43 am

hi there,

i was using this howto to compile a new driver module for my rtl8192cus based wlan dongle. however, i am unable to get the built module to work:

Code: Select all

# insmod 8192cu.ko 
Error: could not insert module 8192cu.ko: Invalid module format
dmesg tells me:

Code: Select all

# dmesg | tail -n1
[47934.353217] 8192cu: disagrees about version of symbol module_layout

Code: Select all

# modinfo ./8192cu.ko | grep vermagic
vermagic:       3.2.27+ preempt mod_unload modversions ARMv6 
i have already edited the main kernel Makefile to include

Code: Select all

EXTRAVERSION = +
- what else do i have to do to make this module work?

eddieAng
Posts: 4
Joined: Sat Dec 29, 2012 10:02 pm

Re: cannot found linux-header for 3.2.27

Wed Jan 09, 2013 9:49 pm

Hi,

I have a silly question. How do you create symbolic links?

KSRC=`pwd`: this is not a linux command. Is it a file that you alter? If so, where is it located?

Thanks in advance.
Ed

bgirardot
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland

Re: cannot found linux-header for 3.2.27

Thu Jan 10, 2013 1:25 am

sym links:

Code: Select all

ln -s /path/to/file /path/to/symlink

for example:

Code: Select all

ln -s /etc/network/interfaces /boot/network-interfaces

Code: Select all

KSRC=`pwd`
is a bash shell command and assigns the output of the pwd command to the variable KSRC (which I think is a common variable to hold the path to the Kernel SouRCe)

Note the "back ticks" around the pwd command, those are not single quote marks, they cause the shell to execute the command and put its output in place of the command.

dsr
Posts: 1
Joined: Fri Jan 25, 2013 4:05 am

Re: cannot found linux-header for 3.2.27

Fri Jan 25, 2013 4:15 am

Hi,

I've followed the guide described above to get the linux-header but I seem to be getting an error whenever I try to compile a kernel module (dvbhdhomerun) for the raspberry pi (3.2.27+). I get the following error message:

Code: Select all

pi@raspberrypi ~/dvbhdhomerun/kernel $ sudo make install
Building driver... ccflags-y=-Idrivers/media/dvb-core -Idrivers/media/frontends -Idrivers/media/dvb/dvb-core -Idrivers/media/dvb/frontends
make -C /lib/modules/`uname -r`/build  M=/home/pi/dvbhdhomerun/kernel modules
make[1]: Entering directory `/usr/src/raspberrypi-linux-ada8b44'
  Building modules, stage 2.
  MODPOST 3 modules
make[1]: Leaving directory `/usr/src/raspberrypi-linux-ada8b44'
make -C /lib/modules/`uname -r`/build M=/home/pi/dvbhdhomerun/kernel modules_install
make[1]: Entering directory `/usr/src/raspberrypi-linux-ada8b44'
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun.ko
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun_core.ko
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun_fe.ko
  DEPMOD  3.2.27+
make[1]: Leaving directory `/usr/src/raspberrypi-linux-ada8b44'
depmod -aeF /boot/System.map-`uname -r`
FATAL: could not load /boot/System.map-3.2.27+: No such file or directory
make: *** [install] Error 1
It seems to be looking for a System.map-3.2.27+ and, obviously, it is missing. I've been looking for a while where or how to get this file.

I do not think it is as simple as downloading https://github.com/raspberrypi/firmware ... System.map and copying it to /boot/System.map-3.2.27+.

(I hate to hijack the discussion but this is partly related to the issues/solutions brought up in this thread.)

tgwaste
Posts: 41
Joined: Thu Jan 31, 2013 7:15 pm

Re: cannot found linux-header for 3.2.27

Sat Feb 09, 2013 12:19 am

root@raspi:/usr/src/raspberrypi-linux-ada8b44# make modules_prepare
make: *** No rule to make target `modules_prepare'. Stop.


i dont get it :)

dax314
Posts: 1
Joined: Thu Aug 22, 2013 11:40 am

Re: cannot found linux-header for 3.2.27

Thu Aug 22, 2013 11:55 am

Hi,

did someone managed to get the solution to this problem? I have the same. In advance, thanks.
dsr wrote:Hi,

I've followed the guide described above to get the linux-header but I seem to be getting an error whenever I try to compile a kernel module (dvbhdhomerun) for the raspberry pi (3.2.27+). I get the following error message:

Code: Select all

pi@raspberrypi ~/dvbhdhomerun/kernel $ sudo make install
Building driver... ccflags-y=-Idrivers/media/dvb-core -Idrivers/media/frontends -Idrivers/media/dvb/dvb-core -Idrivers/media/dvb/frontends
make -C /lib/modules/`uname -r`/build  M=/home/pi/dvbhdhomerun/kernel modules
make[1]: Entering directory `/usr/src/raspberrypi-linux-ada8b44'
  Building modules, stage 2.
  MODPOST 3 modules
make[1]: Leaving directory `/usr/src/raspberrypi-linux-ada8b44'
make -C /lib/modules/`uname -r`/build M=/home/pi/dvbhdhomerun/kernel modules_install
make[1]: Entering directory `/usr/src/raspberrypi-linux-ada8b44'
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun.ko
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun_core.ko
  INSTALL /home/pi/dvbhdhomerun/kernel/dvb_hdhomerun_fe.ko
  DEPMOD  3.2.27+
make[1]: Leaving directory `/usr/src/raspberrypi-linux-ada8b44'
depmod -aeF /boot/System.map-`uname -r`
FATAL: could not load /boot/System.map-3.2.27+: No such file or directory
make: *** [install] Error 1
It seems to be looking for a System.map-3.2.27+ and, obviously, it is missing. I've been looking for a while where or how to get this file.

I do not think it is as simple as downloading https://github.com/raspberrypi/firmware ... System.map and copying it to /boot/System.map-3.2.27+.

(I hate to hijack the discussion but this is partly related to the issues/solutions brought up in this thread.)

vix
Posts: 3
Joined: Sun Oct 20, 2013 7:03 pm

Re: cannot found linux-header for 3.2.27

Sun Oct 20, 2013 7:24 pm

Hi!
I'm trying to make trivial driver module, like this:

Code: Select all

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
//#include <linux/fs.h>

MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("iiiiiiii");
MODULE_DESCRIPTION("ghjkhsgdkfhgksdjg");
MODULE_VERSION("0.1");

unsigned char ss[8];    // <-------------- change this size to 4 or to 0 will crash the kernel by "insmod"

//---------------------------------------------
static int __init led_init(void)
{
  printk( KERN_ALERT "Load module\n");
  return 0;
}
//---------------------------------------------
static void __exit led_exit(void)
{
  printk( KERN_ALERT "Unload module\n" );
}
//---------------------------------------------
module_init(led_init);
module_exit(led_exit);
This successfully compiled and loaded, but failed by "rmmod" with error:
libkmod: ERROR ../libkmod/libkmod-module.c:753 kmod_module_remove_module: could not remove 'test': Device or resource busy
Error: could not remove module test.ko: Device or resource busy
Also, if change of ss array to zero, insmod will make kernel "Oops" and kick to kernel debugger (kdb).
What i doing wrong?
OS: Raspbian Linux 3.6.11+ #557 PREEMPT Wed Oct 2 18:49:09 BST 2013 armv6l GNU/Linux

UPD: problem solved (http://www.raspberrypi.org/phpBB3/viewt ... 44#p442044)

Return to “Linux Kernel”

Who is online

Users browsing this forum: No registered users and 3 guests