LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kernel Module - Compile Error on 3.9.10 (https://www.linuxquestions.org/questions/linux-newbie-8/kernel-module-compile-error-on-3-9-10-a-4175472503/)

Arunkr24 08-07-2013 11:48 AM

Kernel Module - Compile Error on 3.9.10
 
well this is embarrasing...
i have written a simple Kernel module that write "hello world" to the kernel log buffer in its module_init call.

i tried compiling it using the kbuild system,but it failed in a strange manner..

This worked on a 2.6 and 3.0 but is not working in 3.9

The details are as follows.

Kernel Version:3.9.10

Makefile : obj-m := Hello_world.0

Command used:
Code:

make -C /lib/modules/`uname -r`/build M=$PWD modules

The error message obtained is as follows


Code:

make: Entering directory `/home/arun/temp/Linux_Build/linux-3.9.10'
make: *** No rule to make target `Device'.  Stop.
make: Leaving directory `/home/arun/temp/Linux_Build/linux-3.9.10'


i am not able to comprehend this...
Code:

*** No rule to make target `Device'.  Stop.
any ideas...
as i am pretty new to the kernel, i am not used to GOOD debugging techniques.


//-----------------------------------------------------------------------//
Code:

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


static int my_init(void)
{
        printk(KERN_ALERT "hello world\n");
        return 0;
}


static void my_exit(void)
{
        printk(KERN_ALERT "exit\n");
}


module_init(my_init);
module_exit(my_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Arun Kumar");
MODULE_DESCRIPTION("Sample Module");


Mara 08-08-2013 04:30 PM

Are you sure you have all the headers for 3.9 installed correctly? Does it come from the packages or you have compiled it yourself?

moo-cow 08-09-2013 01:57 AM

Have you configured and built your kernel source in linux-3.9.10? That's a prerequisite for compiling modules. (Having the kernel headers is not sufficient.)

And a really stupid suggestion (sorry):
Quote:

Makefile : obj-m := Hello_world.0
Are you sure your spelling is correct (Hello_world.o)?


All times are GMT -5. The time now is 10:59 PM.