Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, i am writing a simple hello module program. #include <linux/module.h> #include <linux/kernel.h> #include <linux/version.h> int init_module(void) { printk("Module is inserted\n"); return 0; } void cleanup_module(void) { printk("Module is unloaded\n"); ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    2

    insmod error


    Hi,

    i am writing a simple hello module program.

    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <linux/version.h>
    int init_module(void)
    {
    printk("Module is inserted\n");
    return 0;
    }

    void cleanup_module(void)
    {
    printk("Module is unloaded\n");
    }


    gcc -c gan.c -o gan.o -D__KERNEL__ -DMODULE -I usr/src/kernels/2.6.9-5.EL-i686/include/ -O2

    insmod ./gan.o
    insmod: error inserting './gan.o': -1 Invalid module format

    please tell me ,How to fix this problem.

    Regards
    Pankaj

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757

    Exclamation

    In new kernel -modules will be created as .ko not .o file.
    Check manual for more about kernel programming,
    The Linux Kernel Module Programming Guide

    And make sure you got latest kernel source code ..All the best....
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •