Linux kernel module development buildroot












0














I have build a linux kernel for the beaglebone black using buildroot. Now I would like to develop a hello world linux kernel module application:



#include <linux/init.h>
#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT "Hello, worldn");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel worldn");
}

module_init(hello_init);
module_exit(hello_exit);


The problem is I still keep missing some header files. After finally gathering them all, I get an error that the code is not compilable (many errors, dont want to paste them all). What I was wondering is either I am really including the right files? At the moment I have:



/home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/include
/home/lukasz/brl/Machine/beaglebone/build/uboot-2018.01/arch/x86/include
/home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include/generated
/home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include
/home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include


Its a bit odd to me that the c include files and asm files are so scattered around within the directory.



My linux version:



# uname -a
Linux buildroot 4.9.59 #1 SMP Fri Oct 5 11:55:54 CEST 2018 armv7l GNU/Linux









share|improve this question





























    0














    I have build a linux kernel for the beaglebone black using buildroot. Now I would like to develop a hello world linux kernel module application:



    #include <linux/init.h>
    #include <linux/module.h>

    MODULE_LICENSE("Dual BSD/GPL");

    static int hello_init(void)
    {
    printk(KERN_ALERT "Hello, worldn");
    return 0;
    }

    static void hello_exit(void)
    {
    printk(KERN_ALERT "Goodbye, cruel worldn");
    }

    module_init(hello_init);
    module_exit(hello_exit);


    The problem is I still keep missing some header files. After finally gathering them all, I get an error that the code is not compilable (many errors, dont want to paste them all). What I was wondering is either I am really including the right files? At the moment I have:



    /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/include
    /home/lukasz/brl/Machine/beaglebone/build/uboot-2018.01/arch/x86/include
    /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include/generated
    /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include
    /home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include


    Its a bit odd to me that the c include files and asm files are so scattered around within the directory.



    My linux version:



    # uname -a
    Linux buildroot 4.9.59 #1 SMP Fri Oct 5 11:55:54 CEST 2018 armv7l GNU/Linux









    share|improve this question



























      0












      0








      0







      I have build a linux kernel for the beaglebone black using buildroot. Now I would like to develop a hello world linux kernel module application:



      #include <linux/init.h>
      #include <linux/module.h>

      MODULE_LICENSE("Dual BSD/GPL");

      static int hello_init(void)
      {
      printk(KERN_ALERT "Hello, worldn");
      return 0;
      }

      static void hello_exit(void)
      {
      printk(KERN_ALERT "Goodbye, cruel worldn");
      }

      module_init(hello_init);
      module_exit(hello_exit);


      The problem is I still keep missing some header files. After finally gathering them all, I get an error that the code is not compilable (many errors, dont want to paste them all). What I was wondering is either I am really including the right files? At the moment I have:



      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/include
      /home/lukasz/brl/Machine/beaglebone/build/uboot-2018.01/arch/x86/include
      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include/generated
      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include
      /home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include


      Its a bit odd to me that the c include files and asm files are so scattered around within the directory.



      My linux version:



      # uname -a
      Linux buildroot 4.9.59 #1 SMP Fri Oct 5 11:55:54 CEST 2018 armv7l GNU/Linux









      share|improve this question















      I have build a linux kernel for the beaglebone black using buildroot. Now I would like to develop a hello world linux kernel module application:



      #include <linux/init.h>
      #include <linux/module.h>

      MODULE_LICENSE("Dual BSD/GPL");

      static int hello_init(void)
      {
      printk(KERN_ALERT "Hello, worldn");
      return 0;
      }

      static void hello_exit(void)
      {
      printk(KERN_ALERT "Goodbye, cruel worldn");
      }

      module_init(hello_init);
      module_exit(hello_exit);


      The problem is I still keep missing some header files. After finally gathering them all, I get an error that the code is not compilable (many errors, dont want to paste them all). What I was wondering is either I am really including the right files? At the moment I have:



      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/include
      /home/lukasz/brl/Machine/beaglebone/build/uboot-2018.01/arch/x86/include
      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include/generated
      /home/lukasz/brl/Machine/beaglebone/build/linux-headers-a75d8e93056181d512f6c818e8627bd4554aaf92/arch/arm/include
      /home/lukasz/brl/Machine/beaglebone/build/linux-a75d8e93056181d512f6c818e8627bd4554aaf92/include


      Its a bit odd to me that the c include files and asm files are so scattered around within the directory.



      My linux version:



      # uname -a
      Linux buildroot 4.9.59 #1 SMP Fri Oct 5 11:55:54 CEST 2018 armv7l GNU/Linux






      linux kernel c buildroot beagleboneblack






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 18 at 12:16









      Rui F Ribeiro

      39k1479129




      39k1479129










      asked Dec 18 at 10:44









      Bremen

      1216




      1216



























          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489657%2flinux-kernel-module-development-buildroot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489657%2flinux-kernel-module-development-buildroot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre