login
Header Space

 
 

Compiling kernel module using a makefile in linux-2.6.15-1.2054_FC5

July 11, 2007 - 7:45am
Submitted by kummy_linux on July 11, 2007 - 7:45am.
Linux

hi,
i am trying to compile a below mentioned hello world program in linux-2.6.15-1.2054_FC5.It is not generating a hello.ko file.can anybody please help me out regarding this...
*****hello.c*****
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);

*****Makefile*****
obj-m += hello.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

After giving a make command i am getting the output as:

*****make output****
make -C /lib/modules/2.6.15-1.2054_FC5/build M=/home/kum/dir modules
make: *** /lib/modules/2.6.15-1.2054_FC5/build: No such file or directory. Stop.
make: *** [all] Error 2

Tags: Linux

No such file or directory

July 11, 2007 - 2:44pm

"No such file or directory" means, that the file or directory you wanted to access did not exist. I see no simpler way to explain it than the message itself.

Example:

$ make -C /nonexisting
make: *** /nonexisting: No such file or directory.  Stop.

It's going to your kernel

July 11, 2007 - 7:54pm

It's going to your kernel source tree, which it can find from /lib/modules/`uname -r`/build, a symbolic link to where you built your kernel and ran make modules_install. Which you can tell from the Makefile you wrote.
From "2.6.15-1.2054_FC5," I'm guessing you're using a stock Linux kernel packaged in binary format in some Fedora Core package. Get the source.
If my guess is off and your source tree is just somewhere else, well, then just change your Makefile to pass the path to it to make's -C option.

but iam getting output:

July 14, 2008 - 12:55am
saidi (not verified)

but iam getting
output:
empty variable name stop
make ***[default] Error 2

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary