Changes

Jump to: navigation, search

Build system (BELK/BXELK)

3,454 bytes removed, 15:14, 23 November 2021
Setting up the Linux development server environment
{{Applies To Bora}}
{{Applies To BoraX}}
{{Applies To BoraLite}}
{{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_(BORA_SOM/BELK-L/General/BXELK)Logical_structure_of_BELK|this document]] and [[Introduction_to_development_environment_(BORA_SOM/BELK-L/Development/BXELK)Introduction_to_the_development_environment|this document]] first.
}}
|}
<section begin=BELK/>=Introduction=Build system==
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:
*OpenEmbedded (http://wiki.openembedded.net/index.php/Main_Page)
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_(BORA_SOM/BELK-L/BXELK)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 accoording according to the kit version.
==Setting up the Zynq development server environment==
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 [[VirtualBox_Starting_DVDK_Virtual_Machine#Using_a_.ova_file|this page]].
As described [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution{{ImportantMessage|here]]text=If you purchased a previous version of the kit and want to upgrade it, it is necessary to download the MVM includes the resources—in terms of network servicesimage first. For more details, cross-toolchain, etcplease contact our [mailto:sales@dave.—to implement the development host shown [[Introduction_to_development_environment_(BELK/BXELK)#Overview|hereeu Sales Department]]. Part of these resources was generated by the Yocto build system, as depicted in the following picture.}}
[[File:Belk-yocto.png|thumb|center|600px|Simplified flow of Yocto-based building process]]
 
 
The Yocto-related resources included in the MVM provided with the kit allows the developer to:
*Build U-Boot SPL/U-Boot separately
*Build the Linux kernel separately
*Build user application upon the Yocto SDK
*Use a pre-built root file system image
*Install on the target pre-built additional packages.
 
The build processes mentioned above 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:
<pre>
source /home/dvdk/env.sh
</pre>
For detailed instructions on how to build U-Boot and the Linux kernel, please refer to As described [[Building_U-Boot_Managed_Virtual_Machine_(BELK/BXELKMVM)#Yocto-based_Linux_distribution|this pagehere]] and , MVM includes the resources—in terms of network services, cross-toolchain, etc.—to implement the development host shown [[Building_Linux_kernel_(BORA_SOM/BELK-L/Development/BXELK)Introduction_to_the_development_environment|this pagehere]].
By default, the sources are installed in the following directories:
*U-Boot: <code>/home/dvdk/<target_name>/u-boot</code>
*Linux kernel: <code>/home/dvdk/<target_name>/linux</code>
*MVM: <code>/home/dvdk/<target_name>/mvm/</code>.
U-Boot and Linux sources were retrieved from public git repositories:
{| class="wikitable" border="1"
!Component
!Remote git repository
|-
|U-Boot
|<code>git@git.dave.eu:dave/bora/u-boot-xlnx.git</code>
|-
|Linux kernel
|<code>git@git.dave.eu:dave/bora/linux-xlnx.git</code>
|-
|Yocto BSP
|<code>git@git.dave.eu:dave/bora/bora-bsp.git</code>
|-
|}
Access to DAVE Embedded Systems' git repositories is granted to development kit's owners only. Please refer to [[Accessing_DAVE_Embedded_Systems_restricted_git_repositories|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 <code>git clone <git_remote_repository></code> command *synchronize a source tree entering the repository directory and launching the <code>git fetch origin</code> command.Please note that git fetch doesn't merge the commits on the current branch. To do that, the developer should run the <code>git merge</code> command or replace the ''fetch-merge'' process with a single <code>git pull</code> 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). {{ImportantMessage|text=Technically speaking, As the developer can run a XUELK kit is based on Yocto-based full build process to (re)generate all , the pre-built objects includes in implementation of 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 follows the approach described [[Managed_Virtual_Machine_(MVM to perform )#Yocto-based_Linux_distribution|here]]. As such build. Using a physical machine is recommended instead. For more details on this, please refer to the reading of [[Advanced_use_of_Yocto_build_system_Managed_Virtual_Machine_(BELK/BXELKMVM)#Yocto-based_Linux_distribution|this pagesection]]is highly recommended.
}}
====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 [[BORA_SOM/BELK-L/Development/Building_the_Yocto_BSP|this page]].
As known, Linux needs a root file system to operate: a root file system must contain everything needed to support ====Building the Linux system (applications, settings, data, ..). The root file system is the file system that is contained on the same partition on which U-Boot and 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 individually====The U-Boot and finally launches the <code>/sbin/init</code>, 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-kernel are typically built root file system, that can be used during without invoking the evaluation/development phase since it provides a relatively rich set of packages for working with the BORA platform. This root file Yocto build system is located here: <code>/home/dvdk/<target_name>/rfs/<kit_name></code>. 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 <code>smart</code> tool. Please refer to [[Advanced_use_of_Yocto_build_system_(BELK/BXELK)#Using_pre-built_package_archive|this section]] for more details.
The Please refer to the following table lists links for 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|-|<br>4.0.0<br>2.0.0|<code>bora-image-devel</code>|<pre>dvdk@dvdk-vm:~/belk$ curl httpspecific instructions describing these operations://commondatastorage.googleapis.com/git-repo-downloads/repo > repodvdk@dvdk-vm:~*[[BORA_SOM/belk$ chmod a+x repodvdk@dvdkBELK-vm:~L/belk$ .Development/repo init Building_U-u git@git.dave.eu:bora/boraBoot | Building U-bsp.git -b bora-mortyBoot]]dvdk@dvdk-vm:~*[[BORA_SOM/belk$ ./repo syncdvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.shdvdk@dvdkBELK-vm:~/belk/build$ bitbake bora-image-devel</pre>|<code>/homeL/dvdkDevelopment/bora/rfs/belk-4.0.0</code>|-Building_Linux_kernel |}Building Linux kernel]]
 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.{| class="wikitable" border="1"!Kit version<br>BELK<br>BXELK!SDK name!Build commands!Path|-|<br>4.0.0<br>2.0.0|<code>bora-image-devel<==C/code>|<pre>bitbake bora-image-devel -c populate-sdk</pre>|<code>/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi</code>|-|} C++ application development and debugging====About For C/C++ application development and debugging, please refer to [[Debugging_with_Eclipse_(MVM)|this page]].
===BELK version up to 3.0.2, BXELK version up to 1.0.1===
====Pre-built toolchain====
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 . So the recommended approach consists in of using a pre-built toolchain.
=====Instructions for BELK 4.0.0 or newer and BXELK 2.0.0 or newer=====The [[Managed_Virtual_Machine_(MVM)|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:<pre>dvdk@vagrant-ubuntu-trusty-64:~$ cddvdk@vagrant-ubuntu-trusty-64:~$ source env.sh </pre> =====Instructions for BELK <= 3.0.2 and BXELK <= 1.0.1===== The toolchain used as a reference for these versions of BELK /BXELK is the toolchain provided with the Xilinx SDK (usually installed into <code>/opt/Xilinx/SDK/<Vivado_version>/gnu/arm/lin/bin</code>).Once the toolchain is installed, it is convenient to create a a bash script (<code>env.sh</code>) containing the following linesin order to set up the build environment quickly:
<pre>
export PATH=<path_to_toolchain>:$PATH
export CROSS_COMPILE=<toolchain_prefix>
</pre>
 
For example, for the Vivado 2014.4 release, the variables are the following:
<pre>
export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
</pre>
Use Once the following command to set up the environment shell variables required during the building proceduresuch a script is created (for example <code>env.sh</code>), it can be invoked like this:<pre>source env.sh</pre> 
====Pre-built root file system====
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 <code>/sbin/init</code>, the first user space process and "father" of all the other processes.
*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 [[Introduction_to_developing_environment_(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====
The components listed in the table above can be kept in sync and up to date with DAVE Embedded Systems' repositories.
One Once the git account has been enabled, the developer can:
*clone the repository with the <code>git clone <git_remote_repository></code> command
*synchronize a source tree entering the repository directory and launching the <code>git fetch origin</code> command.
*For linux: <code>git checkout bora</code>
Once these steps are completed, <u>don't forget to update the repositories</u>, as described in [[#U-Boot and Linux git repositories|this section]].
<section end=BELK/>
8,154
edits

Navigation menu