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

From DAVE Developer's Wiki
Jump to: navigation, search
(git protocol error)
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{WorkInProgress}}
 
{{InfoBoxTop}}
 
{{InfoBoxTop}}
 
{{Applies To Bora}}
 
{{Applies To Bora}}
 
{{Applies To BoraX}}
 
{{Applies To BoraX}}
{{Applies To BoraLite}}
 
{{Applies To Yocto}}
 
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
  
{{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]] first to get an overview.
+
{{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]] first to get an overview.
 
}}
 
}}
  
  
{{ImportantMessage|text=As the BELK/BXELK kit is based on Yocto, the implementation of the MVM follows the approach described [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|here]]. As such, the reading of [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|this section]] is highly recommended.
+
{{ImportantMessage|text=As the XUELK kit is based on Yocto, the implementation of the MVM follows the approach described [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|here]]. As such, the reading of [[Managed_Virtual_Machine_(MVM)#Yocto-based_Linux_distribution|this section]] is highly recommended.
 
}}
 
}}
  
Line 19: Line 18:
 
}}
 
}}
  
 
+
==Introduction==
<section begin=BELK/>
 
 
 
 
 
==Building the Yocto BSP==
 
 
 
===Quick reference===
 
{| class="wikitable" border="1"
 
|+Repository Information
 
|-
 
! Repository
 
| BSP Manifest
 
| Yocto BSP Layer
 
|-
 
! URL
 
| git@git.dave.eu:bora/bora-bsp.git
 
| git@git.dave.eu:bora/meta-bora.git
 
|-
 
! stable branch
 
| bora-morty
 
| bora-morty
 
|-
 
! stable tag
 
| belk-4.1.4
 
| belk-4.1.4
 
|}
 
 
 
{| class="wikitable" border="1"
 
|+Build targets
 
! Name
 
! Description
 
|-
 
| dave-image-devel
 
| This image include tools for development/debugging
 
|-
 
| dave-image-networking
 
| In addition <code>dave-image-devel</code>, this image provides several networking tools
 
|}
 
 
 
 
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 <code>/sbin/init</code>, the first user space process and "father" of all the other processes.
 
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 <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/.
 
