BORA SOM/BELK-L/Development/Advanced use of Yocto build system

From DAVE Developer's Wiki
Jump to: navigation, search


Advanced use of Yocto build system[edit | edit source]

Yocto can be used to build an entire Linux distribution from source. The build process can be summarized as follows:

  • Make sure that all the prerequisites are met
  • Initialize the build environment, as described in here.
  • Optionally ensure the conf/local.conf configuration file, which is found in the Build Directory, is set up how you want it. This file defines many aspects of the build environment including the target machine architecture through the MACHINE variable, the development machine's processor use through the BB_NUMBER_THREADS and PARALLEL_MAKE variables, and a centralized tarball download directory through the DL_DIR variable.
  • Build the image using the bitbake command. For more information about BitBake, please refer to the BitBake User Manual.

For more information regarding Yocto build system, go to its dedicated category page

Prerequisites[edit | edit source]

The following prerequisites are required. They need to be done once only. Some generic development tools are required on the host Linux machine:

  • git
  • curl
  • build-essential
  • diffstat
  • texinfo
  • gawk
  • chrpath
  • ia32-libs (if the host machine is running a 64-bit OS)
  • python-m2crypto.

These packages can be installed with the following command:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm.

It is also recommended to switch the system shell from Ubuntu's standard dash to more universal bash:

:~$ sudo dpkg-reconfigure dash

Initializing the build environment[edit | edit source]

In the BELK, we have simplified the Yocto initialization phase, relying on the repo tool and on a BORA BSP git repository, so that the initialization can be completed with a few commands as reported below:

:~$ mkdir belk && cd belk
:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
:~/belk$ chmod a+x repo
:~/belk$ ./repo init -u git@git.dave.eu:dave/bora/bora-bsp.git -b bora
:~/belk$ ./repo sync

Build the Yocto image[edit | edit source]

Please note that even building the basic root file system requires a few hours to complete the process on a mid-hi range desktop PC (4-6 cores, 8-12 GiB RAM), also depending on the Internet connection speed (all source are fetched from the network). Nearly 20GiB of disk space is required for the build. Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:

:~$ cd ~/belk
:~/belk$ source bora-bsp-init-env.sh build
:~/belk/build$ bitbake base-rootfs-image

The resulting files (kernel, devicetree and u-boot binaries, plus .tar.gz root file system) will then be available inside build/tmp/deploy/images/bora.

Build additional packages[edit | edit source]

To build additional packages the user must first enter the directory where the bora-bsp-init-env.sh is placed and source it:

:~$ cd ~/belk
:~/belk$ source bora-bsp-init-env.sh build

And then he/she can run any of the bitbake commands:

:~/belk/build$ bitbake memtester

The resulting packages (the default format is ipk) can be found inside build/tmp/deploy/ipk.

Using pre-built package archive[edit | edit source]

Starting from BELK 3.0.1 / BXELK 1.0.0, the archive of pre-built packages belonging to openembedded-core layer is available. This allows to install on the target these packages via smart command, as described here.

The address of those repositories are detailed in the following table:


Name URL Description
all https://yocto.dave.eu/belk-latest/all architecture indipendent packages
cortexa9hf_neon https://yocto.dave.eu/belk-latest/cortexa9hf_neon/ Cortex A9 hf packages
bora https://yocto.dave.eu/belk-latest/bora BELK/BXELK packages

Please note that:

  • to point to a specific BELK revision user can substitute latest keyword with the specific x.y.z release (e.g. https://yocto.dave.eu/belk-3.0.1/armv7a_vfp_neon)
  • not all releases of BELK have a dedicated repository. In case your specific version is missing you can use the generic latest release
  • most of the packages are available inside cortexa9hf_neon repository

Demo on youtube[edit | edit source]

Get smart with SMART package manager on ZYNQ