Search by Tags

Production Programming for Linux

 

Article updated at 14 Jul 2022
Compare with Revision






Remember that you can always refer to the Easy Installer Documentation, there you can find a lot of relevant articles that might help you in the process of load and flashing an image on your module.

Introduction

This article will go over the best practices on how to prepare your Linux-based product for production.
It aims to present details on how to install your software into multiple devices, using the most common recommended methods. If you have a specific use case that does not fit into our recommended methods feel free to contact Toradex to discuss it further.

It also includes general information on how to prepare your software for production programming. You can learn how Torizon simplifies this process in our Production Programming in Torizon article.

Production Programming

Production programming refers to the at-scale methods and processes used to program multiple modules with your product’s unique software. It’s important to have a reliable and consistent method for this, as any issues at this stage will be scaled depending on how much product you ship.

Toradex Easy Installer

Toradex Easy Installer (Tezi) is a standard tool provided by Toradex. It is provided pre-installed in the CoMs and contains several features and is the recommended way to flash your image.

The Toradex Easy Installer application runs completely in memory so that the complete internal flash can be erased, (re-)partitioned, formatted, or written to. The image to be flashed can be obtained over the Internet (via Ethernet), from a USB Flash Drive or an SD card.

With Tezi, it's possible to either load one of Toradex's available images (from our Toradex Download Links (Torizon, Linux BSP, WinCE and Partner Demos)) or use your own build.

The usage of the Easy Installer tool as a resource to achieve this goal have important advantages to highlight:

  • Toradex makes sure that Tezi works and maintains compatibility with older images, so even if the modules are updated the production programming shouldn’t be affected.
  • Production programming via Tezi is the easiest way to ensure that there won’t be any problems when versions change.

Note: Please note that not every module is compatible with the Toradex Easy Installer. A list of compatible modules can be found on Toradex Easy Installer - Load Toradex Easy Installer.

Note: Currently, Toradex needs to update the installed version of Easy Installer on the devices because of hardware changes that are needed to keep the products alive.

For more information visit the Toradex Easy Installer Documentation, more specifically:

  • Detailed Manual - As mentioned before, here you will find useful information in order to configure your image for automatic installation, and you will also find detailed instructions for creating your local image server for Easy Installer.
  • Loading Toradex Easy Installer - If you have already flashed an OS into your Computer-on-Module, you can follow the steps to reload it into the RAM of the module, so you can flash it with the desired image.
  • Configuration Files - Here you will find a description of what are the possible configuration options for the Easy Installer image installation process.

Generating Tezi Compatible Image

To flash an image via Toradex Easy Installer, it is necessary to generate a Tezi-compatible image. The links below offer some guidance on how to generate, customize and build an image using Yocto Project and TorizonCore Builder tool.

Regarding the usage of Yocto Project to build an image, you can read the following articles:

Regarding the usage of TorizonCore Builder tool, you can go to the following articles to discover how to customize a TorizonCore reference image.

Also, if you don't want to use either TorizonCore Builder or Yocto, you can build from source code using the workflow described in the Build U-Boot and Linux Kernel from Source Code article.

Production Programming with Toradex Easy Installer

The most usual ways to accomplish production programming are:

So, after all, the objective of this section is to expose and explain some of those features that can be used to help with it.

Automatic Installation

Auto installation is very useful for production programming. To automatically install an image, the image can be marked as auto-install image using the autoinstall property in the image.json file. If that property is set to true the image will be flashed to the module automatically and unattended. To set this property as true, go to the image.json file in the image folder and change the line as follows:

---  "autoinstall": false,
+++  "autoinstall": true,

Any image can carry the autoinstall property, so, if multiple regular images have the property set to true the outcome will depend on the order of how images get processed. Because there is no guaranteed order, it is recommended to only use one local media with only one image having the autoinstall property set to true.

Let's do a quick example of how to proceed with an image auto installation. The first step, as described before, is to set the autoinstall property as true on the image.json file.

{
    "config_format": "4",
    "autoinstall": true,
    "name": "Toradex Embedded Linux Reference Multimedia Image",
    "description": "Image for BSP verification with QT and multimedia features",
    "version": "5.6.0+build.18",
    "release_date": "2022-03-30",
    "u_boot_env": "u-boot-initial-env-sd",
    "prepare_script": "prepare.sh",
    "wrapup_script": "wrapup.sh",
    "marketing": "marketing.tar",
    "icon": "toradexlinux.png",
    "license": "LA_OPT_NXP_SW.html",
    ...
}

The next step is to put the image to be written on the external media. Usually, the image comes in tarball files. So, extract the *.tar into the external media (SD Card, USB stick). For example, for a Reference Multimedia Image for Apalis i.MX8:

$ tar -xf ~/Apalis-iMX8_Reference-Multimedia-Image-Tezi_5.6.0+build.18.tar
$ cp ~/Apalis-iMX8_Reference-Multimedia-Image-Tezi_5.6.0+build.18 /media/<mounted-usb>

The third step is to boot the module, wait for Tezi to install the image and after that, reboot the board.

Unattended flashing over Ethernet

The Toradex Easy Installer can be used to flash images from an HTTP web server.

It is possible to provide the image, from the host PC, through a web server (e.g. Nginx). Together with the auto-install feature, the image is flashed as soon as the module connects to the local network and identifies the webserver.

To host the image, you can follow the steps provided for Unattended Flashing over Ethernet.

If you have a local media available on your device, you should configure the URL searched by the device to match the server you are providing.

If a local media is unavailable, you can utilize a workaround with DNS.

Another way is using TorizonCore Builder command images serve. This lets you serve (via HTTP) TorizonCore images from a directory on your host machine. Any device running Toradex Easy Installer within the same network can then see this list of images and install one. Combined with images that have the auto-install property enabled this would allow for unattended flashing over Ethernet. Proper usage of this command can be seen in detail in the TorizonCore Builder commands manual.

Legacy Methods

Using the Toradex Easy Installer is the most straightforward way to flash an image to a module, in development or production.

However, if your module doesn't support it, the Legacy Method must be used instead.

Note: Legacy flashing method does not imply that the embedded Linux image is legacy. Warning: If possible you should use Toradex Easy Installer and not this legacy methods. In newer images, the legacy methods won't be available anymore.

It is possible to flash either through Ethernet or from an SD Card/USB Drive.

The following methods are suited for both development and production.

TFTP/NFS for automated flashing over Ethernet

  • An important article to read beforehand is How to Setup Networking for Embedded Linux Application Development. It explains the general concept, as well as sets up the TFTP/NFS server on your host computer to serve the client (module).

  • On a development environment, the Boot From a TFTP/NFS server article provides detailed information on how to setup U-Boot to boot from a server hosted on your development PC for rapid and dynamic prototyping.

  • Then, on the production environment, the Flashing Linux Over Ethernet article provides information on how to flash images from a TFTP server running on your local machine.

Using SD Card/USB Drive

This method uses bash script to flash the image from a USB drive or SD Card to a module. Instructions are specific to each SoC, the following links provide more information regarding each one: