Simply google for "writing kernel module makefile" Use a makefile to compile your kernel module. That should solve your problem. On Wed, Jan 28, 2009 at 10:09 PM, Michael Blizek <michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > Hi! > > On 20:07 Wed 28 Jan , Venkatesh Rao wrote: >> i am trying to write a simple device driver >> >> filename:dd.c >> >> >> #include <module.h> >> #include<kernel.h> >> #include<mod_devicetable.h> >> #include<moduleparam.h> >> #include<moduleloader.h> >> >> >> int init_module (void) /* Loads a module in the kernel */ >> { >> printk("Hello kernel n"); >> return 0; >> } >> >> void cleanup_module(void) /* Removes module from kernel */ >> { >> printk("GoodBye Kerneln"); >> } >> >> >> >> gcc -c dd.c gives me the following errors: >> >> In file included from /usr/include/module.h:10, >> from dd.c:2: >> /usr/include/linux/cache.h:5:23: error: asm/cache.h: No such file or >> directory > > ... > > You cannot compile your module this way. You need to add the kernel include > path, tell gcc to *not* include the standard c lib and some other stuff. You > can > - put your module in the kernel source tree and add your file to the "Makefile" > and maybe "Kconfig" > - or try do do what Documentation/kbuild/modules.txt says > -Michi > -- > programing a layer 3+4 network protocol for mesh networks > see http://michaelblizek.twilightparadox.com > > > -- > To unsubscribe from this list: send an email with > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > Please read the FAQ at http://kernelnewbies.org/FAQ > > -- Regards, Sandeep. "To learn is to change. Education is a process that changes the learner." -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