8 Replies Latest reply on Jan 23, 2017 12:29 PM by Intel Corporation

    Building a custom kernel

    leon_

      Hi all,

       

      Im Trying for days now to build an custom kernel / compile kernelmodules.

      I have set up an yocto build environment and can build images.

      Now my question: To build a custom kernel I run bitbake -c menuconfig virtual/kernel. Then I configure everything and save it in a <my name>.config file.

      Where do I have to copy the <my name>.config file that it is used by bitbake?

      To build the kernel I run bitbake -c compile virtual/kernel.

      Then I schould find the compiled modules in <build dir>/tmp/deploy/ipk/edison.

      Am I right or did I do anything wrong?

       

      Regards

       

      ~Leon

        • 1. Re: Building a custom kernel
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Leon,
           
          Thanks for reaching out!
           
          It seems that everything you have done so far is good. Once you have the new .config file created by menuconfig you should copy this file where the actual .config file (the one that is going to affect your build) is located. The actual .config file is located is located where the kernel you are building is. In Edison's case, if I'm not mistaken, this path should be edison-src/iot-devkit-yp-poky-edison-20160606/build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/image/usr/src/kernel.
           
          Anyhow, I suggest you to read Yocto's Mega Manual in section 5.7.1 to learn more about how to use menuconfig. You can find the Mega Manual in http://www.yoctoproject.org/docs/1.7.3/mega-manual/mega-manual.html.
           
          I hope this helps.
          -Peter.

          1 of 1 people found this helpful
          • 2. Re: Building a custom kernel
            Farit

            You should copy your new config to poky/linux-kernel/arch/x86/configs/i386_edison_defconfig

             

            While you compile the image, that file will be copied to build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r1/.config

            If there are errors during the configuration stage, .config will be renamed to .config.old and the compilator will try to bypass errors automatically.

             

            Try to increase the PR parameter in poky/meta-intel-edison/meta-intel-edison-bsp/recipes-kernel/linux/linux-externalsrc.bb

             

            Compile it using this command:

            bitbake edison-image u-boot

            1 of 1 people found this helpful
            • 3. Re: Building a custom kernel
              leon_

              Hi guys,

               

              Thanks for the quick answere! The path that Peter mentioned doesn't existin my filesystem I assume that this path is correct:

              build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config

              So I don't have to copy the new .config file (created by menuconfig) because the .config file that is used by bitbake seems to be in the same location, right?

              But it looks like poky/linux-kernel/arch/x86/configs/i386_edison_defconfig won't be copied to build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config which is pretty strange. Any ideas?

               

              My problem was that I always did bitbake edison-image u-boot after changing the .config file. This doesn't reload the .config file and no new modules are build. For building modules I run:

               

              bitbake -f -c compile virtual/kernel to reload the .config and rebuild the kernel and

              bitbake virtual/kernel to build the new modules as ipk so I can install them on the edison without flashing the image again.

              Is there any better way for doing this and shouldn't the .config be reloaded on bitbake edison-image u-boot?

               

              Thanks for the great help - it's really cool that the support from Intel and the community is so great here

               

              ~Leon

              • 4. Re: Building a custom kernel
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Leon,

                In your case it looks like the path would be build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/.config. Anyhow, there is a thread by another user that was doing something similar to what you are trying to do, you might be interested in checking it, I believe it could be very useful for you:

                https://communities.intel.com/message/423822#423822

                Let me know.
                -Peter.

                1 of 1 people found this helpful
                • 5. Re: Building a custom kernel
                  leon_

                  Hi Peter,

                  that looks interesting and seems to be a similar way to go. Looks like he reloads/updates the .config with make oldconfig.

                  Are you sure that this: build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/.config is the right path because I found the .config file here: build_edison/tmp/work/edison-poky-linux/linux-externalsrc/1.0-r2/linux-externalsrc-1.0/.config.

                  I managed to build the modules I needed as ipk and installed them on the edison - which is an easy and great way.Do you know how I can load them on boot because I couldent find a .ko file after installing via opkg? It would be possible with modprobe and a service but isn't there a better solution?

                   

                  Thanks for the help and the link to the other thread,

                   

                  ~Leon

                  1 of 1 people found this helpful
                  • 6. Re: Building a custom kernel
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    I may be using a slightly outdated version of the image, so the path you mention should be the one that applies to you.

                    Regarding your second question, I'm not sure that there is a different approach (at least not that I'm aware of), modprobe and a system service would be what I'd proceed with.

                    Please continue with your tests and keep us updated, if you have any doubts, we will be glad to assist you.
                    -Peter.

                    1 of 1 people found this helpful
                    • 7. Re: Building a custom kernel
                      leon_

                      Hi Peter,

                       

                      Thanks for the great support. Everything works fine with modprobe.

                      The support from Intel and the community is great - Thanks.

                      If I have any other problems I'll let you know.

                       

                      Regards

                      Leon

                      • 8. Re: Building a custom kernel
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Hi Leon,

                        I'm are glad to hear that! We are here to help! 

                        Please keep us updated on your projects and if you run into any issues or doubts, please don't hesitate to contact us back!

                        -Peter.