Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, I am trying to compile a module for 2.6.12 kernel and I have reached at a dead-end: Let's say my module is my_module.c. I have included it in /usr/src/linux/drivers/my_module/my_module.c ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    2

    Kernel Module Programming


    Hi,

    I am trying to compile a module for 2.6.12 kernel and I have reached at a dead-end:

    Let's say my module is my_module.c.
    I have included it in /usr/src/linux/drivers/my_module/my_module.c
    and successfully edited Kconfig and Makefile.

    When I type make menuconfig, my module, appears correctly on "Graphics Drivers" Menu, and I select it as in-built (*).

    Afterwards, I type make, and the compilation process starts.
    My module, compiles smoothly, without any error and the image is ready.

    The problem is that when I boot the new kernel, my module IS NOT loaded, as it should be, and I can load it only with modprobe or insmod.
    dmessg does not have any error message or initialization message for my module.

    What does go wrong?

    Thanks in advance !
    Last edited by mvictoras; 10-09-2006 at 02:58 PM. Reason: Wrong title

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Google on "load modules at boot time"

  3. #3
    Just Joined!
    Join Date
    Oct 2006
    Posts
    2
    As I said, I recompiled the kernel, and selected the module as build-in.

    If I am not mistaken, this means that I do not have to load it at boot time with /etc/modules(.conf) (This is the main reason I selected it as build-in and not as a module)

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2006
    Posts
    2
    If you could let me know your .config file then we could have a look on it and let you know what exactly has happened and how to solve it.

  6. #5
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    It's not necessary to link modules statically anymore these days, use Loadable Kernel Modules.
    If you can do it in user space, you should do it in user space. Since modules run in kernel module they can corrupt kernel structures if they are not careful.

  7. #6
    Linux User fernape's Avatar
    Join Date
    Dec 2005
    Location
    Holland
    Posts
    301
    Quote Originally Posted by Franklin52
    It's not necessary to link modules statically anymore these days, use Loadable Kernel Modules
    That's not the point IMHO. Most of the drivers and file systems can be statically included into the kernel. In fact, the main file system (ext3fs for example) should be statically linked for a better performance. Other drivers and file systems (iso9660) are also included bu default in most of the distributions.

    Quote Originally Posted by Franklin52
    If you can do it in user space, you should do it in user space. Since modules run in kernel module they can corrupt kernel structures if they are not careful.
    Completely agree. But it is a driver and it needs to access some kernel data structures and probably map certain memory regions from the inside... I think the only way is to write a module (however if it were a file system I would recommend to use FUSE)

    Best Regards

  8. #7
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Quote Originally Posted by fernape
    That's not the point IMHO. Most of the drivers and file systems can be statically included into the kernel. In fact, the main file system (ext3fs for example) should be statically linked for a better performance. Other drivers and file systems (iso9660) are also included bu default in most of the distributions.
    Sure, it's common to include file systems, drivers or some programs into the kernel for a better performance.
    What i'm trying to make clear is that it's not necesarry to load most of other stuff statically.

    Regards

Posting Permissions

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