Changes

Jump to: navigation, search

Build system (BELK/BXELK)

4,879 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==
==Setting up the Linux development server environment==
During development, user 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===
Thanks to the use of the [[File:Belk-yoctoManaged 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.png|thumb|center|600pxTo install it, please refer to [[VirtualBox_Starting_DVDK_Virtual_Machine#Using_a_.ova_file|Simplified flow of Yocto-based building processthis page]].
{{ImportantMessage|text=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 [mailto:sales@dave.eu Sales Department].
}}
====TFTP Server====
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 <code>tftp</code> 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====
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 As described is by [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|here]], MVM includes the use resources—in terms of network file system (NFS)services, cross-toolchain, etc. Installation and configuration of NFS service on —to implement the development host machine depends on the Linux distribution. shown [[Setting_up_tftp_and_nfsBORA_SOM/BELK-L/Development/Introduction_to_the_development_environment|Herehere]] is described the procedure for some common distributions.
====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 (though using a recent build system is easier than in the past), so the recommended approach consists in using a pre-built toolchain.
The toolchain used as a reference for '''BELK <= 3.0.2''' and '''BXELK <{{ImportantMessage|text= 1.0.1''' is As the toolchain provided with the Xilinx SDK (usually installed into <code>/opt/Xilinx/SDK/<Vivado_version>/gnu/arm/lin/bin</code>).Once the toolchain XUELK kit is installed, create a a bash script (<code>env.sh</code>) containing the following lines: <pre>export PATH=<path_to_toolchain>:$PATHexport ARCH=armexport CROSS_COMPILE=<toolchain_prefix></pre>For example, for the Vivado 2014.4 release, the variables are the following:<pre>export PATH=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin:$PATHexport ARCH=armexport CROSS_COMPILE=arm-xilinx-linux-gnueabi-</pre>Use the following command to set up the environment shell variables required during the building procedure:<pre>source env.sh</pre> The toolchain used as a reference for '''BELK-4.0.0''' and '''BXELK-2.0.0''' is builded using based on Yocto build system. Once the toolchain is installed, create a a bash script (<code>env.sh</code>) containing the following lines: <pre>source <path_to_toolchain>/environment-setup-cortexa9hf-neon-xilinx-linux-gnueabiexport CC=gcc# clear LDFLAGS variable otherwise u-boot reports linker errorsunset LDFLAGS</pre>For example, for implementation of the BELK-4.0.0/BXELK-2.0.0 MVM release, the variables are the following:<pre># BELK/BXELK development environment for u-boot/kernel development source /home/dvdk/bora/sdk/latest/environment-setup-cortexa9hf-neon-xilinx-linux-gnueabiexport CC=gcc# clear LDFLAGS variable otherwise u-boot reports linker errorsunset LDFLAGS</pre>Use the following command to set up the environment shell variables required during the building procedure:<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.For more information on follows 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 systemPlease refer to approach described [[Introduction_to_developing_environment_Managed_Virtual_Machine_(BELKMVM)#Target_root_file_systemYocto-based_Linux_distribution|this pagehere]] and . As such, the reading of [[FAQs_Managed_Virtual_Machine_(BoraMVM)#Q:_Why_my_crossYocto-compiled_application_doesn.27t_work_with_the_pre-packaged_root_file_system_provided_with_BELK.3Fbased_Linux_distribution|this FAQsection]] for further detailsis highly recommended====U-Boot, Linux kernel and Yocto BSP git repositories====BELK/BXELK source trees for U-Boot, Linux kernel and Yocto BSP are provided as git repositories, as detailed in the following table.{| 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 ====Building the table above can be kept in sync Yocto BSP image and up to date with DAVE Embedded Systems' repositories.the associated SDKs====One The Yocto BSP image includes the git account has been enabledU-Boot binary, the developer can:*clone the repository with the <code>git clone <git_remote_repository></code> command *synchronize a source tree entering the repository directory Linux kernel image, 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'' processtarget root file system. For further more information on Gitabout how to build it and how to build the associated SDKs, please refer to the official Git Documentation (http:[[BORA_SOM/BELK-L/git-scm.comDevelopment/documentation)Building_the_Yocto_BSP|this page]].
====Using Building the preU-packaged git archive (BELK <= 3.0.0 only)Boot and the Linux kernel individually====BELK distribution provides (on request) the tarThe U-gzipped archive of the .git directory of the repositories, so the user can immediately get access to Boot and the development trees (for example this is used when corporate security policies don't allow to use Linux kernel are typically built without invoking the git protocol)Yocto build system.
Uncompressing the archive enables access Please refer to the hidden <code>.git</code> directories of following links for the repositories; to get the source files, the developer must enter the project directory (egspecific instructions describing these operations: <code>bora*[[BORA_SOM/linuxBELK-xlnx.git<L/code>) and launch the <code>git checkout <bora current branch><Development/code> command, like in the following examples:*For uBuilding_U-Boot | Building U-boot: <code>git checkout bora</code>Boot]]*For linux: <code>git checkout bora</code>Once these steps are completed, <u>don't forget to update the repositories</u>, as described in [[#UBORA_SOM/BELK-Boot and L/Development/Building_Linux_kernel | Building Linux git repositories|this sectionkernel]].
====C/C++ application development and debugging====
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===
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====
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 <code>tftp</code> 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====
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. [[Setting_up_tftp_and_nfs|Here]] is described the procedure for some common distributions.
====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.
For more information on the Linux filesystem, please refer to http://www.thegeekstuff.com/2010/09/linux-file-system-structure/.
*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====
BELK/BXELK source trees for U-Boot, Linux kernel and Yocto BSP are provided as git repositories, as detailed in the following table.
{| class="wikitable" border="1"
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.
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).
====Using the pre-packaged git archive (BELK <= 3.0.0 only)====
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).
*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