A simpler way of using a local git repository in bitbake recipe file
In some cases for instance when the download performance is not good, you may need to use local kernel git repository in your yocto build bb file. To do this, you can either use existing local git repository in your bb file or you can set-up and download git repository locally as below.
Steps to set up local kernel repository
$ mkdir ~/kernel_source
$ cd ~/kernel_source
$ git clone --bare <SRC_REPO> kernel.git
Now, the bb file will use the locally existing GIT repo for bitbake build. Now you have local kernel git repository. To use this git repo in your bb file, you can add the SRC_URI as below.
SRCBRANCH = "master"
SRC_URI = "git:///home/gopinath/kernel_source/kernel.git;branch=${SRCBRANCH}"
Now, the bb file will use the locally existing GIT repo for bitbake build.
How to use private github and gitlab
Using public repositories in yocto build is more common and straight forward. For example, to download any kernel git repository in bitbake recipe bb files, syntax will be as follow.
SRC_URI = "git://git.freescale.com/imx/linux-2.6-imx.git;branch=${SRCBRANCH}"
In the above case, if it is a private repo, it will fail with below error message.
Please make sure you have the correct access rights
and the repository exists.
So in order to use a private repository in bitbake recipe file, use the SRC_URI as given in the below example.
For github,
SRC_URI = "git://git@github.com/my_private_project/linux_kernel.git;protocol=ssh;branch=${SRCBRANCH}"
In case of gitlab, it will be bit different.
SRC_URI = "git://git@gitlab.com:~/my_private_project/linux_kernel.git;protocol=ssh;branch=${SRCBRANCH}"