Building Pi Modules Without Building the Kernel

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:


tar xvfz rpi-3.6.y.tar.gz


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



Then my makefile for the actual module is

obj-m := kcrDriver.o


$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules


$(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.


15 thoughts on “Building Pi Modules Without Building the Kernel

  1. Thomas Dean

    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…’


  2. Pingback: Making a Goat Webcam: Taming The TP-LINK TL-WDN3200 | Randy Builds Things

    1. hexelpdkk Post author

      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.

  3. Pingback: Building the UT-100 driver on the Raspberry Pi – Servage Autoinstaller

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s