Results 1 to 1 of 1
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-07-2009 #1
Basic module loading
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
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
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 ?
regards


Reply With Quote
