[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ltib] The sample example not working
From: |
Stuart Hughes |
Subject: |
Re: [Ltib] The sample example not working |
Date: |
Tue, 17 Aug 2010 19:13:30 +0100 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080707) |
Hi Malay,
How did you build it? (what commands)
Regards, Stuart
malay jajodia wrote:
> Hi,
>
> I have just created a sample helloworld driver and it was built and
> deployed successfully at location
> /rootfs/lib/modules/2.6.27.8/misc/hello-1.ko
> <http://2.6.27.8/misc/hello-1.ko>. Yet when i run insmod hello-1.ko i
> get the output "insmod: cannot insert 'hello-1.ko': invalid module
> format" Following is my source file and the makefile.
>
> ***************hello-1.c******************
> #include <linux/module.h> /* Needed by all modules */
> #include <linux/kernel.h> /* Needed for KERN_INFO */
> int init_module(void)
> {
> printk(KERN_INFO "Hello world 1.\n");
> return 0;
> }
>
> void cleanup_module(void)
> {
> printk(KERN_INFO "Goodbye world 1.\n");
> }
>
>
> *****************Makefile**********************
> ifneq ($(KERNELRELEASE),) # kbuild part of makefile
> obj-m += hello-1.o
>
> else # Normal part of the Makefile
>
> KERNELDIR = ../linux
> ARCH = $(LINTARCH)
>
> all:
> $(MAKE) ARCH=$(ARCH) -C $(KERNELDIR) M=$(PWD)
>
> install:
> @echo "copy hello-1.ko to your module directory"
>
> clean:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
> @rm -f Module.symvers
>
> endif
>
> ----------------------------
> Please help!
>
> -Malay
>
>