如何设置 Yocto 配方以从本地 git 来源构建?

How to setup an Yocto recipe to build from a local git source?

我正在玩 Yocto,Raspberry Pi 和我写的一些代码。现在我希望 Yocto 正在构建包含我编写的程序的图像。我想知道如何设置获取器以从本地 git 复制中获取。

我的设置很简单。代码在目录中:

/home/user/git/myTest

我将该目录链接到我的 Yocto 元层的食谱目录中。

/home/user/poky/meta-test/myApp/myTest

因为是本地git复制,所以有“.git”文件夹。

/home/user/git/myTest/.git

还有更多文件:

/home/user/git/myTest/CMakeLists.txt
/home/user/git/myTest/src/main.cpp
/home/user/git/myTest/src/...

我想知道如何设置我的食谱以使用 git 提取器:

SUMMARY = "test"
SECTION = "app"
LICENSE = "CLOSED"

inherit cmake

SRCREV = "${AUTOREV}"

SRC_URI = "git://.git"

S = "${WORKDIR}/git"

我确实检查了 Yocto/Bitbake 文档。但是我没有找到如何做的例子。 有什么想法吗?

GIT bitbake supports different protocols 中的 Fetcher,但具有相当奇特的 non-standard 语法。在您的情况下,它应该类似于

SRC_URI = "git:///home/user/git/myTest/;protocol=file"

如下图,可以从本地访问,

SRC_URI = "git:///home/path.git; file:defconfig"

它将访问相应的本地文件。