Difference between revisions of "Build system (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
(Setting up the Linux development server environment)
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
{{Applies To BoraLite}}
 
{{Applies To BoraLite}}
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
{{ImportantMessage|text=As the structure of the BELK/BXELK is based on several tools, it is strongly recommended the reading of [[Logical_structure_of_Bora_and_BoraX_Embedded_Linux_Kits_(BELK/BXELK)|this document]] and [[Introduction_to_development_environment_(BELK/BXELK)|this document]] first.
+
{{ImportantMessage|text=As the structure of the BELK/BXELK is based on several tools, it is strongly recommended the reading of [[BORA_SOM/BELK-L/General/Logical_structure_of_BELK|this document]] and [[BORA_SOM/BELK-L/Development/Introduction_to_the_development_environment|this document]] first.
 
}}
 
}}
  
Line 40: Line 40:
 
In the following section, we will refer to the system running the Xilinx tools (that can be either a Microsoft Windows machine or a GNU/Linux machine) as the "Zynq development server", and to the machine running the GNU/Linux tools as the "Linux development server".
 
In the following section, we will refer to the system running the Xilinx tools (that can be either a Microsoft Windows machine or a GNU/Linux machine) as the "Zynq development server", and to the machine running the GNU/Linux tools as the "Linux development server".
  
As described [[Logical_structure_of_Bora_and_BoraX_Embedded_Linux_Kits_(BELK/BXELK)|here]], the structure of the BELK/BXELK has changed over the years. That's why the istructions here indicated may differ according to the kit version.
+
As described [[BORA_SOM/BELK-L/General/Logical_structure_of_BELK|here]], the structure of the BELK/BXELK has changed over the years. That's why the istructions here indicated may differ according to the kit version.
  
 
==Setting up the Zynq development server environment==
 
