Re: (kernel 2.6.9) insmod: -1 Invalid module format

From: Randy.Dunlap (rddunlap_at_osdl.org)
Date: 12/03/04

  • Next message: Chris Wright: "Re: [PATCH 2.6.10-rc2-bk15] sysfs_dir_close memory leak"
    Date:	Thu, 02 Dec 2004 21:13:27 -0800
    To: Stephane Coulombe Bisson <stephcoul@aei.ca>
    
    

    Stephane Coulombe Bisson wrote:
    > Hi,
    >
    > I'm new to Linux module dev, I copied a very simple module from a book
    > (http://lwn.net/Kernel/LDD2/ch02.lwn) and I can't insert it into the
    > kernel.
    >
    > I found hundreds of bug reports about it on google without any solution.
    > I must be doing something wrong...
    >
    > /*----------mymodule.c-----------*/
    > #define MODULE
    > #include <linux/module.h>
    > int init_module(void)
    > { printk("<1>Hello, world\n"); return 0; }
    > void cleanup_module(void)
    > { printk("<1>Goodbye cruel world\n"); }
    > /*----------EOF-----------*/
    >
    > # gcc -c mymodule.c
    > # insmod mymodule.o
    > insmod: error inserting 'mymodule.o': -1 Invalid module format

    a. You need to use more than 'gcc -c module.c' to build a module
    for Linux 2.6.x. See current linux/Documentation/kbuild/*.txt .

    b. You load a module file named "mymodule.ko" for Linux 2.6.x,
    not "mymodule.o".

    c. Make sure that you are using current module-init-tools package.

    -- 
    ~Randy
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Chris Wright: "Re: [PATCH 2.6.10-rc2-bk15] sysfs_dir_close memory leak"

    Relevant Pages

    • Re: RFC: Starting a stable kernel series off the 2.6 kernel
      ... These folks have nothing new to innovate here. ... binary only module compatibility busted every rev of the kernel. ... Linux is not a "family" in any sense. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: whats next for the linux kernel?
      ... > outside the Linux box and look around at other operating systems for ... This has nothing to do with Linux (the kernel). ... in the form of the more user-friendly distributions. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Thinking about Linux 4.0...
      ... With the embracing of this new development model, we will speed up Linux ... philosophy of the kernel in a very fundamental way will be shunned. ... going on about reducing latency. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: SCOs infringing files list
      ... >> Trying to find the kernel list archives from that timeframe would likely ... so possibly the linux errno.h is based uppon this library. ... > The list of known bugs. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 4level page tables for Linux
      ... > the kernel? ... Linux should support N levels. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)