将保存在 br2-external 中的补丁应用到 buildroot 包
Applying patch kept in br2-external to a buildroot package
我想给 buildroot 包打补丁。我正在使用 br2-external
树将我的自定义设置排除在 buildroot 树之外。 Buildroot 可以找到我的补丁,但尝试应用它时失败。
我设置了BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_PATH}/board/myboard/patches"
,把补丁放在了${BR2_EXTERNAL_PATH}/board/myboard/patches/packagename/0001-name-of-patch.patch
。我通过转到 buildroot
存储库生成补丁,将更改应用于包,使用 git 提交它们并从上次提交创建补丁:
git format-patch HEAD~1
所以补丁看起来像这样:
diff --git a/package/rpi-firmware/cmdline.txt b/package/rpi-firmware/cmdline.txt
index 155a54693b..630cfa9e00 100644
--- a/package/rpi-firmware/cmdline.txt
+++ b/package/rpi-firmware/cmdline.txt
@@ -1 +1 @@
-old code line
+new code line
但是,当我运行make
,打补丁的时候找不到要打补丁的文件(路径错误)
Applying 0001-name-of-patch.patch using patch:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/package/rpi-firmware/cmdline.txt b/package/rpi-firmware/cmdline.txt
|index 155a54693b..630cfa9e00 100644
|--- a/package/rpi-firmware/cmdline.txt
|+++ b/package/rpi-firmware/cmdline.txt
--------------------------
No file to patch. Skipping patch.
我也尝试了 rpi-firmware/cmdline.txt
和 cmdline.txt
路径。
补丁文件应该用什么路径?它应该相对于包,相对于 buildroot 存储库根目录,还是指向相对于全局补丁目录的包?我关注了 https://buildroot.org/downloads/manual/manual.html#customize-patches 但找不到这个问题的答案。
正如@sawdust 所提到的,无法对 buildroot 包目录 buildroot/package/<package_name>
中的文件进行修补。您只能修补软件包的来源,即下载到 output/build/<package_name>/
.
的源文件
我最终使用 post-build 脚本在复制后修改文件,如 https://buildroot.org/downloads/manual/manual.html#rootfs-custom(选项 BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_PATH}/board/myboard/scripts/post-build.sh"
)
中所述
我想给 buildroot 包打补丁。我正在使用 br2-external
树将我的自定义设置排除在 buildroot 树之外。 Buildroot 可以找到我的补丁,但尝试应用它时失败。
我设置了BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_PATH}/board/myboard/patches"
,把补丁放在了${BR2_EXTERNAL_PATH}/board/myboard/patches/packagename/0001-name-of-patch.patch
。我通过转到 buildroot
存储库生成补丁,将更改应用于包,使用 git 提交它们并从上次提交创建补丁:
git format-patch HEAD~1
所以补丁看起来像这样:
diff --git a/package/rpi-firmware/cmdline.txt b/package/rpi-firmware/cmdline.txt
index 155a54693b..630cfa9e00 100644
--- a/package/rpi-firmware/cmdline.txt
+++ b/package/rpi-firmware/cmdline.txt
@@ -1 +1 @@
-old code line
+new code line
但是,当我运行make
,打补丁的时候找不到要打补丁的文件(路径错误)
Applying 0001-name-of-patch.patch using patch:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/package/rpi-firmware/cmdline.txt b/package/rpi-firmware/cmdline.txt
|index 155a54693b..630cfa9e00 100644
|--- a/package/rpi-firmware/cmdline.txt
|+++ b/package/rpi-firmware/cmdline.txt
--------------------------
No file to patch. Skipping patch.
我也尝试了 rpi-firmware/cmdline.txt
和 cmdline.txt
路径。
补丁文件应该用什么路径?它应该相对于包,相对于 buildroot 存储库根目录,还是指向相对于全局补丁目录的包?我关注了 https://buildroot.org/downloads/manual/manual.html#customize-patches 但找不到这个问题的答案。
正如@sawdust 所提到的,无法对 buildroot 包目录 buildroot/package/<package_name>
中的文件进行修补。您只能修补软件包的来源,即下载到 output/build/<package_name>/
.
我最终使用 post-build 脚本在复制后修改文件,如 https://buildroot.org/downloads/manual/manual.html#rootfs-custom(选项 BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_PATH}/board/myboard/scripts/post-build.sh"
)