Files
buildenv/README-en.md
Thilo Graf af32875a90 Readme: supplement to Update README-de.md
README-en.md was not considered
btw. git clone https://github.com/dbt1/build.git is still valid.
It was only renamed because there was a risk of confusion since the
directory build/<machine> was named very similarly.
2023-05-01 14:30:49 +02:00

9.1 KiB

Quick start image build

Preparation

Install required host packages (Debian 11)

For usage with other distributions see: Yocto Project Quick Build

📝 NOTE: If you are using the Tuxbox-Builder VM (this is not mandatory) please jump to step 1. The Tuxbox-Builder VM already contains required packages. For details and download of Tuxbox-Builder VM see: Tuxbox-Builder

apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential \
chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all \
libxml2-utils ninja-build default-jre clisp libcapstone4 libsdl2-dev doxygen
apt-get install -y gitk git-gui meld cppcheck clazy kdevelop

Optional: In case of no configured git, please set your global git user data:

git config --global user.email "you@example.com"
git config --global user.user "Your Name"

Build Image:

📝 Note: Some paths are based on the defaults generated by the init script. Some entries are given as <placeholders>, which must be adjusted accordingly.

1. Clone init script.

git clone https://github.com/dbt1/buildenv.git
cd buildenv

2. Execute init script

./init.sh
cd poky-3.2.4

3. Show possible machine types

ls  build

4. Execute environment script

. ./oe-init-build-env build/<enter required machine type from list taken from step 3>

5. Build

bitbake neutrino-image

This may take a while. Some warn messages can be ignored. Error messages during setscene tasks are no problem but errors during build and package tasks will abort the process. In this case please report the error or send us your solution. Help is very welcome.

If all done, such a similar message should appear:

...
NOTE: Tasks Summary: Attempted 4568 tasks of which 4198 didn't need to be rerun and all succeeded.
...

That's it ...

Built images and packages to find under:

~/build/poky-3.2.4/build/<machine>/tmp/deploy

or in the dist directory:

~/build/dist/<image-version/<machine>/

Updating

📝 Manually updates for any target sources are not required. This is done automatically for each called target with Bitbake. This also updates any required dependencies. If you want to have full control for a target source, see "Working on target sources"!

If steps 1 to 4 have already been performed, only step 5 is required:

Update image

bitbake neutrino-image

Update a target

bitbake <target>

Update meta layer repositories

Execution of init script (see: step 2) will update the required meta-layer repositories.

cd $HOME/build
./init.sh

The update routines will stash uncommitted changes or will rebase your local commits to new remote changes, but conflicts are possible. In this case you must solve manually. Of corse you can update and modiify local meta-layer for meta-neutrino and machine layers repositories manually.

📝 Note: Your config files will be untouched. New or modified config options are not considered. Please check your configuration if required.

Working on target sources

If you want to have the full control about any target source, you should transfer the desiered target source into the workspace. For more details about this workflow see devtool and especially devtool modify.

Reset configuration if required

If you want to reset your configs, please rename (delete is not recommended) the conf directory and execute the init script again. See step 2.

mv $HOME/build/poky-3.2.4/build/<machine>/conf $HOME/build/poky-3.2.4/build/<machine>/conf.01
cd $HOME/build
./init.sh

Rebuild of a single target

In some cases, a target may abort for whatever reason. You should not panic and delete the whole tmp folder and the sstate-cache. You can also do this for each target individually.

📝 In particular, broken archive URLs could terminate the build. However, these errors are always displayed and the URL can be checked accordingly. Often only the servers are down and will work again after a few minutes.

To ensure that the recipe has really a problem, it makes sense to clean up completely and rebuild the target. To enforce this, all generated package, build and cache data must be cleaned.

bitbake -c cleansstate <target>

rebuild again

bitbake <target>

Force complete image rebuild

If you want to force a rebuild, you can delete (or rename) the tmp directory:

mv tmp tmp.01
bitbake neutrino-image

If you didn't delete the sstate-cache, the image should be built in relatively short time. Therefore it is recommended to keep the sstate-cache. The directory where the sstate-cache is located is defined by the variable ${SSTATE_DIR} and can be adjusted in the configuration.

This directory is quite valuable especially when using slow computers and only in rare cases it is necessary to delete this directory as well. Please note in case of deleted sstate-cache, the build will take much more time.

💡 You can tell bitbake not to use sstate-cache.

bitbake --no-setscene neutrino-image

or

bitbake --skip-setscene neutrino-image

Customize if required

It's recommended to build for first time without any changes on config files to get an impression how the build process is working and see the results. The possibilities for adjustments are very extensive and not really manageable for beginners. However, the Yoctoproject is very extensively documented and provides the best source of information.

Important for developers: "Working on target sources"!

⚠️ Please do not modify the Yocto-recipes! This is not recommended by the Yocto-Team, but you can use .bbappend files to complete, expand or override meta core Yocto recipes.

Overview of global configuration files

These configuration files are required within the build directories for local configuration:

$HOME/build/poky-3.2.4/build/<machine>/conf/local.conf

This generated local.conf contains only a few lines, but has a line that points to a common configuration file that is valid for all images and supported machine types and can be fed with your own options.

$HOME/build/local.conf.common.inc

This .inc file was derived from the cloned example configuration file when the init script was run for the first time.

local.conf.common.inc.sample

This sample file should be untouched to avoid possible conflicts when updating the build repository and to see what might have changed.

After updating the build repository, some new or changed options may have been added or removed that are not reflected in the included configuration file. This case should be taken into account in your own configuration and adjusted if necessary. Of course you can modify $HOME/Build/poky-3.2.4/build/<machine>/conf/local.conf with your own requirements and use it as a separate configuration file for a machine type.

Pattern configuration for bblayers.conf:

$HOME/build/poky-3.2.4/build/<machine>/conf/bblayers.conf

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/<username>/build/poky-3.2.4/meta \
  /home/<username>/build/poky-3.2.4/meta-poky \
  /home/<username>/build/poky-3.2.4/meta-yocto-bsp \
  "
BBLAYERS += " \
			/home/<username>/build/poky-3.2.4/meta-neutrino \
			/home/<username>/build/poky-3.2.4/meta-<machine-brand-or-bsp-name> \
			/home/<username>/build/poky-3.2.4/meta-openembedded/meta-oe \
			"
BBLAYERS += " \
				/home/<username>/build/poky-3.2.4/meta-python2 \
				"
BBLAYERS += " \
				/home/<username>/build/poky-3.2.4/meta-qt5 \
				"

More informations

Further informations about yocto buildsystem: