Working with the Yocto build system

From DAVE Developer's Wiki
Revision as of 09:45, 12 September 2017 by U0001 (talk | contribs) (Created page with "{{InfoBoxTop}} {{Applies To Yocto}} {{Applies_To_MVM}} {{InfoBoxBottom}} ==Introduction== Currently, Yocto is the default distribution for the DAVE Embedded Systems' Linux kit...")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Info Box
Yocto-logo.png Applies to Yocto
VirtualMachine.png Applies to MVM

Introduction[edit | edit source]

Currently, Yocto is the default distribution for the DAVE Embedded Systems' Linux kits. This is due to the fact that, in turn, the main semiconductor companies manufacturing the SOCs on which our products are based (NXP, Texas Instruments, Xilinx, etc.) chose to use the Ycoto build system.

The Yocto build system is extremely powerful but its learning curve may be quite steep. The Yocto-based MVMs are conceived in order to help the user to work with Yocto distribution on DAVE Embedded System's products. A deep understanding of the Yocto build system is beyond the scope of this documentation. In order to get more external resources related to this topic, please refer to the Ycoto category.

The typical development/deployment process for an embedded Linux system basically consists of two stages:

  • editing/building/debugging code: during this stage, the target is connected via Ethernet LAN to host machine and is configured to
    • Retrieve binary images (i.e. Linux kernel) via TFTP protocol
    • Mount the development root file system via NFS protocol. This root file system is physically in the file system of the host machine as depicted here.
  • deployment: the goal of this stage is to configure the target for normal operation, that is out of the development environment. A target root file system - optimized in terms of memory footprint - is used. This root file system is stored on target's non-volatile memory.

To implement this workflow, MVM provides

  • TFTP server with /tftpboot as root directory [1]
  • NFS server configured to export /home on 192.168.0.0/24 network without root squash. [1]
  • target't development root file systems in /home/dvdk/<target_name>/rfs/<kit_name>
  • cross-tool chain
  • Yocto SDK for cross-building (/home/dvdk/<target_name>/sdk/<kit_name>/sysroots/
    • by default, cross-tool chain is installed in /home/dvdk/<targetname>/sdk/latest. <targetname> is the name of the actual hardware platform (i.e. lynx, axelulite etc.).
  • target-specific sources
    • U-Boot bootloader
    • Linux kernel
  • Eclipse/ADT integrated development environment.

Part of these resources was generated by the Yocto build system, as depicted in the following picture.


Simplified flow of Yocto-based building process


The Yocto-related resources included in the MVM allows the developer to:

  • Build U-Boot SPL/U-Boot individually
  • Build the Linux kernel individually
  • Build the user application upon the Yocto SDK
  • Build the Yocto BSP image, including the U-Boot, the Linux kernel, and the target root file system
  • Use a pre-built root file system image
  • Install on the target pre-built additional packages.

These build processes make use of a pre-built cross-toolchain. To use it, the shell environment has to be set up properly first. To do this, just issue the following command:

source /home/dvdk/env.sh


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 the specific documentation of your kit related to the advanced use of Yocto build system.


[1] For more details about TFTP and NFS servers on host side, please refer to this page.

Building Yocto BSP images including the U-Boot, the Linux kernel, and the target root file system[edit | edit source]

As known, Linux needs a root file system to operate: a 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/.

In general, the kit supports several root file system images. These images are generated by the BSP build process along with the U-Boot binary file and the Linux kernel image.

The typical root file system images available are the following:

  • <target_name>-image or <target_name>-core-image
    • This is a minimal image that can be used as starting point for the production file system.
  • <target_name>-image-networking
    • This is like the minimal image with the addition of the most common packages used to implement networking applications.
  • <target_name>-image-devel
    • This is an image that includes a rich set of packages convenient for the development stage. Usually, the memory footprint of this image is significantly greater than the other ones.

MVM includes one (or more) pre-built images. They are located here: /home/dvdk/<target_name>/rfs/<kit_name>. Kit specific documentation describes how to build such images.

The development kits that are based on Yocto are also released along with 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 the specific documentation of your kit to have more information about the use of this tool.

For each supported target root file system image, there is an associated SDK. The pre-built SDKs included in the MVM are located here: /home/dvdk/<target_name>/sdk. The specific documentation of your kit indicates how to generate the SDKs.

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

Building U-Boot and Linux kernel without Yocto build system[edit | edit source]

In some cases, it is convenient to build the U-Boot and/or the Linux kernel without invoking the Yocto build system.

For detailed instructions on how to build the U-Boot and the Linux kernel this way, please refer to the specific documentation of your kit.

By default, the source files are installed in the following directories:

  • U-Boot: /home/dvdk/<target_name>/u-boot
  • Linux kernel: /home/dvdk/<target_name>/linux
  • MVM: /home/dvdk/<target_name>/mvm/.

U-Boot and Linux sources were retrieved from public git repositories, during the creation process of the MVM. Again, the specific documentation of your kit indicates the addresses of these repositories.


200px-Emblem-important.svg.png

Please note that access to DAVE Embedded Systems' git repositories is granted to development kit's owners only. Please refer to this page for detailed instructions on how to get access.


These sources 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).