Production Programming for Linux
Introduction
This article goes 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.
The usage of the Easy Installer tool as a resource to achieve this goal has 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.
The most usual ways to accomplish production programming are the following:
- Automatically install images using external storage devices such as SD cards and USB sticks.
- Unattended installation over Ethernet for SoMs with no available external storage devices.
Automatic Installation
With Easy installer, you can set up OS images to be flashed to the module automatically and unattended. The following steps describe how to enable an automatic installation in your OS image:
- On your PC/Laptop, download the tarball file of the image you want to automatically install.
- Untar that file. Within the image folder, locate the
image.json
file and open it. - Edit the
autoinstall
property to enable automatic installation:image.json- "autoinstall": false,
+ "autoinstall": true, - Remove the license property to bypass the acceptance check. Note: This will automatically accept all licenses in the image.image.json
- "license":"general license"
- Copy the entire image folder to a USB stick.
Your image is now ready to be automatically installed:
- Put your module into Recovery Mode and load Easy Installer.
- While your device is running Easy Installer, plug in your USB stick.
- The image should start automatically installing itself since you set the
autoinstall
property.
Any image can carry the autoinstall
property. If multiple regular images have the property set to true
, the outcome will depend on the order in which images get processed. Because there is no guaranteed order, use a storage device with only one image having the autoinstall
property set to true
.
Unattended flashing Over the 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). Combined with the autoinstall
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 storage device attached to your SoM, you should configure the URL searched by the device to match the server you are providing. If a storage device is unavailable, you can utilize a workaround with DNS.
Another way is using the TorizonCore Builder command images serve
, which lets you serve (via HTTP) Torizon OS images from a directory on your host machine. Any device within the same network running Toradex Easy Installer can view this list of images and install them. Combined with images that have the autoinstall
property enabled, it allows unattended flashing over Ethernet. For detailed information about this command, see TorizonCore Builder commands manual.
Legacy Methods
Using the Toradex Easy Installer is the most straightforward way to flash an image to SoMs both during the development and production phases.
However, if your module doesn't support it, the Legacy Methods should be used instead.
Legacy flashing methods do not imply that the embedded Linux image is legacy.
If possible you should use Toradex Easy Installer and not these 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 setting 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 set up 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 a 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: