Yocto – 在不打补丁的情况下向内核源代码中添加驱动程序

huangapple go评论141阅读模式
英文:

Yocto - Adding drivers to kernel source without patching

问题

我知道关于通过编辑内核存储库并使用git创建补丁来更改内核源代码的传统方法,我也了解了devtool。这两种方法最终都会创建补丁。

是否有一种不同的方法来实现相同的效果?也许可以通过添加*.c*.h文件并告诉Yocto来构建它们,类似于如何将设备树blob添加到映像中?对我来说,消除补丁步骤似乎可以使开发过程更加简单。

英文:

I know about the traditional way of making changes to the kernel source by editing the kernel repository and creating patches with git, I did read about devtool as well. Both solutions create patches in the end.

Is there a different way of achieving the same effect? Perhaps by adding *.c and *.h files and telling Yocto to build them, similarly to how Device Tree blobs are added to the image? It seems obvious to me that getting rid of the patching step make's the development process easier.

答案1

得分: 1

如果我理解正确,您尝试在内核源代码中附加文件或进行修改,而没有应用补丁一段时间。如果是这样,我建议您在工作区的某个位置克隆您的存储库。

cd ~ && mkdir workspace && cd workspace
git clone https://github.com/mykernelsource.git

然后设置您的内核配方以从这个本地 Git 源构建。为了实现这一点,您可以将当前的 SRC_URI 注释掉,然后添加您自己的,如下所示:

SRC_URI = "git:///home/user/workspace/mykernelsource/;protocol=file"

不要忘记在 git 后面添加三个斜杠 ///。Bitbake支持不同的文件获取协议,这在这里1有非常详细的文档。

请注意,您应该关注 SRCREV 变量。如果 SRCREV = "${AUTOREV}",那么您必须在构建之前每次提交。您还可以将您自己的源代码修订提供给这个变量。只需输入 git log 来找到您的源代码修订。

英文:

If i am correct you try to append files in your kernel sources or modify it without applying patches for a time being. If so, I suggest you to clone your repository somewhere in your workspace.

cd ~ && mkdir  workspace && cd workspace
git clone https://github.com/mykernelsource.git

Then setup you kernel recipe to build from this local git source. To achieve this you can comment the actual SRC_URI
Afterwards, add yours as follow:

SRC_URI = "git:///home/user/workspace/mykernelsource/;protocol=file"

Do not forget to append three / after git
Bitbake support different protocol of file fetcher which is really well documented here

Note that you should take care of SRCREV variable.
If SRCREV = "${AUTOREV}" then you have to commit each time before building. You can also provide your own source revision to this variable. Just type git log to find yours.

huangapple
  • 本文由 发表于 2023年3月15日 18:09:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743243.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定