【问题标题】:How to setup an Yocto recipe to build from a local git source?如何设置 Yocto 配方以从本地 git 源构建?
【发布时间】:2018-09-07 05:16:41
【问题描述】:

嘿嘿

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

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

/home/user/git/myTest

我将该目录链接到我的 Yocto 元层的配方目录。

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

因为是本地git repro,所以有“.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 fetcher:

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

inherit cmake

SRCREV = "${AUTOREV}"

SRC_URI = "git://.git"

S = "${WORKDIR}/git"

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

【问题讨论】:

    标签: git cmake yocto bitbake


    【解决方案1】:

    bitbakesupports different protocols 中的 GIT Fetcher,但语法相当奇特且非标准。在您的情况下,它应该类似于

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

    【讨论】:

    • 这种非标准语法让我在尝试SRC_URI = "file:///home/user/git/myTest/;protocol=file" 时感到非常困惑。
    • 但我想在阅读了文档中的4.3.6. Other Fetchers 之后,它现在是有道理的。谢谢!
    • 所有其他程序(例如npmpip)使用不同的语法,如git+https://gitlab.com/…,因此它们可以轻松切换“提取器”(VCS)和协议。这就是为什么我抱怨特殊和不标准的语法。
    【解决方案2】:

    如下所示,您可以从本地访问,

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

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

    【讨论】:

      猜你喜欢
      • 2017-06-09
      • 2017-06-02
      • 2021-12-16
      • 1970-01-01
      • 2016-11-17
      • 2013-10-26
      • 1970-01-01
      • 2019-09-06
      • 2020-08-17
      相关资源
      最近更新 更多