我正在尝试添加新的 c 文件来代替从 git 下载包后已经出现的文件。尝试 bbappend 但原始文件仍然存在。还修改了 src_uri += file://fileone.c 但这也不是覆盖文件。任何建议都会有很大帮助
问候马扬克
devtool modify
如果您使用的是 jethro (2.0) 或更高版本,这将非常有用。假设您已经获取了环境设置脚本:
devtool modify <recipename>
cd
到该目录的位置。git commit -a
提交您的更改devtool update-recipe <recipename> -a /path/to/your/custom/layer
(假设您想在自定义层中创建一个 bbappend,否则只需省略-a
and 路径以将更改应用于原始配方)。devtool reset <recipename>
将所有内容重新完全从元数据构建。所以原始 C 文件是发布 tarball(或 git,或发布来自的任何地方)的一部分,您想在配置和编译发生之前用您自己的文件替换该文件?
替换整个文件只是您可能想要对源文件进行任何较小更改的特殊情况,因此只需执行您在这些情况下会执行的操作:创建一个替换文件的补丁并将补丁添加为SRC_URI += file://replace-file-with-my-file.patch
.
我使用这个工作流程(在项目源目录中,例如 poky/build/tmp/work/corei7-64-poky-linux/my-project):
# initialize git (only if this is not a git repo already)
git init
git add *
git commit -m "original code"
# <--- here you should replace the file
git commit -a -m "Replace file with a better file"
git format-patch -1
现在您应该有一个补丁文件,您可以将其复制到正确的配方目录中。