Difference between revisions of "Building the Yocto BSP (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
Line 1: Line 1:
{{WorkInProgress}}
 
 
{{InfoBoxTop}}
 
{{InfoBoxTop}}
 
{{Applies To Bora}}
 
{{Applies To Bora}}
Line 18: Line 17:
 
}}
 
}}
  
 +
 +
 +
==Quick reference==
 +
{| class="wikitable" border="1"
 +
|+Repository Information
 +
|-
 +
! Repository
 +
| BSP Manifest
 +
| Yocto BSP Layer
 +
|-
 +
! URL
 +
| git@git.dave.eu:lynx/lynx-bsp.git
 +
| git@git.dave.eu:lynx/meta-lynx.git
 +
|-
 +
! stable branch
 +
| lynx-fido
 +
| lynx-fido
 +
|-
 +
! stable tag
 +
| xuelk-1.2.0
 +
| xuelk-1.2.0
 +
|}
 +
 +
{| class="wikitable" border="1"
 +
|+Build targets
 +
! Name
 +
! Description
 +
|-
 +
| bora-image
 +
| Minimal image
 +
|-
 +
| bora-image-devel
 +
| This image include tools for development/debugging
 +
|-
 +
| bora-image-networking
 +
| In addition <code>bora-image-devel</code>, this image provides several networking tools
 +
|-
 +
|<code>lynx-image-networking-sbc-lynx-xeno</code>
 +
|With respect to the <code>lynx-image-networking</code> image, this includes additional libraries required to run the Linux kernel featuring the Xenomai real-time extension. For more details about it, please refer to https://xenomai.org/.
 +
|}
  
 
==Introduction==
 
==Introduction==
Line 36: Line 75:
  
 
{{ImportantMessage|text=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 [[Advanced_use_of_Yocto_build_system_(BELK/BXELK)|this document]] which talks about the advanced use of the Yocto build system.}}
 
{{ImportantMessage|text=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 [[Advanced_use_of_Yocto_build_system_(BELK/BXELK)|this document]] which talks about the advanced use of the Yocto build system.}}
 
===Prerequisites===
 
BELK/BXELK MVM is already configured to build this Yocto version/configuration, therefore no additional packages have to be installed by the user in order to run the Yocto BSP build process.
 
  
 
=== Initialize the build environment ===
 
=== Initialize the build environment ===
Line 45: Line 81:
 
