Custom Software Deployment with EMAC OE
There are many considerations to take into account when deploying software. This guide was written to provide guidance regarding the decisions relevant to deployment on EMAC OE systems.
File Locations
Program Files
Configuration Files
Temporary Files
Test Versions of Programs
Keeping the Root Filesystem Read-Only
Filesystem Considerations
Choosing a Filesystem for a Data Partition
Using Removable Flash for Data Storage
Preparing a Filesystem for a Snapshot
Manufacturing Boards with a Filesystem Image
Other Considerations
Launching Software Automatically on Boot
When software is created for an embedded system, it is often required for the software to start when the machine boots. The best approach to meeting this requirement is to use the robust initialization system which is part of the Linux filesystem. Configuring the initialization system to launch an application is performed by creating a simple script, placing it in the correct spot in the filesystem, then creating appropriate symbolic links to the script.
For information on creating the initialization scripts, see EMAC_OE_Boot_Process_Customization.
Automatically Sending Code to a Machine
During the development process, development versions of software will typically be sent to a machine many times. An IDE will perform this task automatically as part of the build process. An IDE may also be able to send additional files to the machine, such as configuration and data files, automatically as part of a customized build process.
When developing software without an IDE, the process of sending software to a machine can still be automated. The sshpass
program can be used to automate entry of a password to ssh
and related tools, such as scp
. For instance, the following command would send the file, myprogram
, to the board located at 10.0.1.20 and store it in the /usr/local/bin
directory on that machine:
user@ldc:~$ sshpass -p 'emac_inc' scp myprogram root@10.0.1.20:/usr/local/bin/
The following command would then execute myprogram
:
user@ldc:~$ sshpass -p 'emac_inc' ssh -l root 10.0.1.20 "/usr/local/bin/myprogram"
Here, the password is passed to sshpass
as a commandline argument. Since this means it's possible for the password to show up in the output of a command like ps
, there are other, more secure options as well. The sshpass
command can also take the password from any of the following sources: a file, an open file descriptor, or a shell environment variable. Please see the manual for sshpass
for more information.
Note that the sshpass
command usually needs to be installed with the package manager of a Linux distribution. On Ubuntu, it can be installed with this command:
user@ldc:~$ sudo apt-get install sshpass
For other distributions, consult the packages available with your package manager.
Deployment Tips
Here is a checklist of issues which need to be addressed prior to deployment:
-
Does the board boot into the desired state, reliably and repeatedly?
-
Have the ssh keys been removed?
-
Can the image of the filesystem be put on a different machine (with a different MAC address) than the development machine, and boot into the desired state reliably and repeatedly?