* Error in Make for Kernel Module
@ 2014-01-07 21:24 Arun M Kumar
2014-01-07 21:44 ` Jeff Haran
0 siblings, 1 reply; 2+ messages in thread
From: Arun M Kumar @ 2014-01-07 21:24 UTC (permalink / raw)
To: kernelnewbies
I am starting with Device Drivers for Linux
System Details:
Linux linux-nwya.site 3.10.25-2.10-desktop #2 SMP PREEMPT Tue Jan 7
00:25:03 IST 2014 i686 i686 i386 GNU/Linux
I created a Simple Hello_world Kernel Module. "Hello_World.c"
//---------------------------------------------------------
/* My first kernel Module */
#include <linux/init.h>
#include <linux/module.h>
static init my_init(void){
printk(KERN_ALERT "Hello World\n");
return 0;
}
static void my_exit(void){
printk(KERN_ALERT "Exit\n");
}
MODULE_LICENSE("GPL");
module_init(my_init);
module_exit(my_exit);
//---------------------------------------------------------------------
The Makefile is as follows:
The file name is "Makefile"
//---------------------------------------------------------------------
obj-m := Hello_World.o
//---------------------------------------------------------------------
on running the make command i get the following error.
//----------------------------------------------------------------------------
make: Entering directory `/home/arun/Linux_Source'
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are
missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
make: *** No rule to make target `Device'. Stop.
make: Leaving directory `/home/arun/Linux_Source'
//-------------------------------------------------------------------------------
I have tried "make prepare" but the issue remains....
any suggestions would be appreciated. Thanks in advance.
^ permalink raw reply [flat|nested] 2+ messages in thread* Error in Make for Kernel Module
2014-01-07 21:24 Error in Make for Kernel Module Arun M Kumar
@ 2014-01-07 21:44 ` Jeff Haran
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Haran @ 2014-01-07 21:44 UTC (permalink / raw)
To: kernelnewbies
> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-bounces at kernelnewbies.org] On Behalf Of Arun M
> Kumar
> Sent: Tuesday, January 07, 2014 1:25 PM
> To: Kernel Newbies Mailing List
> Subject: Error in Make for Kernel Module
>
> I am starting with Device Drivers for Linux
>
> System Details:
> Linux linux-nwya.site 3.10.25-2.10-desktop #2 SMP PREEMPT Tue Jan 7
> 00:25:03 IST 2014 i686 i686 i386 GNU/Linux
>
> I created a Simple Hello_world Kernel Module. "Hello_World.c"
> //---------------------------------------------------------
> /* My first kernel Module */
>
> #include <linux/init.h>
> #include <linux/module.h>
>
> static init my_init(void){
> printk(KERN_ALERT "Hello World\n");
> return 0;
> }
>
> static void my_exit(void){
> printk(KERN_ALERT "Exit\n");
> }
>
> MODULE_LICENSE("GPL");
> module_init(my_init);
> module_exit(my_exit);
> //---------------------------------------------------------------------
>
> The Makefile is as follows:
> The file name is "Makefile"
> //---------------------------------------------------------------------
> obj-m := Hello_World.o
> //---------------------------------------------------------------------
>
> on running the make command i get the following error.
> //----------------------------------------------------------------------------
> make: Entering directory `/home/arun/Linux_Source'
>
> ERROR: Kernel configuration is invalid.
> include/generated/autoconf.h or include/config/auto.conf are
> missing.
> Run 'make oldconfig && make prepare' on kernel src to fix it.
>
> make: *** No rule to make target `Device'. Stop.
> make: Leaving directory `/home/arun/Linux_Source'
> //-------------------------------------------------------------------------------
>
> I have tried "make prepare" but the issue remains....
> any suggestions would be appreciated. Thanks in advance.
>
You don't say whether you are attempting to build your module out of the kernel source tree or not.
Assuming you are trying to build out of the tree, this is more or less what I do:
$ cat Makefile
all:
make -C <path to top of kernel source tree you are building for> M=<path to directory your module source is in>
clean:
make -C <path to top of kernel source tree you are building for> M=<path to directory your module source is in> clean
$
$ cat Kbuild
obj-m += Hello_World.o
$
Your mileage may vary.
Good luck,
Jeff Haran
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-07 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 21:24 Error in Make for Kernel Module Arun M Kumar
2014-01-07 21:44 ` Jeff Haran
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.