Yocto - How to patch in a recipe with devtool
Yocto: Modifying, building, deploying and patching a recipe with Yocto devtool
[
Yocto: 使用 Yocto devtool 修改、构建、部署和修补配方
]
OpenEmbedded 从源代码构建所有内容的一个好处是,对构建的任何内容进行修改都相当容易,但第一次这样做可能有点令人生畏。
作为构建配方的一部分,OE 会创建一个 <output_dir>/tmp/work/<architecture>/<recipe>/<version> 目录,称为 "工作目录"。构建配方的所有工作都在此完成。在这个目录中,你可以找到源代码,通常位于名为 <recipe_name>-<version> 或 "git"(取决于获取源代码的方式)的子目录下。在这里做一些简单的修改,然后重新编译,这是很诱人的做法(过去人们也经常这么做),但有几个原因说明这不是个好主意:
One of the useful things about OpenEmbedded building everything from source is that it's fairly easy to make changes to anything that gets built, but doing so for the first time can be a bit daunting.
As part of building a recipe, OE creates a <output_dir>/tmp/work/<architecture>/<recipe>/<version> directory, known as the "work directory". This is where all of the work done to build a recipe takes place. One of the things you'll find in this directory is the source, usually under a subdirectory named <recipe_name>-<version> or "git" (depending on how the fetched source is provided). The temptation (and what people used to do in the past) is to simply make changes here and then recompile, but there are several reasons why that's not a good idea:
|
-
它很笨拙--你必须使用 bitbake -c compile -f 或 bitbake -C compile 来强制重新编译,因为编译系统不知道你做了任何改动
-
稍有不慎,就很容易丢失修改内容,例如,运行 bitbake -c clean 会抹掉目录
|
另外,除了work目录,还有work-shared目录可以存放一些源文件。比如Kernel source就在这个目录里。
幸运的是,如果你使用的是 Fido (1.8) 或更高版本,有一个更好的方法,那就是使用 devtool 命令:
devtool 允许你将一个 Yocto 配方解压缩到本地文件夹中,这样你就可以在其中工作了。
devtool 会创建一个临时层,级别设置为 99,这样它就会覆盖所有其他层。它会检查你的代码,并创建一个 "devtool "分支。
在源文件中添加配方补丁的步骤如下: