Find the answer to your Linux question:
Results 1 to 4 of 4
Hi guys, I am building my own driver for Linux 3.0. It already works as a module, when I load it manually or at startup automatically. But when I integrate ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9

    Differnce between module and build in code?


    Hi guys,

    I am building my own driver for Linux 3.0. It already works as a module, when I load it manually or at startup automatically.
    But when I integrate it in the kernel with the * in menuconfig it seems like the driver is not loaded. There is absolute no output in dmesg but I have at least one message at start up of the module at the very beginning.
    So is there any difference between a module and a build in driver? Do I have to make something special?

    Kind Regards

    Fabian

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,190
    Well, it wouldn't be loaded if it's already in the kernel. You need to look for evidence that the driver is active. Does the kernel recognise the device? You say you get a message from the driver when it starts up - that suggests that it is working. What about device files? Are the ones you expect created?

    The proof of the pudding is in the eating: does the device actually work?

    The main difference in practice between a module and built-in code is that if you need to pass parameters to a built-in driver, you have to do so as part of the kernel's command line; with a module, you can use modules.conf or its equivalent.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9
    Hi, I think there is a missunderstanding.
    There is a printk at the very top of the module init function but I cannot see the output of this printk when I build it in the kernel. So it seems like the driver is not loaded.

  4. #4
    Just Joined!
    Join Date
    Jul 2012
    Posts
    9
    Ha! Found the problem!
    I had to change the init and exit functions of the driver that they look like this:
    Code:
    static int __init start_module(void)
    static void __exit stop_module(void)
    And add this two lines at the end of the driver:
    Code:
    module_init(start_module);
    module_exit(stop_module);
    Now everything is working!

Posting Permissions

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