ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] The sample example not working


From: Charles Krinke
Subject: Re: [Ltib] The sample example not working
Date: Mon, 16 Aug 2010 14:06:36 -0700

Dear Malay:

When I get an invalid module format with insmod it is usually compiled for x86 when I wanted it compiled for my target.

One should be able to us "ldd" (if that is on your target) or "strace" (also needs to be on the target).

Barring that, you might go back and look at your compilation carefully and see where it might have gone awry.

Charles

On Mon, Aug 16, 2010 at 12:26 PM, malay jajodia <address@hidden> 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. 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

_______________________________________________
LTIB home page: http://ltib.org

Ltib mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/ltib



reply via email to

[Prev in Thread] Current Thread [Next in Thread]