Search code examples
yoctobitbake

How can I get linux kernel sources (interested mainly in dts) in Yocto


I would like to see linux kernel sources that were used to build an image with bitbake in yocto. I need to verify that we are using a correct dts file, and probably to update it.

I was told that devtool can help me to see kernel sources, but I can't understand how to use devtool to get the linux kernel sources(and the dts file in special).

How do I do it?


Solution

  • In order to use devtool to modify the kernel, if you don't know the kernel name, you can execute in the build environment the next command:

    devtool modify virtual/kernel
    

    This will modify the recipe for virtual/linux, which underneath is an alias for the kernel you are using, for example linux-tegra, linux-imx, etc.

    After you execute that command, you can see the sources that have been unpacked and patched inside your builddir folder on the following path: build/workspace/sources/<kernel recipe name>.

    Devtool will create a git repo on that path, which will have the same branches as the remote SRC_URI where it is getting it from, so you can make your changes there.

    It will also create a .bbappend so that bitbake knows that the actual source for the kernel is this folder and not the one on tmp. This bbappend is located in this path:

    build/workspace/appends/<kernel recipe name>.bbappend
    

    After you modify it, you can just do a bitbake virtual/kernel to build this modified kernel.

    In order to find which device tree your machine is using, you can extract such information using the -e flag on bitbake and then grep:

    bitbake -e virtual/kernel | grep "^KERNEL_DEVICETREE="
    

    Then you can search for that device tree inside the kernel sources and you can modify it as well.

    Hope this helps a little. If you have more doubts let me know.