Difference between revisions of "Template:Building the Yocto BSP"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
 
(One intermediate revision by the same user not shown)
Line 64: Line 64:
 
''{{{kit-repo}}}'' 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>{{{kit-repo}}}-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>.
 
''{{{kit-repo}}}'' 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>{{{kit-repo}}}-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, DAVE 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_(''{{{kit-repo}}}'')#Using_pre-built_package_archive|this section]] for more details.
+
Besides the pre-built root file systems, DAVE also provides a rich repository containing pre-built applications and libraries. These packages can be easily installed on the target by using the <code>apt-get</code> tool. Please refer to [[DESK-MX8M-AN-0001:_Package_Management_with_apt-get | this application note]] 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.
 
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.
Line 73: Line 74:
 
{{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.}}
  
{{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 [[Advanced_use_of_Yocto_build_system_(''{{{kit-repo}}}'')|this document]] which talks about the advanced use of the Yocto build system.}}
+
{{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 the [https://www.nxp.com/docs/en/supporting-information/L5.15.71_2.2.0_LINUX_DOCS.zip NXP documentation on this BSP], i.e. the ''i.MX Yocto Project User's Guide'', which talks about the host setup for the Yocto build system.}}
  
 
==== Initialize the build environment ====
 
==== Initialize the build environment ====
 +
Check that the following packages are install:
 +
 +
<pre class="workstation-terminal">
 +
dvdk@vagrant:~$ sudo apt-get update && sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool
 +
</pre>
 +
 
Before running the build, the environment must be initialized properly.
 
Before running the build, the environment must be initialized properly.
  
 
''{{{kit-repo}}}'' 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:
 
''{{{kit-repo}}}'' 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@vagrant:~$ mkdir -p ~/desk-mx-l/yocto
 +
dvdk@vagrant:~$ cd ~/desk-mx-l/yocto
 +
dvdk@vagrant:~/desk-mx-l/yocto$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo-1 > repo
 +
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
 +
                                Dload  Upload  Total  Spent    Left  Speed
 +
100 29945  100 29945    0    0  64816      0 --:--:-- --:--:-- --:--:-- 64676
 +
dvdk@vagrant:~/desk-mx-l/yocto$ chmod a+x repo
 +
</pre>
 +
 +
then, fetch the Yocto repositories with the proper branch:
 +
 +
<pre class="workstation-terminal">
 +
dvdk@vagrant:~/desk-mx-l/yocto$ ./repo init -u git@git.dave.eu:desk-mx-l/desk-mx-l-bsp.git -b refs/tags/desk-mx8m-l-4.0.0
 +
dvdk@vagrant:~/desk-mx-l/yocto$ ./repo sync -c
 +
</pre>
 +
 +
==== Initialize DISTRO and MACHINE ====
 +
Select the Weston backend (you will be asked to accept the EULA):
 +
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/{{{kit-repo}}}$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
+
dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx8mp source desk-setup-release.sh -b build-wayland
dvdk@vagrant:~/{{{kit-repo}}}$ chmod a+x repo
+
...
dvdk@vagrant:~/{{{kit-repo}}}$ ./repo init -u git@git.dave.eu:{{{kit-repo}}}/{{{kit-repo}}}-bsp.git -b {{{kit-repo}}}-''TBD''
+
Do you accept the EULA you just read? (y/n) y                                                                 
dvdk@vagrant:~/{{{kit-repo}}}$ ./repo sync
+
EULA has been accepted.                                                                                               
dvdk@vagrant:~/{{{kit-repo}}}$ source {{{kit-repo}}}-bsp-init-env.sh
+
                                                                                                                     
 +
Welcome to Freescale Community BSP
 +
...
 +
dvdk@vagrant:~/desk-mx-l/yocto/build-wayland$
 
</pre>
 
</pre>
  

Latest revision as of 15:18, 16 January 2024

History
Issue Date Notes

Year/Month/Day

TBD
Year/Month/Day TBD



Building the Yocto BSP[edit source]

Quick reference[edit source]

Repository Information
Repository BSP Manifest Yocto BSP Layer
URL git@git.dave.eu:{{{kit-repo}}}/{{{kit-repo}}}-bsp.git git@git.dave.eu:{{{kit-repo}}}/meta-{{{kit-repo}}}.git
stable branch {{{kit-repo}}}-TBD TBD (e.g. Yocto version)
stable tag {{{kit-repo}}}-1.x.x {{{kit-repo}}}-1.x.x
Build targets
Name Description
{{{kit-repo}}}-image Minimal image
{{{kit-repo}}}-image-devel This image include tools for development/debugging
{{{kit-repo}}}-image-networking In addition {{{kit-repo}}}-image-devel, this image provides several networking tools

Introduction[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/.

{{{kit-repo}}} 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 {{{kit-repo}}}-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, DAVE also provides a rich repository containing pre-built applications and libraries. These packages can be easily installed on the target by using the apt-get tool. Please refer to this application note 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 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[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.


200px-Emblem-important.svg.png

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 the NXP documentation on this BSP, i.e. the i.MX Yocto Project User's Guide, which talks about the host setup for the Yocto build system.

Initialize the build environment[edit source]

Check that the following packages are install:

dvdk@vagrant:~$ sudo apt-get update && sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool

Before running the build, the environment must be initialized properly.

{{{kit-repo}}} Yocto BSP uses git-repo tool to fetch all the required git repositories. To install it, please use the following commands:

dvdk@vagrant:~$ mkdir -p ~/desk-mx-l/yocto
dvdk@vagrant:~$ cd ~/desk-mx-l/yocto
dvdk@vagrant:~/desk-mx-l/yocto$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo-1 > repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 29945  100 29945    0     0  64816      0 --:--:-- --:--:-- --:--:-- 64676
dvdk@vagrant:~/desk-mx-l/yocto$ chmod a+x repo

then, fetch the Yocto repositories with the proper branch:

dvdk@vagrant:~/desk-mx-l/yocto$ ./repo init -u git@git.dave.eu:desk-mx-l/desk-mx-l-bsp.git -b refs/tags/desk-mx8m-l-4.0.0
dvdk@vagrant:~/desk-mx-l/yocto$ ./repo sync -c

Initialize DISTRO and MACHINE[edit source]

Select the Weston backend (you will be asked to accept the EULA):

dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx8mp source desk-setup-release.sh -b build-wayland
...
Do you accept the EULA you just read? (y/n) y                                                                   
EULA has been accepted.                                                                                                
                                                                                                                       
Welcome to Freescale Community BSP
...
dvdk@vagrant:~/desk-mx-l/yocto/build-wayland$

Running the build[edit source]

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:

dvdk@vagrant:~/{{{kit-repo}}}/build$ bitbake <target-image-name>

Where <target-image-name> is one of the images listed in 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 build/tmp/deploy/images/{{{kit-repo}}}.

Generating the SDKs[edit source]

After creating an image as described in the previous version, the corresponding SDK can be generated by issuing the following command:

bitbake <target-image-name> -c populate-sdk

Again, replace <target-image-name> with one of the images listed in here.

Building additional packages[edit source]

To build additional packages the user must first enter the directory where the {{{kit-repo}}}-bsp-init-env.sh is placed and source it

dvdk@vagrant:~/{{{kit-repo}}}$ source {{{kit-repo}}}-bsp-init-env.sh
dvdk@vagrant:~/{{{kit-repo}}}/build$

And then can run any of the bitbake command.

dvdk@vagrant:~/{{{kit-repo}}}/build$ bitbake memtester

The resulting packages (the default format is ipk) can be found inside build/tmp/deploy/rpm.

TBD: nomi dei package pertinenti con il SOC

dvdk@vagrant:~/{{{kit-repo}}}/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



[[Category:{{{nome-som}}}]]