ltib
[Top][All Lists]
Advanced

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

[Ltib] The sample example not working


From: malay jajodia
Subject: [Ltib] The sample example not working
Date: Mon, 16 Aug 2010 12:26:34 -0700

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

reply via email to

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