Search code examples
gitembedded-linuxyocto

Add full featured git to yocto build


I'm pretty new to yocto as well as linux and i'm trying to build an image for my IMX8 SOM including a full featured git version. So far i've managed to build the image and run it on target but git is not full featured as submodules are not supported.
In order to ad git to the image i simply added "git" to the IMAGE_INSTALL_append variable of my local.conf. Hence i don't even know were the sources of git are fetched from and even worse i don't have a clue on how to find out.
The basic yocto project i use is available at https://github.com/tq-systems/ci-meta-tq/tree/zeus-tqma8 and maintained by the SOM supplier.
Due to yocto excessively using git i'm having a hard time to find anything regarding this issue. Any help on how to add a full featured git version to my image is appreciated.

Further information:

cat /etc/os-release:  
ID="fsl-imx-wayland"
NAME="NXP i.MX Release Distro"  
VERSION="5.4-zeus (zeus)"  
VERSION_ID="5.4-zeus"  
PRETTY_NAME="NXP i.MX Release Distro 5.4-zeus (zeus)"  

git --version:  
git version 2.23.0

Solution

  • Thanks for the responses!
    Meanwhile I found the solution:
    I simply had to add git-perltools to IMAGE_INSTALL_append.

    For everyone who is as new to the yocto etc. as me, I want to summarize my approach in detail: In order to find the recipe for git, I used find sources | grep git, where "sources" is the directory containing all the layers. This unfortunately yields a pretty long list but within it you can find the git recipe (in my case git_2.23.0.bb). In retrospect it’s more valuable to grep for "git_" to reduce the list size.
    As OliverB mentioned the recipe includes git.inc. I had a look at it and there are two interesting code snippets in it:

    PERLTOOLS = " \
        ${libexecdir}/git-core/git-add--interactive \
        ${libexecdir}/git-core/git-archimport \
        ${libexecdir}/git-core/git-cvsexportcommit \
        ${libexecdir}/git-core/git-cvsimport \
        ${libexecdir}/git-core/git-cvsserver \
        ${bindir}/git-cvsserver \
        ${libexecdir}/git-core/git-difftool \
        ${libexecdir}/git-core/git-send-email \
        ${libexecdir}/git-core/git-svn \
        ${libexecdir}/git-core/git-instaweb \
        ${libexecdir}/git-core/git-submodule \
        ${libexecdir}/git-core/git-am \
        ${libexecdir}/git-core/git-request-pull \
        ${datadir}/gitweb/gitweb.cgi \
        ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
        ${datadir}/git-core/templates/hooks/pre-rebase.sample \
        ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
    "
    

    and:

    # Git tools requiring perl
    PACKAGES =+ "${PN}-perltools"
    FILES_${PN}-perltools += " \
        ${PERLTOOLS} \
        ${libdir}/perl \
        ${datadir}/perl5 \
    "
    

    As you can see in the upper snippet "git-submodule" is contained in the "PERLTOOLS" variable which suggests itself to be what I was looking for. Within the second snippet you can see, that "PERLTOOLS" is used in the package "${PN}-perltools" which resolves to git-perltools.
    Hence I added "git-perltools" to IMAGE_INSTALL_append within my local.conf and gave it a try.