Find the answer to your Linux question:
Results 1 to 2 of 2
Hi I am trying to load a simple helloworld module built using Centos Linux (kernel version 2.6.9) in a freescale embedded Linux environment (kernel version 2.6.25) I have enable "Loadable ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    1

    Unable to load a module on Freescale Embedded Linux envorionment


    Hi
    I am trying to load a simple helloworld module built using Centos Linux (kernel version 2.6.9) in a freescale embedded Linux environment (kernel version 2.6.25)
    I have enable "Loadable module support in Freescale Linux Kernel. I executeD the following command after coping the hello-1.ko file into the root folder .

    insmod ./hello-1.ko

    and I get the following error

    insmod: cannot insert "hello-1.ko": Invalid module format.

    Why do I get this error. following is my code snippet and the make file

    /*
    * hello-1.c - The simplest kernel module.
    */
    #include <linux/module.h> /* Needed by all modules */
    #include <linux/kernel.h> /* Needed for KERN_INFO */

    MODULE_LICENSE("GPL");


    int init_module(void)
    {
    printk(KERN_INFO "Hello world 1.\n");

    /*
    * A non 0 return means init_module failed; module can't be loaded.
    */
    return 0;
    }

    void cleanup_module(void)
    {
    printk(KERN_INFO "Goodbye world 1.\n");
    }



    make file

    obj-m += hello-1.o

    all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

    clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

    can anybody help me on this.
    thanks in advance.

  2. #2
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    678
    Hi there,

    I'm not really an expert so this may be a silly question, but are you using a freescale compiler? You'd also need to build it against the freescale kernel headers, not the ones installed for CentOS.

    Let us know how you get on
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

Posting Permissions

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