Find the answer to your Linux question:
Results 1 to 3 of 3
hi all, i am trying to get a simple module working hello.c #include <linux/init.h> #include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk(KERN_ALERT "Hello, world\n"); return 0; } static void ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    12

    insmod : Invalid module format


    hi all,
    i am trying to get a simple module working

    hello.c
    #include <linux/init.h>
    #include <linux/module.h>
    MODULE_LICENSE("Dual BSD/GPL");
    static int hello_init(void)
    {
    printk(KERN_ALERT "Hello, world\n");
    return 0;
    }
    static void hello_exit(void)
    {
    printk(KERN_ALERT "Goodbye, cruel world\n");
    }
    module_init(hello_init);
    module_exit(hello_exit);

    Makefile
    obj-m +=hello.o
    all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules


    the module is created but not inserted.
    I m using Ununtu 9.10 with kernel 2.6.33-020633-generic downloaded as deb file from ubuntu site .

    Plzz help..

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,601
    So, where in your make file are you installing the kernel module? Have you tried to install it manually?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    12
    Quote Originally Posted by Rubberman View Post
    So, where in your make file are you installing the kernel module? Have you tried to install it manually?
    i have posted the make file in the first post.
    i tried to install kernel manually but finally got this error
    --------------------------------------------------------------------
    make[1]: Leaving directory `/usr/src/linux-2.6.33.1'
    test ! -e scripts/package/builddeb || mv -f scripts/package/builddeb scripts/package/builddeb.kpkg-dist
    test ! -e scripts/package/Makefile || test -f scripts/package/Makefile.kpkg-dist || (mv -f scripts/package/Makefile scripts/package/Makefile.kpkg-dist && (echo "# Dummy file "; echo "help:") > scripts/package/Makefile)
    COLUMNS=150 dpkg -l 'gcc*' perl dpkg 'libc6*' binutils make dpkg-dev |\
    awk '$1 ~ /[hi]i/ { printf("%s-%s\n", $2, $3) }'> debian/buildinfo
    uname -a >> debian/buildinfo
    echo using the compiler: >> debian/buildinfo
    grep LINUX_COMPILER include/linux/compile.h | \
    sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >> debian/buildinfo
    grep: include/linux/compile.h: No such file or directory
    echo applied kernel patches: >> debian/buildinfo
    echo done > debian/stamp/build/kernel
    /usr/bin/make -f ./debian/rules debian/stamp/binary/pre-linux-image-2.6.33.1-custom
    make[1]: Entering directory `/usr/src/linux-2.6.33.1'
    ====== making target debian/stamp/install/linux-image-2.6.33.1-custom [new prereqs: ]======
    This is kernel package version 11.015.
    echo "The UTS Release version in include/linux/version.h"; echo " \"\" "; echo "does not match current version:"; echo " \"2.6.33.1-custom\" "; echo "Please correct this."; exit 2
    The UTS Release version in include/linux/version.h
    ""
    does not match current version:
    "2.6.33.1-custom"
    Please correct this.
    make[1]: *** [debian/stamp/install/linux-image-2.6.33.1-custom] Error 2
    make[1]: Leaving directory `/usr/src/linux-2.6.33.1'
    make: *** [kernel_image] Error 2
    ---------------------------------------------------------------------------

    such a large error message so i decided to go for packaged kernel.

Posting Permissions

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