==Setting up the Zynq development server environment==
Line 78: Line 78:
  
  
As described [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|here]], MVM includes the resources—in terms of network services, cross-toolchain, etc.—to implement the development host shown [[Introduction_to_development_environment_(BELK/BXELK)#Overview|here]].
+
As described [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|here]], MVM includes the resources—in terms of network services, cross-toolchain, etc.—to implement the development host shown [[BORA_SOM/BELK-L/Development/Introduction_to_the_development_environment|here]].
  
  
Line 85: Line 85:
  
 
====Building the Yocto BSP image and the associated SDKs====
 
====Building the Yocto BSP image and the associated SDKs====
The Yocto BSP image includes the U-Boot binary, the Linux kernel image, and the target root file system. For more information about how to build it and how to build the associated SDKs, please refer to [[Building the Yocto BSP (BELK/BXELK)|this page]].
+
The Yocto BSP image includes the U-Boot binary, the Linux kernel image, and the target root file system. For more information about how to build it and how to build the associated SDKs, please refer to [[BORA_SOM/BELK-L/Development/Building_the_Yocto_BSP|this page]].
  
 
====Building the U-Boot and the Linux kernel individually====
 
====Building the U-Boot and the Linux kernel individually====
Line 91: Line 91:
  
 
Please refer to the following links for the specific instructions describing these operations:
 
Please refer to the following links for the specific instructions describing these operations:
*[[Building U-Boot (BELK/BXELK)]]
+
*[[BORA_SOM/BELK-L/Development/Building_U-Boot | Building U-Boot]]
*[[Building Linux kernel (BELK/BXELK)]]
+
*[[BORA_SOM/BELK-L/Development/Building_Linux_kernel | Building Linux kernel]]
  
 
====C/C++ application development and debugging====
 
====C/C++ application development and debugging====
Line 149: Line 149:
 
*when you cross-compile, rely on static linking and avoid dynamic linking against the root file system libraries
 
*when you cross-compile, rely on static linking and avoid dynamic linking against the root file system libraries
 
*build your application using the same cross-toolchain (when available) used for building the root file system
 
*build your application using the same cross-toolchain (when available) used for building the root file system
Please refer to [[Introduction_to_developing_environment_(BELK)#Target_root_file_system|this page]] and  [[FAQs_(Bora)#Q:_Why_my_cross-compiled_application_doesn.27t_work_with_the_pre-packaged_root_file_system_provided_with_BELK.3F|this FAQ]] for further details.
+
Please refer to [[BORA_SOM/BELK-L/Development/Introduction_to_the_development_environment#Target_root_file_system|this page]] and  [[FAQs_(Bora)#Q:_Why_my_cross-compiled_application_doesn.27t_work_with_the_pre-packaged_root_file_system_provided_with_BELK.3F|this FAQ]] for further details.
  
 
====U-Boot, Linux kernel and Yocto BSP git repositories====
 
====U-Boot, Linux kernel and Yocto BSP git repositories====

Latest revision as of 15:14, 23 November 2021

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress
BORALite-TOP.png Applies to BORA Lite
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 and this document first.

History[edit | edit source]

Version Date BELK version Notes
1.0.0 November 2015 3.0.0 First release
1.0.1 December 2016 3.0.0 Updated information about git repositories access
2.0.0 July 2017 3.0.0, 4.0.0 Updates for BELK 4.0.0/BXELK 2.0.0


Build system[edit | edit source]

A build system is a set of tools, source trees, Makefiles, patches, configuration files and scripts that make it easy to generate all the components of a complete embedded Linux system. A build system, once properly set up, automates the configuration and cross-compilation processes, generating all the required targets (userspace packages such as libraries and programs, the o.s. kernel, the bootloader and root filesystem images) depending on the configuration. In particular, using an integrated build system prevents from problems caused by misaligned toolchains, since a unique toolchain is used to build all the software components, including the customer application. Some well known structured build systems are the following:

In the following section, we will refer to the system running the Xilinx tools (that can be either a Microsoft Windows machine or a GNU/Linux machine) as the "Zynq development server", and to the machine running the GNU/Linux tools as the "Linux development server".

As described here, the structure of the BELK/BXELK has changed over the years. That's why the istructions here indicated may differ according to the kit version.

Setting up the Zynq development server environment[edit | edit source]

The following software packages must be installed on the Zynq development server:

  • Vivado® Design Suite version 2017.1 (for BELK 4.0.0 or newer, BXELK 2.0.0 or newer)
  • Vivado® Design Suite version 2014.4 (for BELK version up to 3.0.2, BXELK version up to 1.0.1)
  • Xilinx Software Development kit (same version as the Vivado® Design Suite)
  • Python 2.7.x (C:\Python27 must be the installation directory on Windows)
  • A Git tool (e.g. for Windows: MsysGit http://msysgit.github.io/).

The Zynq 7000 development tools can be downloaded from the Xilinx website: http://www.xilinx.com/support/download/index.htm in the WebPACK™ Edition, which is a free version that provides instant access to the fundamental Vivado features and functionality at no cost. For the hardware requirements of the PC, please refer to http://www.xilinx.com/design-tools/vivado/memory.htm#zynq-7000. The Git tool is used to download the BORA/BORAX project files for Vivado from DAVE Embedded Systems' public git repositories, as described in the next section.

N.B. Sometimes the download of the Vivado 2014.4 full package fails because of some download system malfunctioning, but the problem is barely noticeable, except by performing the MD5 check of the downloaded file. In case of problems, we suggest using the Multi-File Download (available on the same web page), that splits the full package in a collection of smaller files. If you use the Multi-File Download to get the "Vivado (No SDK)" package, you must also download the "Software Development Kit - 2014.4" package.

How BORA/BORAX project files are managed[edit | edit source]

Since a Vivado project for the Zynq device is composed of a lot of files (including temporary and GUI-managed files), providing the BORA project files with the BELK is not considered as an efficient and user-friendly solution, for two main reasons:

  • we should provide a compressed archive for each version (updates, new features, bug fixes) of the project, wasting storage space and download bandwidth, introducing redundancy and complicating file management
  • there is no version control, which means that it's not possible to track changes to the project files, making development and release management complicated and error-prone

The best solution to these problems is that we create and maintain a Git repository to store and track only the main files of the Vivado project. Therefore, the developer can clone the repository and keep it in sync with our modifications. The following diagram shows how the solution works:

git-based Vivado project management

BELK also provides the tools for keeping the files modified within the Vivado tools in sync with the local Git repository: with this solution, all the modifications are tracked and developers can take advantage of all the benefits of using git as a version control system.

The public git repository for BORA/Zynq project files is git@git.dave.eu:dave/bora/bora.git. Please note that BELK distribution provides the git archive of the .git directory of the repository, so the user can immediately get access to the development tree (please refer to section Using the pre-packaged git archive).

Setting up the Linux development server environment[edit | edit source]

During development, the software developer needs to interact with the target system. This section describes the tools that must be installed and configured on the Linux host system for this purpose.

BELK 4.0.0 or newer, BXELK 2.0.0 or newer[edit | edit source]

Thanks to the use of the Managed Virtual Machine (MVM) (the Basic version), the process of setting up the Linux development server is dramatically simplified with respect to the previous versions of the kit. To put it simply, MVM is a virtual machine containing all the tools required for the development of the software running on the target. To install it, please refer to this page.


200px-Emblem-important.svg.png

If you purchased a previous version of the kit and want to upgrade it, it is necessary to download the MVM image first. For more details, please contact our Sales Department.


As described here, MVM includes the resources—in terms of network services, cross-toolchain, etc.—to implement the development host shown here.


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.

Building the Yocto BSP image and the associated SDKs[edit | edit source]

The Yocto BSP image includes the U-Boot binary, the Linux kernel image, and the target root file system. For more information about how to build it and how to build the associated SDKs, please refer to this page.

Building the U-Boot and the Linux kernel individually[edit | edit source]

The U-Boot and the Linux kernel are typically built without invoking the Yocto build system.

Please refer to the following links for the specific instructions describing these operations:

C/C++ application development and debugging[edit | edit source]

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

BELK version up to 3.0.2, BXELK version up to 1.0.1[edit | edit source]

Since various heterogeneous tools are required to build the software components for the BORA/BORAX SOM, BELK/BXELK does not provide a fully structured build system. In particular, the Xilinx Zynq 7000 development tools are required to configure the system and build the FSBL, while the standard GNU tools are required to build U-Boot, kernel and user-space applications.


During development, user needs to interact with the target system. This section describes the tools that must be installed and configured on the Linux host system for this purpose.

TFTP Server[edit | edit source]

One of the most useful features of a bootloader during development is the capability to download the Linux kernel from the network. This saves a lot of time because developer doesn't have to program the image in flash every time he/she modifies it. U-Boot implements the TFTP protocol (see the tftp command), so the host system must be configured to enable the TFTP service. Installation and configuration of a TFTP server depends on the host Linux distribution.

NFS Server[edit | edit source]

One of the most important components of a Linux system is the root file system. A good development root file system provides the developer with all the useful tools that can help him/her on his/her work. Such a root file system can become very big in size, so it's hard to store it in flash memory. User could split the file system in different parts, mounting them from different media (flash, network, USB...). But the most convenient thing is to mount the whole root file system from the network, allowing the host system and the target to share the same files. In this way, the developer can quickly modify the root file system, even “on the fly” (meaning that the file system can be modified while the system is running).

The most common way to setup a system like the one described is by the use of network file system (NFS). Installation and configuration of NFS service on host machine depends on the Linux distribution. Here is described the procedure for some common distributions.

Pre-built toolchain[edit | edit source]

To start developing software for the BORA/BORAX platform, users need a proper toolchain, which can be pre-built or built-from-scratch. Building a toolchain from scratch is not a trivial task, even though using a recent build system is easier than in the past. So the recommended approach consists of using a pre-built toolchain.

Instructions for BELK 4.0.0 or newer and BXELK 2.0.0 or newer[edit | edit source]

The Managed Virtual Machine (MVM) delivered along with these versions of BELK/BXELK provides a script which can be used to set up the build environment easily. Use the following command to do that:

dvdk@vagrant-ubuntu-trusty-64:~$ cd
dvdk@vagrant-ubuntu-trusty-64:~$ source env.sh 
Instructions for BELK <= 3.0.2 and BXELK <= 1.0.1[edit | edit source]

The toolchain used as a reference for these versions of BELK/BXELK is the toolchain provided with the Xilinx SDK (usually installed into /opt/Xilinx/SDK/<Vivado_version>/gnu/arm/lin/bin). Once the toolchain is installed, it is convenient to create a bash script containing the following lines in order to set up the build environment quickly:

export PATH=<path_to_toolchain>:$PATH
export ARCH=arm
export CROSS_COMPILE=<toolchain_prefix>

For example, for the Vivado 2014.4 release, the variables are the following:

export PATH=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-xilinx-linux-gnueabi-

Once the such a script is created (for example env.sh), it can be invoked like this:

source env.sh

Pre-built root file system[edit | edit source]

Linux needs a root file system: a root file system must contain everything needed to support the Linux system (applications, settings, data, ..). 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 provides a pre-built root file system, that can be used during the evaluation/development phase, since it provides a rich set of packages for working with the BORA platform. Since this pre-built root file system is not generated using the same cross-toolchain used for building the BELK software components, we recommend to choose one of the following options:

  • if a native compiler is available on the root file system, go for native compilation instead of cross-compilation
  • when you cross-compile, rely on static linking and avoid dynamic linking against the root file system libraries
  • build your application using the same cross-toolchain (when available) used for building the root file system

Please refer to this page and this FAQ for further details.

U-Boot, Linux kernel and Yocto BSP git repositories[edit | edit source]

BELK/BXELK source trees for U-Boot, Linux kernel and Yocto BSP are provided as git repositories, as detailed in the following table.

Component Remote git repository
U-Boot git@git.dave.eu:dave/bora/u-boot-xlnx.git
Linux kernel git@git.dave.eu:dave/bora/linux-xlnx.git
Yocto BSP git@git.dave.eu:dave/bora/bora-bsp.git

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.

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

Using the pre-packaged git archive (BELK <= 3.0.0 only)[edit | edit source]

BELK distribution provides (on request) the tar-gzipped archive of the .git directory of the repositories, so the user can immediately get access to the development trees (for example this is used when corporate security policies don't allow to use the git protocol).

Uncompressing the archive enables access to the hidden .git directories of the repositories; to get the source files, the developer must enter the project directory (eg: bora/linux-xlnx.git) and launch the git checkout <bora current branch> command, like in the following examples:

  • For u-boot: git checkout bora
  • For linux: git checkout bora

Once these steps are completed, don't forget to update the repositories, as described in this section.