Search by Tags

Image Customization With the Yocto Project/OpenEmbedded

 

Your progress

 

Overview

In the previous lesson from this guide, you have installed a pre-built Multimedia Reference Image. You have also explored it and ran some of the included packages.

In this lesson, you will focus on customizing this image using the Yocto Project/OpenEmbedded. Most of the steps will walk you through more comprehensive examples and some degree of effort is expected.

In this module you will:

  • Build the Reference Multimedia Image from source using Yocto Project/OpenEmbedded.
  • Learn the basics on how to customize the Reference Multimedia Image.
  • Generate your own custom image with a hello world application.
Typographic Conventions

Current Support State

The Verdin iMX8M Plus has been released on April 2021. As of this date, the software support for this Computer on Module is in an early stage of development and a few features are currently a work-in-progress:

Our teams are working at a fast pace to bring all of those features to you in the next weeks. To follow-up on the latest status, you can:

Prerequisites

For this Quickstart Guide:

For this lesson:

Step 1

Setup the Yocto Project environment for the Toradex BSP Layers and Reference Images for Yocto Project, as described on:

In summary, you will:

  • Clone all metadata using the repo tool.
  • Export the environment setup script.
  • Configure verdin-imx8mp as the machine in conf/local.conf.
  • Accept the NXP EULA in conf/local.conf.

Step 2

Add the following line to conf/local.conf, as explained on How to setup environment for Embedded Linux application development - Eclipse IDE:

PACKAGECONFIG_remove_pn-dropbear = " disable-weak-ciphers"

Skipping this step will prevent you to use the Eclipse IDE debugging in the next lessons of this guide.

Step 3

Run the bitbake command to start building the Multimedia Reference Image as provided by Toradex, with all defaults and no customization. This will download around 80GB of source-code and the download and build process together might take several hours, depending on your internet speed and your PC specs:

$ bitbake tdx-reference-multimedia-image

The good news is that the source-code is only downloaded and built for the first time you run bitbake. Moving forward, it will only incrementally download and build things you add to the image. Go ahead and see it for yourself, running the above command again.

Step 4

Find your installable image files - the wic.bmap and the wic.gz - under the build directory on deploy/images/verdin-imx8mp:

$ ls -lh deploy/images/verdin-imx8mp | grep wic
lrwxrwxrwx 2 pokyuser pokyuser   56 Mar 18 00:38 Reference-Multimedia-Image-verdin-imx8mp.wic.bmap -> Verdin-iMX8MP_Reference-Multimedia-Image.rootfs.wic.bmap
lrwxrwxrwx 2 pokyuser pokyuser   54 Mar 18 00:38 Reference-Multimedia-Image-verdin-imx8mp.wic.gz -> Verdin-iMX8MP_Reference-Multimedia-Image.rootfs.wic.gz
-rw-r--r-- 2 pokyuser pokyuser 4.1K Mar 18 00:38 Verdin-iMX8MP_Reference-Multimedia-Image.rootfs.wic.bmap
-rw-r--r-- 2 pokyuser pokyuser 322M Mar 18 00:38 Verdin-iMX8MP_Reference-Multimedia-Image.rootfs.wic.gz

Step 5

Create a custom layer where you will keep your own application and customization:

Step 6

Inside your new layer, create a hello-world recipe:

Build your hello-world:

$ bitbake hello-world

Step 7

Add the hello-world package to an existing image:

Then re-build the Reference Multimedia Image:

$ bitbake tdx-reference-multimedia-image

While using the conf/local.conf file for quick customization and prototyping can be handy, you must keep in mind that this file does not reside inside your previously created layer and is not included in the version control system - as git, for instance.

Step 8

As preparation for the next step, remove the hello-world from conf/local.conf. You will create your own image, so let's avoid using the conf/local.conf method to install packages.

Step 9

Create your own image, based on the Reference Multimedia Image, and add the hello-world package to it. Use the following resource as a starting point:

The example above does not explain exactly what you have to do and it may be challenging. Once you have given a few tries, look at one of the possible solutions below:

Custom multimedia hello-world image

Build the image, for example, if you have named it custom-multimedia-hello-image.bb:

$ bitbake custom-multimedia-hello-image

Step 10

Install the custom image to the board. If you don't remember how to do it, go back to the previous lesson from this guide.

Once the image is installed, on the Linux terminal, run your hello-world application:

# hello-world

Takeaway

This lesson hints to you that creating your own custom image with the Yocto Project/OpenEmbedded is very important. Here are some reasons:

  • The Toradex Reference Images, as the name implies, are just reference images, and they must be customized before deployed in production.
  • Your layer and recipes serve as documentation to your project, especially if you use software like Git.
  • You optimize the use of flash and RAM memory, and boot faster, by removing unnecessary software.

It takes time to get used to the Yocto Project. To achieve your goals, you will most likely only learn a subset of it. Toradex offers as an alternative Torizon, the easy-to-use industrial Linux software platform - and Verdin iMX8M Plus will be supported in the next weeks. See a high-level comparison between using Yocto and Torizon.

As additional resources for Yocto, you can watch the following webinars:

And, as comprehensive as it can be, you can read or search the Yocto Project Documentation and the Yocto Project Wiki. Start from the beginning, for instance by reading What I wish I’d known about Yocto Project.

FAQ

Where do I learn more about the Yocto Project and OpenEmbedded?