I have one short question. I installed Ubuntu 9.04 and
wanted to write HelloWorld module. But I didn't succeeded because
it won't work for some reason [with generic kernel]. Here is code
for this basic module hello-1.c:

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

int init_module(void)
printk("<1>Hello world 1.\n");

* A non 0 return means init_module failed; module can't be loaded
return 0;

void cleanup_module(void)
printk(KERN_ALERT "Goodbye world 1.\n");

I have this Makefile for building modules:

obj-m += hello-1.o
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

and I checked in /lib/modules/ and I have folder /2.6.28-15-generic/
so why it does not work ?

I also tried

sudo apt-get install linux-headers-$(uname -r)

and it says

linux-headers-2.6.28-15-generic is already the newest version.

Anyway I am building new kernel 2.6.31 tonight and I think it will work
then, but I am interested to know why it does not work now ?

Any idea ?