Messages in this thread | | | Date | Sat, 12 Jun 2004 23:08:20 +0200 | From | Sam Ravnborg <> | Subject | Re: Inserting a module (2.6 kernel) |
| |
On Wed, Jun 09, 2004 at 11:47:58AM +0200, Andi Kleen wrote: > > Now since 2.6.5 or so it needs: > > /* MODULE is not needed anymore */ > #define __KERNEL__1 > #include <linux/module.h> > > int init_module(void) > { > printk("Hello world\n"); > return 0; > } > > struct module __this_module > __attribute__((section(".gnu.linkonce.this_module"))) = { > .name = "hello", > .init = init_module, > };
Most of the glue above can be deleted if you just accept to use kbuild when building modules. So to compile your module use a simple Makefile: obj-m := mymodule.o
Then to compile the module use: make -C path/to/kernel/src M=`pwd`
And to install it use: make -C path/to/kernel/src M=`pwd` modules_install
And to clean up in the directory where the module is being compiled: make -C path/to/kernel/src M=`pwd` clean
Sam - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |