Compiling Loadable Kernel Modules in Linux [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have just created a loadable kernel module using C.



I followed a guide that make me use the module_init and module_exit macros.



Here is the code:



#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
/* This function is called when the module is loaded. */
int simple init(void)

printk(KERN INFO "Loading Modulen");
return 0;

/* This function is called when the module is removed. */
void simple exit(void)

printk(KERN INFO "Removing Modulen");

/* Macros for registering module entry and exit points. */
module init(simple init);
module exit(simple exit);
MODULE LICENSE("GPL");
MODULE DESCRIPTION("Simple Module");
MODULE AUTHOR("SGG");


My question is:



  • Once a connect the module to the kernel, which is the method entry point of the file? In fact there is no main method.

  • In which way the kernel is able to call the methods in the file?

  • How , using the libraries, we succeed in connecting the file to the kernel?






share|improve this question














closed as unclear what you're asking by sebasth, Jeff Schaller, Timothy Martin, roaima, G-Man Feb 1 at 3:32


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















    up vote
    1
    down vote

    favorite












    I have just created a loadable kernel module using C.



    I followed a guide that make me use the module_init and module_exit macros.



    Here is the code:



    #include <linux/init.h>
    #include <linux/kernel.h>
    #include <linux/module.h>
    /* This function is called when the module is loaded. */
    int simple init(void)

    printk(KERN INFO "Loading Modulen");
    return 0;

    /* This function is called when the module is removed. */
    void simple exit(void)

    printk(KERN INFO "Removing Modulen");

    /* Macros for registering module entry and exit points. */
    module init(simple init);
    module exit(simple exit);
    MODULE LICENSE("GPL");
    MODULE DESCRIPTION("Simple Module");
    MODULE AUTHOR("SGG");


    My question is:



    • Once a connect the module to the kernel, which is the method entry point of the file? In fact there is no main method.

    • In which way the kernel is able to call the methods in the file?

    • How , using the libraries, we succeed in connecting the file to the kernel?






    share|improve this question














    closed as unclear what you're asking by sebasth, Jeff Schaller, Timothy Martin, roaima, G-Man Feb 1 at 3:32


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have just created a loadable kernel module using C.



      I followed a guide that make me use the module_init and module_exit macros.



      Here is the code:



      #include <linux/init.h>
      #include <linux/kernel.h>
      #include <linux/module.h>
      /* This function is called when the module is loaded. */
      int simple init(void)

      printk(KERN INFO "Loading Modulen");
      return 0;

      /* This function is called when the module is removed. */
      void simple exit(void)

      printk(KERN INFO "Removing Modulen");

      /* Macros for registering module entry and exit points. */
      module init(simple init);
      module exit(simple exit);
      MODULE LICENSE("GPL");
      MODULE DESCRIPTION("Simple Module");
      MODULE AUTHOR("SGG");


      My question is:



      • Once a connect the module to the kernel, which is the method entry point of the file? In fact there is no main method.

      • In which way the kernel is able to call the methods in the file?

      • How , using the libraries, we succeed in connecting the file to the kernel?






      share|improve this question














      I have just created a loadable kernel module using C.



      I followed a guide that make me use the module_init and module_exit macros.



      Here is the code:



      #include <linux/init.h>
      #include <linux/kernel.h>
      #include <linux/module.h>
      /* This function is called when the module is loaded. */
      int simple init(void)

      printk(KERN INFO "Loading Modulen");
      return 0;

      /* This function is called when the module is removed. */
      void simple exit(void)

      printk(KERN INFO "Removing Modulen");

      /* Macros for registering module entry and exit points. */
      module init(simple init);
      module exit(simple exit);
      MODULE LICENSE("GPL");
      MODULE DESCRIPTION("Simple Module");
      MODULE AUTHOR("SGG");


      My question is:



      • Once a connect the module to the kernel, which is the method entry point of the file? In fact there is no main method.

      • In which way the kernel is able to call the methods in the file?

      • How , using the libraries, we succeed in connecting the file to the kernel?








      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 31 at 10:24









      Yaron

      3,19421027




      3,19421027










      asked Jan 31 at 8:40









      Tantaros

      102




      102




      closed as unclear what you're asking by sebasth, Jeff Schaller, Timothy Martin, roaima, G-Man Feb 1 at 3:32


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






      closed as unclear what you're asking by sebasth, Jeff Schaller, Timothy Martin, roaima, G-Man Feb 1 at 3:32


      Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.



























          active

          oldest

          votes






















          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?