英文:
How can I get linux kernel sources (interested mainly in dts) in Yocto
问题
我想查看使用Yocto中的bitbake构建图像时所使用的Linux内核源代码。我需要验证我们是否使用了正确的设备树文件,并可能需要更新它。
我被告知devtool可以帮助我查看内核源代码,但我不知道如何使用devtool获取Linux内核源代码(特别是设备树文件)。
我该如何做?
英文:
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?
答案1
得分: 1
为了使用devtool修改内核,如果你不知道内核的名称,你可以在构建环境中执行以下命令:
devtool modify virtual/kernel
这将修改virtual/linux的配方,它实际上是你正在使用的内核的别名,例如linux-tegra、linux-imx等。
执行该命令后,你可以在以下路径找到已解压和打补丁的源代码,位于你的builddir文件夹中:
build/workspace/sources/<kernel配方名称>
Devtool将在该路径上创建一个git仓库,它将具有与远程SRC_URI相同的分支,因此你可以在那里进行更改。
它还将创建一个.bbappend文件,以便bitbake知道内核的实际源代码位于这个文件夹,而不是tmp文件夹上的源代码。这个.bbappend文件位于以下路径:
build/workspace/appends/<kernel配方名称>.bbappend
在修改后,你只需运行以下命令来构建这个修改后的内核:
bitbake virtual/kernel
要找出你的机器使用的设备树,你可以使用bitbake的-e标志提取信息,然后使用grep命令:
bitbake -e virtual/kernel | grep "^KERNEL_DEVICETREE="
然后你可以在内核源代码中查找该设备树,并进行相应的修改。
希望这对你有所帮助。如果你有更多疑问,请告诉我。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论