Thread: Kernel Module Programming in 2.6

  1. #1
    Registered User
    Join Date
    Aug 2003

    Kernel Module Programming in 2.6

    Hello. I'm trying to get into module programming, so I picked up both of the guides at the LDP. They were good guides, but for 2.4 or so I assume. I'm using 2.6 and whenever I insmod a module I write, It throws the error at me: "-1 Invalid module format" So I have the suspicition that I'm using old syntax that isn't used anymore. Some previous threads have transgressed this fact, but didn't offer a solution to the problem. Could anyone direct me to a guide for 2.6 (I couldn't find one) or correct this simple hello world code?
    #include <linux/module.h> 
    #include <linux/kernel.h>
    #include <linux/init.h>  
    static int hello_2_init(void)
       printk(KERN_ALERT "Hello, world.\n");
       return 0;
    static void hello_2_exit(void)
       printk(KERN_ALERT "Goodbye, world.\n");
    Sigh, nothing ever works the first try.

    Register Linux User #314127

  2. #2
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    I found your thread on so you might want to look at that thread, if you forgot:
    Help populate a c/c++ help irc channel
    server: irc://
    channel: #c

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Check for integer in kernel module
    By NuNn in forum C Programming
    Replies: 1
    Last Post: 04-13-2009, 11:27 AM
  2. linux kernel module programming
    By circuit in forum Linux Programming
    Replies: 10
    Last Post: 12-01-2004, 06:08 PM
  3. New 2.6 kernel, ALSA problems
    By bludstayne in forum Tech Board
    Replies: 8
    Last Post: 02-23-2004, 09:58 PM
  4. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 12:02 PM