Error: Invalid Module format

From: saee (aditi.hatwalne_at_gmail.com)
Date: 05/26/05


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



Relevant Pages

  • [patch 05/10] uml: make -j fix
    ... every makefile change must use correct dependencies (and ... -#We need to re-preprocess this when the symlink dest changes. ... USER_OBJS:= $(foreach file,$(USER_OBJS),$/$) ...
    (Linux-Kernel)
  • Problem with make config and OPTIONS
    ... I have a problem, I'm trying to upgrade an existing port, I have done some changes in the Makefile but when I test the command 'make config' I have: ... I haven't the dialog box with the differents kinds of Options that are written in the Makefile, i have try the 'make rmconfig' but no change. ... PYCRYPTO "Support for py-crypto for WEP decoding" off \ ...
    (freebsd-questions)
  • Re: [kbuild-devel] kbuild support to build one module with multiple separate components?
    ... as separate kernel modules. ... kernel module instead of a long list of modules. ... the Makefile of component A looks ... > Then all symbols used by the mainmodule needs to be ...
    (Linux-Kernel)
  • RE: Problems with New Pluggable Terminal Sample
    ... You may need The makefile. ... !ifndef MIDL ...
    (microsoft.public.win32.programmer.tapi)
  • Makefile correction?
    ... tardis# make install clean ... I am trying to correct the Makefile, I figure this is where it would be, ... # New ports collection makefile for: Gnu Chess ...
    (freebsd-questions)