Linux Headers On The Raspberry Pi

First lets get the kernel source

cd /usr/src/
git clone https://github.com/raspberrypi/linux.git

Now cd into that directory

cd linux

Take your current kernel configuration and use it when compiling

zcat /proc/config.gz > .config

Compile..

make oldconfig
make modules_prepare

You Need Module.symvers to build new modules

wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers

Now move link your compiled src to where applications will look for it

cd /usr/src/
SRC=`pwd`
pushd /lib/modules/`uname -r`
ln -s ${SRC} source
ln -s ${SRC} build
popd

pushd /usr/src
ln -s ${SRC} linux-`uname -r`
ln -s ${SRC} linux
popd