Open main menu

DAVE Developer's Wiki β

Difference between revisions of "DESK-MX9-L/Development/Building the Yocto BSP"

< DESK-MX9-L
(How to build the Yocto BSP images including the U-Boot binary file, the Linux kernel image, and the target root file system image)
 
(5 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|2024/01/xx
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|2024/01/31
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK-MX9-L release
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|DESK-MX9-L-5.0.0 release
 +
|-
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |2024/04/09
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX9-L-5.1.0 release
 
|-
 
|-
 
|}
 
|}
Line 33: Line 36:
 
|-
 
|-
 
! stable tag
 
! stable tag
| desk-mx9-l-5.0.0
+
| desk-mx9-l-5.1.0
| desk-mx9-l-5.0.0
+
| desk-mx9-l-5.1.0
 
|}
 
|}
  
Line 70: Line 73:
  
 
==== 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.
Line 90: Line 88:
  
 
<pre class="workstation-terminal">
 
<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-mx9-l-5.0.0
+
dvdk@vagrant:~/desk-mx-l/yocto$ python3 ./repo init -u git@git.dave.eu:desk-mx-l/desk-mx-l-bsp.git -b refs/tags/desk-mx9-l-5.1.0
dvdk@vagrant:~/desk-mx-l/yocto$ ./repo sync
+
dvdk@vagrant:~/desk-mx-l/yocto$ python3 ./repo sync
 
</pre>
 
</pre>
  
Line 98: Line 96:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx9 source desk-setup-release.sh -b build-wayland
+
dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx93-rev1 source desk-setup-release.sh -b build-wayland
 
...
 
...
 
Do you accept the EULA you just read? (y/n) y                                                                   
 
Do you accept the EULA you just read? (y/n) y                                                                   
Line 109: Line 107:
  
 
==== Running the build ====
 
==== Running the build ====
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:  
+
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 50GiB 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
 
* 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).
 
* 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).
Line 119: Line 117:
 
