* Issue compiling Kernel Module
@ 2014-01-08 21:30 Arun M Kumar
2014-01-08 21:37 ` Valentina Manea
2014-01-09 1:21 ` Valdis.Kletnieks at vt.edu
0 siblings, 2 replies; 3+ messages in thread
From: Arun M Kumar @ 2014-01-08 21:30 UTC (permalink / raw)
To: kernelnewbies
I have recently started with Device Drivers in Linux and have made a
simple Hello world module.
My code is this
//---------------------------------------------------------
/* 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 "asta la vista baby\n");
}
MODULE_LICENSE("GPL");
module_init(my_init);
module_exit(my_exit);
//-------------------------------------------------------------
and the makefile i am using is like this...
//-------------------------------------------------------------
all:
make -C /home/arun/Linux_Source M=`pwd`
clean:
make -C /home/arun/Linux_Source M=`pwd` clean
obj-m := Hello_World.o
//---------------------------------------------------------------------
I receive the following error on running "$make"
//---------------------------------------------------------
make -C /home/arun/Linux_Source M=`pwd`
make[1]: 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[1]: *** No rule to make target `Device'. Stop.
make[1]: Leaving directory `/home/arun/Linux_Source'
make: *** [all] Error 2
//----------------------------------------------------------
PS:
The kernel Source i am using is a Copy of my Git Repository and is a
copy of the branch 3.10.25.
my system details are:
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Issue compiling Kernel Module
2014-01-08 21:30 Issue compiling Kernel Module Arun M Kumar
@ 2014-01-08 21:37 ` Valentina Manea
2014-01-09 1:21 ` Valdis.Kletnieks at vt.edu
1 sibling, 0 replies; 3+ messages in thread
From: Valentina Manea @ 2014-01-08 21:37 UTC (permalink / raw)
To: kernelnewbies
Hi,
You need to have a kernel configuration in your source tree.
Run make defconfig (resulting in a default configuration file for your
architecture) into your kernel tree.
Valentina
^ permalink raw reply [flat|nested] 3+ messages in thread
* Issue compiling Kernel Module
2014-01-08 21:30 Issue compiling Kernel Module Arun M Kumar
2014-01-08 21:37 ` Valentina Manea
@ 2014-01-09 1:21 ` Valdis.Kletnieks at vt.edu
1 sibling, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2014-01-09 1:21 UTC (permalink / raw)
To: kernelnewbies
On Thu, 09 Jan 2014 03:00:11 +0530, Arun M Kumar said:
> all:
> make -C /home/arun/Linux_Source M=`pwd`
The directory the -C parameter points at has to be a Linux source
tree that has had at least a 'make prepare' run inside it.
In addition, to actually *use* the module, you'll need to modprobe it
into a kernel built in that directory (in other words, you need to build
against the source tree of the kernel you plan to be running). So
you'll need to do a 'make <something>config', then a 'make' and then
install and boot that kernel in order to actually test your module.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140108/a8277442/attachment.bin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-09 1:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-08 21:30 Issue compiling Kernel Module Arun M Kumar
2014-01-08 21:37 ` Valentina Manea
2014-01-09 1:21 ` Valdis.Kletnieks at vt.edu
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.