Error: Invalid Module format
From: saee (aditi.hatwalne_at_gmail.com)
Date: 05/26/05
- Next message: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Previous message: Basile Starynkevitch [news]: "Re: How to modify a system call in kernel 2.6"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 May 2005 00:05:09 -0700
Hi,
I am trying to write a sample module. I am getting error as "Invalid
module format". As I know this is error about version problem.
Here is my C file:
//INCLUDES:= -I/libmodules/2.4.21-0.13mdk/build/include
#include <linux/module.h>
#include <linux/config.h>
#if defined(CONFIG_MODVERSIONS) && (!defined(MODVERSIONS))
#define MODVERSIONS
#endif
#ifdef MODVERSIONS
#include <config/modversions.h>
#endif
MODULE_LICENSE("GPL");
//KERNEL_VERSION(2,6,8);
int
init_module()
{
printk("<1>Hello World - this is the kernel speaking\n");
return 0;
}
void
cleanup_module()
{
printk("<1>Clean up function - this is kernel speaking\n");
}
Makefile is :
Makefile for kernel module
CC:= gcc
LD:= ld
CFLAGS:= -O -Wall -DMODULE -D__KERNEL__ -DLINUX -DMODVERSIONS
INCLUDES:= -I/lib/modules/2.6.8.1/build/include
#No need to inclue the following line
#All: khello.o
#khello.o: khello.c /usr/include/linux/version.h Makefile
khello.o: khello.c
/usr/src/linux-2.6.8.1/include/config/modversions.h Makefile
$(CC) $(CFLAGS) $(INCLUDES) -c khello.c
#khello.o: khello.c /usr/include/linux/version.h Makefile
# $(LD) -c $(CFLAGS) -r $^ -o$@ $(INCLUDES)
/sbin/insmod khello.o
@echo "insmod hello.o to turn it on"
@echo "rmmod hello to turn it off"
@echo
@echo "X and kernel programming not mix"
clean:
rm -f *.o core
#warning: loading khello.o will taint the kernel: no license
# See http://www.tux.org/lkml/#export-tainted for information about
tainted modules
# Module khello loaded, with warnings
Regards,
Saee
- Next message: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Previous message: Basile Starynkevitch [news]: "Re: How to modify a system call in kernel 2.6"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: Error: Invalid Module format"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|