Where <code><target-image-name></code> is one of the images listed in [[#Quick reference|here]].
 
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/desk-mx9-l-5.0.0</code>.
+
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/desk-mx39</code>.
  
 
====Generating the SDKs====
 
====Generating the SDKs====
Line 127: Line 125:
 
</pre>
 
</pre>
 
Again, replace <code><target-image-name></code> with one of the images listed in [[#Quick reference|here]].
 
Again, replace <code><target-image-name></code> with one of the images listed in [[#Quick reference|here]].
 +
 +
====Generating the Toolchain====
 +
Toolchain can be created by the following command:
 +
 +
<pre class="workstation-terminal">
 +
bitbake meta-toolchain
 +
</pre>
 +
  
 
==== Building additional packages ====
 
==== Building additional packages ====
  
To build additional packages the user must first enter the directory where the <code>desk-mx9-l-5.0.0-bsp-init-env.sh</code> is placed and source it
+
To build additional packages the user must select the ''DISTRO'' and source the <code>desk-setup-release.sh</code> script
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/yocto$ source desk-mx-l/yocto-bsp-init-env.sh
+
dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx93-rev1 source desk-setup-release.sh -b build-wayland
dvdk@vagrant:~/desk-mx-l/yocto/build$
+
dvdk@vagrant:~/desk-mx-l/yocto/build-wayland$
 
</pre>
 
</pre>
  
Line 143: Line 149:
 
</pre>
 
</pre>
  
The resulting packages (the default format is <code>deb</code>) can be found inside ''tmp/deploy/rpm/images/desk-mx9-l-5.0.0''.
+
The resulting packages (the default format is <code>deb</code>) can be found inside ''tmp/deploy/rpm/images/desk-mx93-l-5.0.0''.
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/yocto/build$ ls -l tmp/deploy/images/desk-mx9-l-5.0.0/armv8a/memtester*
+
dvdk@vagrant:~/yocto/build-wayland$ ls -l tmp/deploy/deb/armv8a/memtester*
-rw-r--r-- 1 dvdk dvdk 10692 Sep 12 16:05 tmp/deploy/images/desk-mx9-l-5.0.0/armv8a/memtester_4.5.1-r0_arm64.deb
+
-rw-r--r-- 2 dvdk dvdk 7548 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester_4.6.0-r0_arm64.deb
-rw-r--r-- 1 dvdk dvdk 27693 Sep 12 16:05 tmp/deploy/images/desk-mx9-l-5.0.0/armv8a/memtester-dbg-4.5.1-r0_arm64.deb
+
-rw-r--r-- 2 dvdk dvdk 21956 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-dbg_4.6.0-r0_arm64.deb
-rw-r--r-- 1 dvdk dvdk  2872 Sep 12 16:05 tmp/deploy/images/desk-mx9-l-5.0.0/armv8a/memtester-dev-4.5.1-r0_arm64.deb
+
-rw-r--r-- 2 dvdk dvdk  876 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-dev_4.6.0-r0_arm64.deb
-rw-r--r-- 1 dvdk dvdk  5903 Sep 12 16:05 tmp/deploy/images/desk-mx9-l-5.0.0/armv8a/memtester-doc-4.5.1-r0_arm64.deb
+
-rw-r--r-- 2 dvdk dvdk  3072 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-doc_4.6.0-r0_arm64.deb
 +
-rw-r--r-- 2 dvdk dvdk  6672 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-src_4.6.0-r0_arm64.deb
 
</pre>
 
</pre>
  

Latest revision as of 12:46, 12 April 2024

History
Issue Date Notes
2024/01/31 DESK-MX9-L-5.0.0 release
2024/04/09 DESK-MX9-L-5.1.0 release



Contents

Building the Yocto BSPEdit

Quick referenceEdit

Repository Information
Repository BSP Manifest Yocto BSP Layer
URL git@git.dave.eu:desk-mx-l/desk-mx-l-bsp.git git@git.dave.eu:desk-mx-l/meta-desk-mx.git
stable branch desk-mx9-l-5.x.x desk-mx9-l-5.x.x
stable tag desk-mx9-l-5.1.0 desk-mx9-l-5.1.0
Build targets
Name Description
dave-image-devel This image include tools for development/debugging
desk-image-qt6 This image include a Qt6 graphic backend on Wayland compositor

IntroductionEdit

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

DESK-MX9-L 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 desk-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 imageEdit

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.


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 environmentEdit

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

DESK-MX9-L 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 > repo
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$ python3 ./repo init -u git@git.dave.eu:desk-mx-l/desk-mx-l-bsp.git -b refs/tags/desk-mx9-l-5.1.0
dvdk@vagrant:~/desk-mx-l/yocto$ python3 ./repo sync

Initialize DISTRO and MACHINEEdit

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

dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx93-rev1 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 buildEdit

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 50GiB 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:~/desk-mx-l/yocto/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/desk-mx39.

Generating the SDKsEdit

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.

Generating the ToolchainEdit

Toolchain can be created by the following command:

bitbake meta-toolchain


Building additional packagesEdit

To build additional packages the user must select the DISTRO and source the desk-setup-release.sh script

dvdk@vagrant:~/desk-mx-l/yocto$ DISTRO=fsl-imx-wayland MACHINE=desk-mx93-rev1 source desk-setup-release.sh -b build-wayland
dvdk@vagrant:~/desk-mx-l/yocto/build-wayland$

And then can run any of the bitbake command.

dvdk@vagrant:~/desk-mx-l/yocto/build$ bitbake memtester

The resulting packages (the default format is deb) can be found inside tmp/deploy/rpm/images/desk-mx93-l-5.0.0.

dvdk@vagrant:~/yocto/build-wayland$ ls -l tmp/deploy/deb/armv8a/memtester*
-rw-r--r-- 2 dvdk dvdk  7548 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester_4.6.0-r0_arm64.deb
-rw-r--r-- 2 dvdk dvdk 21956 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-dbg_4.6.0-r0_arm64.deb
-rw-r--r-- 2 dvdk dvdk   876 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-dev_4.6.0-r0_arm64.deb
-rw-r--r-- 2 dvdk dvdk  3072 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-doc_4.6.0-r0_arm64.deb
-rw-r--r-- 2 dvdk dvdk  6672 Jan 28 13:54 tmp/deploy/deb/armv8a/memtester-src_4.6.0-r0_arm64.deb