Yocto/Tools
Tools
In here you can find some tools and how to use them related to Yocto.
Repo
What is Repo?
From repo documentation: repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it easier to work with Git. The repo command is an executable Python script that you can put anywhere in your path.
Install repo
You can install it using apt:
sudo apt-get install repo
Or downloading it directly
1. Add repo script to bin directory in home.
mkdir -p ~/bin curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo
2. Append the directory if it's not already in PATH
PATH=$PATH:~/bin
How to use repo with Yocto
Repo uses an XML manifest in order to enumerate multiple remotes, repositories, branches and revisions, then it fetches them. For example, using a Boundary Devices repository with a manifest we can use:
cd <ANY_DIR> repo init -u https://github.com/boundarydevices/boundary-bsp-platform -b dunfell
With these options being the most important:
-u URL, --manifest-url=URL : manifest repository location -b REVISION, --manifest-branch=REVISION : manifest branch or revision (use HEAD for default) -m NAME.xml, --manifest-name=NAME.xml: initial manifest file (defaults to default.xml), you can also use this to specify a completely different manifest in your system and it will be used.
After doing repo init, you can sync it using:
repo sync
This will generate a directory structure with the given repositories defined in the XML manifest, normally in Yocto it will create a sources directory with each layer, and a setup script to create a build.
Analyzing the repo manifest
Take as an example the manifest located in: https://github.com/boundarydevices/boundary-bsp-platform/blob/gatesgarth/default.xml
Defaults
The default settings are set as:
<default sync-j="4" revision="gatesgarth"/>
Remotes
Remotes are defined as below, they are named to be used later for each project:
<remote fetch="https://git.yoctoproject.org/git" name="yocto"/> <remote fetch="https://github.com/Freescale" name="freescale"/> <remote fetch="https://github.com/openembedded" name="oe"/> <remote fetch="https://github.com/boundarydevices" name="boundary"/>
Projects
Project are basically the repositories to fetch, they will use the remote defined above, the name on the hosting server, and then clone them into a path. You can also use the revision which is the commit to checkout, and upstream which is the branch to use, this is not necessarily the same for all projects obviously.
<project remote="yocto" revision="6bd890d9e011014cf323e61267f8b256949d44aa" upstream="pyro" name="poky" path="sources/poky"/> <project remote="yocto" revision="83b779a7ef69006564fb8d27e65c31917bc3b6f0" upstream="pyro" name="meta-freescale" path="sources/meta-freescale"/> <project remote="oe" revision="5e82995148a2844c6f483ae5ddd1438d87ea9fb7" upstream="pyro" name="meta-openembedded" path="sources/meta-openembedded"/> <project remote="freescale" revision="a73a14247afbbcf840bab7b76f953004fe109253" upstream="pyro" name="meta-freescale-3rdparty" path="sources/meta-freescale-3rdparty"/> <project remote="freescale" revision="cd5c7a2539f40004f74126e9fdf08254fd9a6390" upstream="pyro" name="meta-freescale-distro" path="sources/meta-freescale-distro"/>
You can also perform operations like copy files from the project directly after syncing:
<project remote="boundary" name="boundary-bsp-base" path="sources/base"> <copyfile dest="README" src="README"/> <copyfile dest="setup-environment" src="setup-environment"/> </project>
Creating a manifest
You can create a manifest of your current build by using:
repo manifest -r -o my_manifest.xml