如何将补丁应用于 Buildroot 中的包?
我正在开发一个嵌入式系统,该系统使用 buildroot 作为构建内核和根文件系统的工具。我想对这个内核源代码树应用一些补丁,有人可以告诉我 buildroot 如何应用补丁吗?
I am working on an embedded system that uses buildroot as a tool for building the kernel and the root filesystem. I want to apply some patches to this kernel source tree, Can somebody tell me how buildroot apply patches?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
扩展@pradeepchhentri 的答案。 Quilt 将查找与 *.mk 文件位于同一文件夹中的文件。要构建适当的文件:
将源包与原始包进行比较,放入名为
的文件中
软件包名称-编号-描述.patch
哪里
包名称 - 必须与包名称相同
数字 - 如果您有多个补丁要应用,则为应用补丁的顺序(否则将按字母顺序应用)
描述 - 可以是任何自由文本
将
将此文件放入包中,与 [packagename].mk 文件和 package/Config.in 文件处于同一级别。
如果您这样做,请不要忘记清除您的构建文件或进行 [package]-rebuild。如果正确完成,您应该会看到“正在修补...”消息。
To expand on @pradeepchhentri's answer. Quilt will look for a file located in the same folder as the *.mk file. To construct the appropriate file:
diff your source package from the original into a file called
packagename-number-description.patch
where
packagename - has to be identical to the package name
number - is the order in which the patches should be applied if you have more than one patch to apply (otherwise it will be applied alphabetically)
description - can be any free text
Place this file into the package at the same level as the [packagename].mk file and the package/Config.in file.
Don't forget to blow away your build files or do a [package]-rebuild if you do this. You should see a "Patching..." message if this is done correctly.
有关 buildroot 项目中补丁文件的一些详细信息:
您必须
站在其中定义的包的提取位置 tar.gz 的正上方
,这意味着您的文件路径必须包含提取的包文件夹名称。
如果您想知道“old_file”路径是否与原始路径不同 - 不用担心,重要的是“new_file”路径,并且名称 - 它应该与您提取的包匹配。
buildroot 中已使用/定义的补丁的命名约定(所有部分均用 '-' 符号分隔):
示例:
无需修改配置文件,所有补丁都会自动尝试应用。
some details about patch files in the buildroot project:
you have to
while standing exactly above extracted location of your package tar.gz defined in
it means, your path to the file must include extracted package folder name.
in case you wonder if the "old_file" path would be different from the original one - don't worry, the important one is the "new_file" path and name - it should match your package extracted one.
naming convention for the patches already used/defined in buildroot (all parts are separated with '-' sign):
example:
there is no need for configuration files to modify, all patches will be tried for application automatically.
使用
*_OVERRIDE_SRCDIR
并跟踪子模块中的所有内容我强烈建议您不要使用补丁,而是这样做:
并在指向您的子模块中跟踪您的源代码项目的分支,上面有你的补丁。
这将使一切变得更加理智且易于跟踪。
更多信息请访问:如何修改 Buildroot 包的源以进行包开发?
BR2_GLOBAL_PATCH_DIR
树外补丁目录结构:
.git/
buildroot/
Buildroot 子模块,如以下所述:https: //stackoverflow.com/a/23635403/895245global_patch_dir/packagename/0001-my-test.patch
添加到config:
然后构建:
在构建之前,应将补丁应用于
output/build/packagename-1.0.0/
。Use
*_OVERRIDE_SRCDIR
and track everything in submodulesInstead of using patches, I highly recommend that you to this instead:
and just track the source of your in a submodule that points to your fork of the project with your patches on top.
This will make everything much saner and easy to keep track of.
More info at: How to modify the source of Buildroot packages for package development?
BR2_GLOBAL_PATCH_DIR
out-of-tree patchesDirectory structure:
.git/
buildroot/
Buildroot submodule as mentioned at: https://stackoverflow.com/a/23635403/895245global_patch_dir/packagename/0001-my-test.patch
Add to config:
Then build with:
The patch should be applied to
output/build/packagename-1.0.0/
before build.在研究了 buildroot 架构之后,我了解到 buildroot 使用 quilt 工具来应用补丁。 quilt 跟踪“patches”目录中名为“series”的文件中的所有补丁。您必须将补丁保存在该目录中。并按照您希望应用补丁的顺序将补丁条目添加到系列文件中,使首先应用的补丁保持在顶部。
这样,当您运行 buildroot makefile 时,它将自动应用系列文件中列出的补丁。
After studying the buildroot architecture, I came to know that buildroot uses quilt tool for applying the patches. quilt keeps track of all the patches in the a file named "series" which is present in the "patches" directory. You have to keep your patches in this directory. And add your entry of patches in the series file in the order in which you want the patches to be applied keeping the patch to be applied first at the top.
This way when you will run the buildroot makefile, it will automatically apply the patches listed in the series file.