[英]How to patch Linux kernel source code in yotco
The part I'm working on is kernel-devsrc
, which is in the recipe recipes-kernel
.我正在处理的部分是
kernel-devsrc
,它位于配方recipes-kernel
中。
I want to change one of the source .c files in drivers/usb/serial
in kernal-devsrc
.我想更改
kernal-devsrc
的drivers/usb/serial
中的源 .c 文件之一。 From some of the online materials, I need to:从一些在线材料中,我需要:
recipes-kernel
(and further more, recipes-kernel/linux
)recipes-kernel
同名的配方(还有recipes-kernel/linux
) The problem is : to create a patch file I need to know the 2 git SHAs of before and after the change, but I don't have access to the third party recipes-kernel
, how do I get the SHA??问题是:要创建补丁文件,我需要知道更改前后的 2 个 git SHA,但我无权访问第三方
recipes-kernel
,如何获取 SHA? OR, if that is the wrong way to do this, could you point out the right way to do it?或者,如果这是错误的方法,你能指出正确的方法吗? Thanks!
谢谢!
NOTE: This is problem is not like this one: How patching works in yocto , which the author has access to the source code (.c and .h files).注意:这不是这样的问题: 如何在 yocto 中进行修补工作,作者可以访问源代码(.c 和 .h 文件)。 I DON"T have access to the source code, the yotco kernel I'm working on is from a public git repo, and I am not able to
git commit
to get the SHA, which is necessary to create the patch file.我无法访问源代码,我正在处理的 yotco 内核来自公共 git 存储库,并且我无法通过
git commit
获取 SHA,这是创建补丁文件所必需的。
So, the way I do it is to use Quilt
, follow the steps there then good to go: https://www.yoctoproject.org/docs/1.8/dev-manual/dev-manual.html#using-a-quilt-workflow所以,我这样做的方式是使用
Quilt
,然后按照那里的步骤进行操作:https: //www.yoctoproject.org/docs/1.8/dev-manual/dev-manual.html#using-a-quilt -工作流程
I don't need to know the SHA (though I still don't know why others in my organization end up writing SHAs in the patch files and how did they know the SHAs).我不需要知道 SHA(尽管我仍然不知道为什么我的组织中的其他人最终会在补丁文件中编写 SHA,以及他们是如何知道 SHA 的)。
The power of Yocto is precisely that it makes it relatively straightforward to patch any existing recipes, without requiring write access to the upstream project source code or Yocto layer. Yocto 的强大之处在于它可以相对简单地修补任何现有的配方,而不需要对上游项目源代码或 Yocto 层的写入权限。
As a pre-requisite, the project needs to have its own layer to track the patches.作为先决条件,项目需要有自己的层来跟踪补丁。 Then, the easiest way it to use
devtool
.然后,使用
devtool
的最简单方法。 The general idea is to:总体思路是:
devtool modify RECIPE_NAME
(use the name of the target recipe here).devtool modify RECIPE_NAME
(在此处使用目标配方的名称)。 This command will create a temporary workspace and print the path to this workspace.devtool finish RECIPE_NAME CUSTOM_LAYER_NAME
to save the chances as clean patch files in a bbappend in the custom layer.devtool finish RECIPE_NAME CUSTOM_LAYER_NAME
将机会保存为自定义层的 bbappend 中的干净补丁文件。 Under the hood, devtool modify
initializes a (writable) git repository in the sandbox.在后台,
devtool modify
在沙箱中初始化一个(可写的)git 存储库。 When devtool finish
is invoked, devtool checks the list of extra-commits and saves them as patch files in a .bbappend
in the target layer.当调用
devtool finish
时,devtool 检查额外提交列表并将它们作为补丁文件保存在目标层的.bbappend
中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.