For more information on the Linux filesystem, please refer to http://www.thegeekstuff.com/2010/09/linux-file-system-structure/.
Line 63: Line 24:
 
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 <code>bora-image-devel</code>  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: <code>/home/dvdk/<target_name>/rfs/<kit_name></code>.
 
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 <code>bora-image-devel</code>  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: <code>/home/dvdk/<target_name>/rfs/<kit_name></code>.
  
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 <code>smart</code> tool. Please refer to [[BORA_SOM/BELK-L/Development/Advanced_use_of_Yocto_build_system#Using_pre-built_package_archive|this section]] for more details.
+
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 <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.
 
 
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 [[:Category:Yocto|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==
 
 
===How to build the Yocto BSP images including the U-Boot binary file, the Linux kernel image, and the target root file system image===
 
 
{{ImportantMessage|text=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 [[Accessing_DAVE_Embedded_Systems_restricted_git_repositories|this page]] for detailed instructions on how to get it.}}
 
{{ImportantMessage|text=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 [[Accessing_DAVE_Embedded_Systems_restricted_git_repositories|this page]] for detailed instructions on how to get it.}}
  
 
+
The generic procedure to generate the Yocto BSP image is the following:
{{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 [[BORA_SOM/BELK-L/Development/Advanced_use_of_Yocto_build_system|this document]] which talks about the advanced use of the Yocto build system.}}
+
<pre class="board-terminal">
 
+
dvdk@dvdk-vm:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
==== Initialize the build environment ====
 
Before running the build, the environment must be initialized properly.
 
 
 
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">
 
dvdk@dvdk-vm:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo-1 > repo
 
 
dvdk@dvdk-vm:~/belk$ chmod a+x 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 init -u git@git.dave.eu:bora/bora-bsp.git -b bora-morty
 
dvdk@dvdk-vm:~/belk$ ./repo sync
 
dvdk@dvdk-vm:~/belk$ ./repo sync
 
dvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.sh
 
dvdk@dvdk-vm:~/belk$ source bora-bsp-init-env.sh
 +
dvdk@dvdk-vm:~/belk/build$ bitbake <target-image-name>
 
</pre>
 
</pre>
 +
bora-image
 +
bora-image-devel
 +
bora-image-networking
  
===== unauthenticated git protocol error =====
+
The components listed in the table above can be kept in sync and up to date with DAVE Embedded Systems' repositories.
{{ImportantMessage|text=Since March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.
+
Once the git account has been enabled, the developer can:
The deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.<br>For more details on this topic, please refer to [[MISC-TN-015:_Yocto_and_git_protocol_error|this Technical Note]].}}
+
*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).
  
==== Running the build ====
+
{{ImportantMessage|text=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 [[Advanced_use_of_Yocto_build_system_(BELK/BXELK)|this page]].
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:
 
<pre class="workstation-terminal">
 
dvdk@dvdk-vm:~/belk/build$ bitbake <target-image-name>
 
</pre>
 
Where <code><target-image-name></code> is one of the images listed in [[#Quick reference|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 <code>build/tmp/deploy/images/bora</code>.
 
  
====Generating the SDKs====
+
The following table lists the pre-built root file systems included in the MVM.
After creating an image as described in the previous version, the corresponding SDK can be generated by issuing the following command:
+
{| class="wikitable" border="1"
<pre class="workstation-terminal">
+
!Kit version<br>BELK<br>BXELK
bitbake <target-image-name> -c populate-sdk
+
!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>
 
</pre>
Again, replace <code><target-image-name></code> with one of the images listed in [[#Quick reference|here]].
+
|<code>/home/dvdk/bora/rfs/belk-4.0.0</code>
 
+
|-
=== Building additional packages ===
+
|<code>bora-image-networking</code>
 
+
|<pre>
To build additional packages the user must first enter the directory where the <code>bora-bsp-init-env.sh</code> is placed and source it
+
dvdk@dvdk-vm:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
 
+
dvdk@dvdk-vm:~/belk$ chmod a+x repo
<pre class="workstation-terminal">
+
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$ source bora-bsp-init-env.sh
dvdk@dvdk-vm:~/belk/build$
+
dvdk@dvdk-vm:~/belk/build$ bitbake bora-image-networking
 
</pre>
 
</pre>
 +
|<code>/home/dvdk/bora/rfs/belk-4.0.0</code>
 +
|-
 +
|}
  
And then can run any of the [http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#usingpoky-components-bitbake bitbake] command.
 
  
<pre class="workstation-terminal">
+
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.
dvdk@dvdk-vm:~/belk/build$ bitbake memtester
+
{| class="wikitable" border="1"
 +
!Kit version<br>BELK<br>BXELK
 +
!SDK name
 +
!Build commands
 +
!Path
 +
|-
 +
|rowspan="3"|<br>4.0.0<br>2.0.0
 +
|<code>bora-image</code>
 +
|<pre>
 +
bitbake bora-image -c populate-sdk
 
</pre>
 
</pre>
 +
|<code>/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi</code>
 +
|-
 +
|<code>bora-image-devel</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>
 +
|-
 +
|<code>bora-image-networking</code>
 +
|<pre>
 +
bitbake bora-image-networking -c populate-sdk
 +
</pre>
 +
|<code>/home/dvdk/bora/sdk/belk-4.0.0/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi</code>
 +
|-
 +
|}
  
The resulting packages (the default format is ipk) can be found inside ''build/tmp/deploy/rpm''.
 
  
<pre class="workstation-terminal">
+
About C/C++ application development and debugging, please refer to [[Debugging_with_Eclipse_(MVM)|this page]].
dvdk@dvdk-vm:~/belk/build$ ls -l tmp/deploy/rpm/cortexa9hf_neon/memtester*
 
-rw-r--r-- 1 dvdk dvdk 10692 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-4.3.0-r0.cortexa9hf_neon.rpm
 
-rw-r--r-- 1 dvdk dvdk 27693 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-dbg-4.3.0-r0.cortexa9hf_neon.rpm
 
-rw-r--r-- 1 dvdk dvdk  2872 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-dev-4.3.0-r0.cortexa9hf_neon.rpm
 
-rw-r--r-- 1 dvdk dvdk  5903 Sep 12 16:05 tmp/deploy/rpm/cortexa9hf_neon/memtester-doc-4.3.0-r0.cortexa9hf_neon.rpm
 
</pre>
 
<section end=BELK/>
 

Revision as of 07:26, 12 September 2017

WorkInProgress.gif

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.

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.

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.

The generic procedure to generate the Yocto BSP image is the following:

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>

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. 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 root file systems included in the MVM.

Kit version
BELK
BXELK
Image name Build commands Path

4.0.0
2.0.0
bora-image
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
/home/dvdk/bora/rfs/belk-4.0.0
bora-image-devel
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
/home/dvdk/bora/rfs/belk-4.0.0
bora-image-networking
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
/home/dvdk/bora/rfs/belk-4.0.0


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.