Kernel Module Programming in 2.6

This is a discussion on Kernel Module Programming in 2.6 within the Linux Programming forums, part of the Platform Specific Boards category; Hello. I'm trying to get into module programming, so I picked up both of the guides at the LDP. They ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    42

    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?
    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");
    }
    
    
    module_init(hello_2_init);
    module_exit(hello_2_exit);
    Sigh, nothing ever works the first try.

    Register Linux User #314127

  2. #2
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    I found your thread on linuxquestions.org so you might want to look at that thread, if you forgot:
    http://www.linuxquestions.org/questions/history/168828
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    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, 05:08 PM
  3. New 2.6 kernel, ALSA problems
    By bludstayne in forum Tech Board
    Replies: 8
    Last Post: 02-23-2004, 08:58 PM
  4. Function basics
    By sjleonard in forum C++ Programming
    Replies: 15
    Last Post: 11-21-2001, 11:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21