如何将补丁应用于 Buildroot 中的包?

发布于 2024-11-16 06:46:13 字数 96 浏览 3 评论 0原文

我正在开发一个嵌入式系统,该系统使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

予囚 2024-11-23 06:46:13

扩展@pradeepchhentri 的答案。 Quilt 将查找与 *.mk 文件位于同一文件夹中的文件。要构建适当的文件:

  1. 将源包与原始包进行比较,放入名为

    的文件中

    软件包名称-编号-描述.patch

    哪里

    包名称 - 必须与包名称相同

    数字 - 如果您有多个补丁要应用,则为应用补丁的顺序(否则将按字母顺序应用)

    描述 - 可以是任何自由文本

  2. 将此文件放入包中,与 [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:

  1. 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

  2. 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.

葬花如无物 2024-11-23 06:46:13

有关 buildroot 项目中补丁文件的一些详细信息:

  1. 您必须

    diff -u "旧文件" "新文件" >文件.补丁
    

站在其中定义的包的提取位置 tar.gz 的正上方

PACKAGE_NAME_SOURCE

,这意味着您的文件路径必须包含提取的包文件夹名称。

  1. 如果您想知道“old_file”路径是否与原始路径不同 - 不用担心,重要的是“new_file”路径,并且名称 - 它应该与您提取的包匹配。

  2. buildroot 中已使用/定义的补丁的命名约定(所有部分均用 '-' 符号分隔):

    • 4位补丁优先级(从0001开始)
    • 目标文件名
    • 打补丁的原因
    • .补丁扩展

示例:

0001-configure.ac-convert-AC_TRY_COMPILE-AC_COMPILE_IFELS.patch
  1. 将补丁文件存放在 buildroot/package/"your package name"/ 文件夹中。

无需修改配置文件,所有补丁都会自动尝试应用。

  1. 如果出现故障,拒绝补丁文件(名称与您尝试修补的文件类似,但带有 .rej 扩展名)将存放在包提取的文件夹中。

some details about patch files in the buildroot project:

  1. you have to

    diff -u "old_file" "new_file" > file.patch
    

while standing exactly above extracted location of your package tar.gz defined in

PACKAGE_NAME_SOURCE

it means, your path to the file must include extracted package folder name.

  1. 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.

  2. naming convention for the patches already used/defined in buildroot (all parts are separated with '-' sign):

    • 4 digits patch priority (starting from 0001)
    • target filename
    • reason for patching
    • .patch extention

example:

0001-configure.ac-convert-AC_TRY_COMPILE-AC_COMPILE_IFELS.patch
  1. deposit patch file inside buildroot/package/"your package name"/ folder.

there is no need for configuration files to modify, all patches will be tried for application automatically.

  1. in case of the failure, the reject-patch file (named similar to the file you are trying to patch but with .rej extention) will be deposited inside package extracted folder.
往事风中埋 2024-11-23 06:46:13

使用*_OVERRIDE_SRCDIR并跟踪子模块中的所有内容

我强烈建议您不要使用补丁,而是这样做:

myproject/
  .git/
  submodules/buildroot/
  submodules/source_of_my_package/

并在指向您的子模块中跟踪您的源代码项目的分支,上面有你的补丁。

这将使一切变得更加理智且易于跟踪。

更多信息请访问:如何修改 Buildroot 包的源以进行包开发?

BR2_GLOBAL_PATCH_DIR 树外补丁

目录结构:

添加到config:

BR2_GLOBAL_PATCH_DIR=../global_patch_dir

然后构建:

cd buildroot
make

在构建之前,应将补丁应用于 output/build/packagename-1.0.0/

Use *_OVERRIDE_SRCDIR and track everything in submodules

Instead of using patches, I highly recommend that you to this instead:

myproject/
  .git/
  submodules/buildroot/
  submodules/source_of_my_package/

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 patches

Directory structure:

Add to config:

BR2_GLOBAL_PATCH_DIR=../global_patch_dir

Then build with:

cd buildroot
make

The patch should be applied to output/build/packagename-1.0.0/ before build.

快乐很简单 2024-11-23 06:46:13

在研究了 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文