15

Hej

I am playing a bit around with Yocto, a Raspberry Pi and some code I wrote. Now I want that Yocto is building an image including the program I wrote. I like to know how to setup the fetcher to fetch from a local git repro.

My setup is simple. The code is in the directory:

/home/user/git/myTest

I linked the directory into my recipe directory of my Yocto meta-layer.

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

Because it is a local git repro, there is the ".git" folder.

/home/user/git/myTest/.git

There are more files:

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

I like to know how to setup my recipe to use the git fetcher:

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

inherit cmake

SRCREV = "${AUTOREV}"

SRC_URI = "git://.git"

S = "${WORKDIR}/git"

I did check the Yocto/Bitbake documentation. But I did not find an example how to do it. Any ideas?

Stefan Jaritz
  • 1,999
  • 7
  • 36
  • 60

2 Answers2

27

GIT Fetcher in bitbake supports different protocols but with rather peculiar and non-standard syntax. In your case it should be something like

SRC_URI = "git:///home/user/git/myTest/;protocol=file"
phd
  • 82,685
  • 13
  • 120
  • 165
  • 1
    This non-standard syntax had me really confused when trying `SRC_URI = "file:///home/user/git/myTest/;protocol=file"`. – remcycles Jun 07 '18 at 20:01
  • But I guess it makes sense now after reading `4.3.6. Other Fetchers` in the documentation. Thanks! – remcycles Jun 07 '18 at 20:02
  • 1
    All other programs (`npm` or `pip` for example) use different syntax like `git+https://gitlab.com/…` so they can easily switch both "fetcher" (VCS) and the protocol. That's why I complain about peculiar and non-standard syntax. – phd Jun 07 '18 at 20:04
-3

Like below, you can access from local,

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

It will access the respective local file.