Difference between revisions of "iMX8M Industrial Yocto Image Building"

From Voipac Wiki
Jump to navigation Jump to search
(Created page with "Category:iMX8M Industrial Category:iMX8M Industrial Software Category:iMX8M Industrial Yocto Category:Yocto <!-- --> <div style="float:right">__TOC__</div> Th...")
 
 
(37 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
<div style="float:right">__TOC__</div>
 
<div style="float:right">__TOC__</div>
  
This Wiki page guides thorugh the process of downloading the Yocto Project source files, preparing and building images for the iMX8M Industrial Development Kit.
+
This Wiki page guides through the process of downloading the Yocto Project source files for release 3.1 (dunfell), their synchronization and building images for the iMX8M Industrial Development Kit.
  
Before images can be built, [[iMX8M Industrial Yocto Prerequisities|neccesary steps need to be performed]] to setup the host machine.
+
Before images can be built, [[iMX8M Industrial Yocto Prerequisites|necessary steps need to be performed]] to setup the host machine.
  
  
All the source files for this customized Yocto Project together with the recent changes made can be inspected and downloaded at the [https://github.com/voipac Voipac GitHub] repository.
+
All the source files for this customized Yocto Project, together with the recent changes made, can be inspected and downloaded at the [https://github.com/voipac Voipac GitHub] repository.
 +
 
 +
== Cloning the project ==
 +
Create a new directory for the project environment:
 +
<syntaxhighlight lang="bash">
 +
mkdir ~/voipac-yocto
 +
cd ~/voipac-yocto
 +
</syntaxhighlight>
 +
 
 +
Clone the iMX8M Industrial Yocto Project into the host machine:
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/voipac/yocto-imx8m-voipac.git
 +
</syntaxhighlight>
 +
 
 +
== Building the image ==
 +
Voipac provides quick and simple-to-use option how to build an image by using [https://github.com/voipac/yocto-imx8m-voipac/blob/master/build_image.sh prepared script]:
 +
<syntaxhighlight lang="bash">
 +
#!/bin/bash
 +
 
 +
set -e
 +
 
 +
# Copy manifests helper function
 +
copy_manifests() {
 +
rm -rf .repo
 +
mkdir -p .repo/manifests
 +
cp scripts/voipac.xml .repo/manifests/
 +
}
 +
 
 +
# Fetch the latest meta layers
 +
if ! diff -q .repo/manifests/voipac.xml scripts/voipac.xml >/dev/null 2>&1; then
 +
        copy_manifests
 +
        repo init -u "$(pwd)"/.repo/repo -b default -m voipac.xml
 +
fi
 +
     
 +
repo sync --optimized-fetch
 +
 
 +
MACHINE=imx8mq-voipac DISTRO=fslc-xwayland source ./setup-environment build-voipac
 +
bitbake -f voipac-image
 +
</syntaxhighlight>
 +
 
 +
 
 +
This script automatically updates the latest meta layers. These layers include manifest files describing where all the sources are located. Afterwards all the directories are synchronized.
 +
 
 +
The second to last '' source'' command defines the machine for which the last command ''bitbake'' compiles and builds output binaries. Besides describing the specifics for iMX8M Industrial Development Kit, '''DISTRO''' provides several graphical interface options:
 +
* '''fsl-imx-wayland''': Wayland/Weston graphics
 +
* '''fsl-imx-xwayland''': Wayland graphics and X11
 +
* '''fsl-imx-fb''': framebuffer graphics (no Wayland or X11)
 +
 
 +
 
 +
The script can be run to fetch and build the Yocto images by simply calling its filename:
 +
<syntaxhighlight lang="bash">
 +
./build_image.sh
 +
</syntaxhighlight>
 +
 
 +
'''''Note:''''' Make sure that the synchronization finished without errors displaying the successful fetching with the following massage:
 +
<syntaxhighlight lang="bash">
 +
repo sync has finished successfully.
 +
</syntaxhighlight>
 +
 
 +
'''''Note:''''' The first successful build can take several hours (depending on multiple factors affecting the host machine like CPU, internet bandwidth, allocated disk space, etc.).
 +
 
 +
== Locating output files ==
 +
After the compiling process was completed, the freshly built output files are located in the directory:
 +
<syntaxhighlight lang="bash">
 +
cd ~/voipac-yocto/yocto-imx8m-voipac/build-voipac/tmp/deploy/images
 +
</syntaxhighlight>
 +
 
 +
This directory also include binaries to be flashed into the development kit. To make them more accessible, the files can be copied and unpacked:
 +
<syntaxhighlight lang="bash">
 +
cp -prv imx-boot ~/
 +
cp -prv voipac-image-imx8mq-voipac-20230512212054.rootfs.wic.gz ~/voipac-image-imx8mq-voipac.wic.gz
 +
gzip -d ~/voipac-image-imx8mq-voipac.wic.gz
 +
</syntaxhighlight>
 +
'''''Note:''''' The number string (e.g. ''20230512212054'') in the filename differs between every build as it displays the timestamp of the compilation.
 +
 
 +
== Flashing the binaries ==
 +
At this point everything was prepared to flash the binaries. Follow the [[iMX8M Industrial Flashing Procedure|flashing procedure]] instructions to start the development kit with the compiled images.

Latest revision as of 19:27, 11 December 2023

This Wiki page guides through the process of downloading the Yocto Project source files for release 3.1 (dunfell), their synchronization and building images for the iMX8M Industrial Development Kit.

Before images can be built, necessary steps need to be performed to setup the host machine.


All the source files for this customized Yocto Project, together with the recent changes made, can be inspected and downloaded at the Voipac GitHub repository.

Cloning the project

Create a new directory for the project environment:

mkdir ~/voipac-yocto
cd ~/voipac-yocto

Clone the iMX8M Industrial Yocto Project into the host machine:

git clone https://github.com/voipac/yocto-imx8m-voipac.git

Building the image

Voipac provides quick and simple-to-use option how to build an image by using prepared script:

#!/bin/bash

set -e

# Copy manifests helper function
copy_manifests() {
rm -rf .repo
mkdir -p .repo/manifests
cp scripts/voipac.xml .repo/manifests/
}

# Fetch the latest meta layers
if ! diff -q .repo/manifests/voipac.xml scripts/voipac.xml >/dev/null 2>&1; then
        copy_manifests
        repo init -u "$(pwd)"/.repo/repo -b default -m voipac.xml
fi
       
repo sync --optimized-fetch

MACHINE=imx8mq-voipac DISTRO=fslc-xwayland source ./setup-environment build-voipac
bitbake -f voipac-image


This script automatically updates the latest meta layers. These layers include manifest files describing where all the sources are located. Afterwards all the directories are synchronized.

The second to last source command defines the machine for which the last command bitbake compiles and builds output binaries. Besides describing the specifics for iMX8M Industrial Development Kit, DISTRO provides several graphical interface options:

  • fsl-imx-wayland: Wayland/Weston graphics
  • fsl-imx-xwayland: Wayland graphics and X11
  • fsl-imx-fb: framebuffer graphics (no Wayland or X11)


The script can be run to fetch and build the Yocto images by simply calling its filename:

./build_image.sh

Note: Make sure that the synchronization finished without errors displaying the successful fetching with the following massage:

repo sync has finished successfully.

Note: The first successful build can take several hours (depending on multiple factors affecting the host machine like CPU, internet bandwidth, allocated disk space, etc.).

Locating output files

After the compiling process was completed, the freshly built output files are located in the directory:

cd ~/voipac-yocto/yocto-imx8m-voipac/build-voipac/tmp/deploy/images

This directory also include binaries to be flashed into the development kit. To make them more accessible, the files can be copied and unpacked:

cp -prv imx-boot ~/
cp -prv voipac-image-imx8mq-voipac-20230512212054.rootfs.wic.gz ~/voipac-image-imx8mq-voipac.wic.gz
gzip -d ~/voipac-image-imx8mq-voipac.wic.gz

Note: The number string (e.g. 20230512212054) in the filename differs between every build as it displays the timestamp of the compilation.

Flashing the binaries

At this point everything was prepared to flash the binaries. Follow the flashing procedure instructions to start the development kit with the compiled images.