Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: insmod error

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    insmod error


    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.


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


    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 Online Linux Terminal

Posting Permissions

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