Building the Yocto BSP (BELK/BXELK)

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress
Yocto-logo.png Applies to Yocto


200px-Emblem-important.svg.png As the structure of the BELK/BXELK is based on several tools, it is strongly recommended the reading of this document first to get an overview. 200px-Emblem-important.svg.png


200px-Emblem-important.svg.png As the BELK/BXELK kit is based on Yocto, the implementation of the MVM follows the approach described here. As such, the reading of this section is highly recommended. 200px-Emblem-important.svg.png


200px-Emblem-important.svg.png The instructions described by this document apply to the following kits:
  • BELK 4.0.0 or newer
  • BXELK 2.0.0 or newer.
200px-Emblem-important.svg.png


Quick reference

Repository Information
Repository BSP Manifest Yocto BSP Layer
URL git@git.dave.eu:bora/bora-bsp.git git@git.dave.eu:bora/meta-bora.git
stable branch bora-morty bora-morty
stable tag belk-4.0.0 belk-4.0.0
Build targets
Name Description
bora-image Minimal image
bora-image-devel This image include tools for development/debugging
bora-image-networking In addition bora-image-devel, this image provides several networking tools

Introduction

As known, in addition to a bootloader and the o.s. kernel, an embedded Linux system needs a root file system to operate. The root file system must contain everything needed to support the Linux system (applications, settings, data, etc.). The root file system is the file system that is contained on the same partition on which the root directory is located. The Linux kernel, at the end of its startup stage, mounts the root file system on the configured root device and finally launches the /sbin/init, the first user space process and "father" of all the other processes. For more information on the Linux filesystem, please refer to http://www.thegeekstuff.com/2010/09/linux-file-system-structure/.

BELK/BXELK provides one (or more) pre-built root file system, that can be used during the evaluation/development/deployment cycle. For instance, the root file system included in the bora-image-devel image is suited for the development phase, since it provides a relatively rich set of packages including tools and libraries used to debug the application code. The pre-built root file systems are located here: /home/dvdk/<target_name>/rfs/<kit_name>.

Besides the pre-built root file systems, BELK/BXELK also provides a rich repository containing pre-built applications and libraries. These packages can be easily installed on the target by using the smart tool. Please refer to this section for more details.

To generate the supported root file systems, the build of the Yocto BSP has to be run. The output of this process is an image containing the U-Boot binary file, the Linux kernel image, and the selected root file system image. The following sections describe in detail how to execute this operation.

For more general information regarding the Yocto build system, please refer the dedicated category page.

How to build the Yocto BSP images including the U-Boot binary file, the Linux kernel image, and the target root file system image

200px-Emblem-important.svg.png The following procedure requires the access to the DAVE Embedded Systems' git repositories. The access to such repositories is granted to development kit's owners only. Please refer to this page for detailed instructions on how to get it. 200px-Emblem-important.svg.png


200px-Emblem-important.svg.png This process requires a lot of hardware resources in terms of disk storage, RAM, and processing power. For this reason, it also is recommended to consider the use of a physical machine. For more details on this topic, please refer to this document which talks about the advanced use of the Yocto build system. 200px-Emblem-important.svg.png

Initialize the build environment

Before running the build, the environment must be initialized properly.

BELK/BXELK Yocto BSP uses git-repo tool to fetch all the required git repositories. To install it, please use the following commands:

dvdk@dvdk-vm:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
dvdk@dvdk-vm:~/belk$ chmod a+x repo
dvdk@dvdk-vm:~/belk$ ./repo init -u git@git.dave.eu:bora/bora-bsp.git -b bora-morty
dvdk@dvdk-vm:~/belk$ ./repo sync
dvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.sh

Running the build

Please note that even the basic root file system requires a few hours to build on a mid/hi range desktop (4-6 cores, 8-12 GiB RAM) also depending on your Internet connection speed (all sources are fetched from the network). Nearly 20GiB of disk space is required for the build. The process may be slowed down significantly since the performances of a virtual machine are reduced if compared to the physical hardware. Thus, it's recommended to check the hardware capabilities of the host system and, when building with Yocto is required, to consider the following options:

  • Migrating the build system to a physical machine
  • Assuming that the host system has the required resources, extending the hardware capabilities of the default MVM (e.g. adding more cores and disk space).

Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:

dvdk@dvdk-vm:~/belk/build$ bitbake <target-image-name>

Where <target-image-name> is one of the images listed in here.

Once the build process is completed, the resulting files (the U-Boot binaries, the Linux kernel image, the device tree blob, the .tar.gz compressed root file system image, etc.) will be available in build/tmp/deploy/images/bora.

Generating the SDKs

After creating an image as described in the previous version, the corresponding SDK can be generated by issuing the following command:

bitbake <target-image-name> -c populate-sdk

Again, replace <target-image-name> with one of the images listed in here.

Building additional packages

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

dvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.sh
dvdk@dvdk-vm:~/belk/build$

And then can run any of the bitbake command.

dvdk@dvdk-vm:~/belk/build$ bitbake memtester

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

dvdk@dvdk-vm:~/belk/build$ ls -l tmp/deploy/rpm/cortexa9hf_neon/memtester*
-rw-r--r-- 1 dvdk dvdk 10692 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-4.3.0-r0.cortexa9hf_neon.rpm
-rw-r--r-- 1 dvdk dvdk 27693 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-dbg-4.3.0-r0.cortexa9hf_neon.rpm
-rw-r--r-- 1 dvdk dvdk  2872 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-dev-4.3.0-r0.cortexa9hf_neon.rpm
-rw-r--r-- 1 dvdk dvdk  5903 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-doc-4.3.0-r0.cortexa9hf_neon.rpm