BELK/BXELK Yocto BSP uses [https://code.google.com/p/git-repo/ git-repo] tool to fetch all the required git repositories. To install it, please use the following commands:
 
BELK/BXELK Yocto BSP uses [https://code.google.com/p/git-repo/ git-repo] tool to fetch all the required git repositories. To install it, please use the following commands:
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@dvdk-vm:~/lynx$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
+
dvdk@dvdk-vm:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
dvdk@dvdk-vm:~/lynx$ chmod a+x repo
+
dvdk@dvdk-vm:~/belk$ chmod a+x repo
dvdk@dvdk-vm:~/lynx$ ./repo init -u git@git.dave.eu:lynx/lynx-bsp.git -b lynx-fido
+
dvdk@dvdk-vm:~/belk$ ./repo init -u git@git.dave.eu:bora/bora-bsp.git -b bora-morty
dvdk@dvdk-vm:~/lynx$ ./repo sync
+
dvdk@dvdk-vm:~/belk$ ./repo sync
 +
dvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.sh
 
</pre>
 
</pre>
  
=== Run the build ===
+
=== 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:  
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. Moreover, building inside the DVDK adds some overhead, 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, developers should consider the following options:  
+
* Migrating the build system to a physical machine
* 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).
* assuming that the host system has the required resources, extending the hardware capabilities of the default DVDK (eg: adding more cores and disk space)
 
  
 
Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:
 
Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@dvdk-vm:~/lynx$ DISTRO=fsl-imx-fb MACHINE=sbc-lynx source lynx-setup-release.sh -b build-fb -e fb
+
dvdk@dvdk-vm:~/belk/build$ bitbake <target-image-name>
dvdk@dvdk-vm:~/lynx/build$ bitbake lynx-image-networking
 
 
</pre>
 
</pre>
 +
Where <code><target-image-name></code> is one of the images listed in [[#Quick sreference|here]].
  
The resulting files (kernel, devicetree and u-boot binaries, plus .tar.gz root file system) will then be available inside ''build/tmp/deploy/images/sbc-lynx''.
+
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 <code>build/tmp/deploy/images/sbc-lynx</code>.
  
In addition to the typical images, the XUELK provides the following too:
+
===Generating the SDKs===
*<code>lynx-image-networking-sbc-lynx-xeno</code>
+
After creating an image as described in the previous version, the corresponding SDK can be generated by oissuing the following command:
**With respect to the <code>lynx-image-networking</code> image, this includes additional libraries required to run the Linux kernel featuring the Xenomai real-time extension. For more details about it, please refer to https://xenomai.org/.
+
<pre class="workstation-terminal">
 +
bitbake <image_name -c populate-sdk
 +
</pre>
 +
Again, replace <target-image-name> with one of the images listed in [[#Quick sreference|here]].
  
=== Build additional packages ===
+
=== Building additional packages ===
  
 
To build additional packages the user must first enter the directory where the <code>lynx-setup-release.sh</code> is placed and source it
 
To build additional packages the user must first enter the directory where the <code>lynx-setup-release.sh</code> is placed and source it
Line 124: Line 162:
  
  
The generic procedure to generate the Yocto BSP image is the following:
 
<pre class="board-terminal">
 
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
 
dvdk@dvdk-vm:~/belk/build$ bitbake <target-image-name>
 
</pre>
 
bora-image
 
bora-image-devel
 
bora-image-networking
 
  
 
The components listed in the table above can be kept in sync and up to date with DAVE Embedded Systems' repositories.
 
The components listed in the table above can be kept in sync and up to date with DAVE Embedded Systems' repositories.
Line 148: Line 174:
  
  
The following table lists the pre-built root file systems included in the MVM.
+
 
{| class="wikitable" border="1"
 
!Kit version<br>BELK<br>BXELK
 
!Image name
 
!Build commands
 
!Path
 
|-
 
|rowspan="3"|<br>4.0.0<br>2.0.0
 
|<code>bora-image</code>
 
|<pre>
 
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
 
dvdk@dvdk-vm:~/belk/build$ bitbake bora-image
 
</pre>
 
|<code>/home/dvdk/bora/rfs/belk-4.0.0</code>
 
|-
 
|<code>bora-image-devel</code>
 
|<pre>
 
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
 
dvdk@dvdk-vm:~/belk/build$ bitbake bora-image-devel
 
</pre>
 
|<code>/home/dvdk/bora/rfs/belk-4.0.0</code>
 
|-
 
|<code>bora-image-networking</code>
 
|<pre>
 
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
 
dvdk@dvdk-vm:~/belk/build$ bitbake bora-image-networking
 
</pre>
 
|<code>/home/dvdk/bora/rfs/belk-4.0.0</code>
 
|-
 
|}
 
  
  

Revision as of 13:12, 12 September 2017

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress


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

As the XUELK 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

The instructions described by this document apply to the following kits:

  • BELK 4.0.0 or newer
  • BXELK 2.0.0 or newer.


Quick reference[edit | edit source]

Repository Information
Repository BSP Manifest Yocto BSP Layer
URL git@git.dave.eu:lynx/lynx-bsp.git git@git.dave.eu:lynx/meta-lynx.git
stable branch lynx-fido lynx-fido
stable tag xuelk-1.2.0 xuelk-1.2.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
lynx-image-networking-sbc-lynx-xeno With respect to the lynx-image-networking image, this includes additional libraries required to run the Linux kernel featuring the Xenomai real-time extension. For more details about it, please refer to https://xenomai.org/.

Introduction[edit | edit source]

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[edit | edit source]

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

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.

Initialize the build environment[edit | edit source]

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[edit | edit source]

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/sbc-lynx.

Generating the SDKs[edit | edit source]

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

bitbake <image_name -c populate-sdk

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

Building additional packages[edit | edit source]

To build additional packages the user must first enter the directory where the lynx-setup-release.sh is placed and source it

dvdk@dvdk-vm:~/lynx$ DISTRO=fsl-imx-fb MACHINE=sbc-lynx source lynx-setup-release.sh -b build-fb -e fb
dvdk@dvdk-vm:~/lynx/build$

And then can run any of the bitbake command.

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

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

dvdk@dvdk-vm:~/lynx/build$ ls -l tmp/deploy/rpm/cortexa7hf_vfp_neon/memtester*
-rw-r--r-- 1 dvdk dvdk  9967 Sep  7 05:43 tmp/deploy/rpm/cortexa7hf_vfp_neon/memtester-4.1.3-r0.cortexa7hf_vfp_neon.rpm
-rw-r--r-- 1 dvdk dvdk 25544 Sep  7 05:43 tmp/deploy/rpm/cortexa7hf_vfp_neon/memtester-dbg-4.1.3-r0.cortexa7hf_vfp_neon.rpm
-rw-r--r-- 1 dvdk dvdk  2884 Sep  7 05:42 tmp/deploy/rpm/cortexa7hf_vfp_neon/memtester-dev-4.1.3-r0.cortexa7hf_vfp_neon.rpm
-rw-r--r-- 1 dvdk dvdk  5611 Sep  7 05:44 tmp/deploy/rpm/cortexa7hf_vfp_neon/memtester-doc-4.1.3-r0.cortexa7hf_vfp_neon.rpm
















The components listed in the table above can be kept in sync and up to date with DAVE Embedded Systems' repositories. Once the git account has been enabled, the developer can:

  • clone the repository with the git clone <git_remote_repository> command
  • synchronize a source tree entering the repository directory and launching the git fetch origin command.

Please note that git fetch doesn't merge the commits on the current branch. To do that, the developer should run the git merge command or replace the fetch-merge process with a single git pull command. Please note that the recommended method is the fetch-merge process. For further information on Git, please refer to the official Git Documentation (http://git-scm.com/documentation).


200px-Emblem-important.svg.png

Technically speaking, the developer can run a Yocto-based full build process to (re)generate all the pre-built objects included in the MVM. However, this process requires a lot of hardware resources in terms of disk storage, RAM, and processing power. For this reason, it is discouraged to use the MVM to perform such build. Using a physical machine is recommended instead. For more details on this, please refer to this page.




The following table lists the pre-built Yocto SDKs included in the MVM. These SDKs are associated with the root file system images mentioned above.

Kit version
BELK
BXELK
SDK name Build commands Path

4.0.0
2.0.0
bora-image
bitbake bora-image -c populate-sdk
/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi
bora-image-devel
bitbake bora-image-devel -c populate-sdk
/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi
bora-image-networking
bitbake bora-image-networking -c populate-sdk
/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi


About C/C++ application development and debugging, please refer to this page.