Upgrading mLinux

NOTE: This section describes upgrading mLinux locally on your device. This method uses opkg and local files. You need to use SCP or a flash drive to get the updates to the device.

The command /usr/sbin/mlinux-firmware-upgrade may be used to upgrade the firmware. The upgrade file should be placed in /var/volatile or one of its subdirectories. The command must be run as the root user.

There are two types of upgrade files. One type is created by the build named *upgrade*.bin and found in the deploy image directory of the build see:


Example image upgrade files:


Files with withboot in the name include the bootstrap and U-Boot partitions. Unless you are upgrading from mLinux 3 to mLinux 4, it is usually not necessary to update bootstrap or U-Boot.

Updating packages during a reboot

The second type of upgrade file does not do a complete firmware update. It updates packages using the opkg command. A package update only affects packages that are changed. Unlike an image update, most files are maintained.

The purpose of updating packages during a reboot is to provide greater resources (memory and temporary file space) for the upgrade. Very small upgrades to commands can be applied without rebooting using the opkg command and the feeds. See: http://www.multitech.net/mlinux/feeds

If you have initscripts 2.0-r155.43 (mLinux 4.0.0 or greater), it is possible to upgrade packages using mlinux-firmware-upgrade.

These scripts are found at http://www.multitech.net/mlinux/upgrade/[version] when available. The version pertains to the version where the fix applies.

Since these are not image updates, they may take longer to apply. They leave the configuration alone, except for the packages being updated. NOTE: Make sure that newly installed packages are correctly configured.

Creating an update package

See an update package example: http://multitech.net/mlinux/upgrades/example/

Carefully review the  initial list of packages and verify that they match the final list. Packages may be split or merged. In these cases a package may need to be removed or added, not
just updated. Packages may require other packages. So dependencies also need to be in the update package tree. An easy way to determine what packages are required is to use the mLinux feeds, http://www.multitech.net/mlinux/feeds/ with opkg. The file /etc/opkg/mlinux-feed.conf may need to be configured for the desired level of mLinux in the update.

The update package is a tar file containing IPK files and a shell script to initiate the update.


The final tree in this example looks as follows:
├── build.sh
├── install_list.txt.md5
├── install.sh
├── install.sh.md5
├── install.template
├── local.conf.md5
├── log.txt
├── model
├── remove_list.txt.md5
└── update-4.0.0

├── install_list.txt
├── install_list.txt.md5
├── local.conf
├── local.conf.md5
├── remove_list.txt
├── remove_list.txt.md5
└── repo

├── arm926ejste
│      ├── bluez5_5.47-m3.0_arm926ejste.ipk
│      ├── bluez5-noinst-tools_5.47-m3.0_arm926ejste.ipk
│      ├── bluez5-obex_5.47-m3.0_arm926ejste.ipk
│      ├── bluez5-pand_5.47-m3.0_arm926ejste.ipk
│      ├── bluez5-rfcomm_5.47-m3.0_arm926ejste.ipk
│      ├── bluez5-testtools_5.47-m3.0_arm926ejste.ipk
│      ├── libasound-module-bluez_5.47-m3.0_arm926ejste.ipk
│      ├── libmts-io0_1.0.8-r0.0_arm926ejste.ipk
│      ├── lora-network-server_2.0.19-r4.0_arm926ejste.ipk
│      ├── Packages
│      ├── Packages.gz
│      ├── Packages.stamps
│      ├── python-pybluez_0.22-r0.0_arm926ejste.ipk
│      └── python-terminal_2.7.12-r1.0_arm926ejste.ipk
├── mtcap
│      ├── mlinux-version_4.0.1_ea6ba1..2713b2-r2.0_mtcap.ipk
│      ├── mts-id-eeprom_0.3.8-r1.0.0_mtcap.ipk
│      ├── Packages
│      ├── Packages.gz
│      └── Packages.stamps
├── mtcdt
│      ├── mlinux-version_4.0.1_ea6ba1..2713b2-r2.0_mtcdt.ipk
│      ├── mts-id-eeprom_0.3.8-r1.0.0_mtcdt.ipk
│      ├── Packages
│      ├── Packages.gz
│      └── Packages.stamps
└── Packages

Generated Files

The files ending in ipk must be gathered from either a build, or the mLinux feeds found from the downloads page under Conduit: mLinux Model. The files ending in md5 are created by build.sh. The files that start with Packages* are created by the Yocto package-index operation. install.sh is created from install.template by the build.sh script.

Purpose of files in package

  • install_list.txt is a list of packages to be installed.
  • delete_list.txt is a list of packages to be deleted. No IPK files need to be supplied in order to remove a package.
  • package list contains the names of packages to be added or removed. An example from the install_list.txt file would be:

Python-terminal is not normally installed in mLinux, but is available from the feeds. Likewise the file delete_list.txt contains gpsd-udev. This package is required by gpsd, but is used to find GPS’s over the USB bus, which is not needed by the device (unless you plug a GPS into a USB port).

OPKG Configuration

local.conf is the opkg configuration file. It tells opkg the location of update packages.

Example local.conf:

# Set mtcap instead of mtcdt for mtcap
arch all 1
arch any 6
arch noarch 11
arch arm 16
arch armv4 21
arch armv4t 26
arch armv5 31
arch armv5t 36
arch armv5e 41
arch armv5te 46
arch arm926ejste 51
arch arm926ejse 56
arch mtcdt 61
arch mtcap 61

src/gz mlinux-mtcdt file://FLASHDIR/repo/mtcdt
src/gz mlinux-mtcap file://FLASHDIR/repo/mtcap
src/gz mlinux-arm926ejste file://FLASHDIR/repo/arm926ejste

In this case, FLASHDIR is replaced at install time by the install.sh script, and either the line containing mlinux-mtcdt or mlinux-mtcap is removed depending on the device hardware.

Creating opkg Required Files

To create a set of packages, have a Yocto 2.2 build system in order. Place the desired packages under build/tmp/deploy/ipk/ in all, mtcdt, mtcap, arm926ejste, as appropriate. Remove any unneeded ipk files from build/tmp/deploy/ipk.


$ cd build/tmp/deploy/ipk
$ ls
arm926ejste mtcap mtcdt Packages
$ rm -rf *
$ # Now copy the files from the upgrade tree
$ cp -a ~/update-example/my-upgrade/repo/* .
$ bitbake package-index

NOTE: Tasks Summary: Attempted 161 tasks of which 159 didn't need to be rerun and all succeeded.
Summary: There was 1 WARNING message shown.

Building the package index will create or update files named Packages*


The Packages.gz file is used by opkg to test the packages for corruption and to provide a description. Packages provides the same file, uncompressed, for reference.

After that, the files need to be copied back:

cd build/tmp/deploy/ipk
cp -a * ~/update-example/my-upgrade/repo/

Installer script

The file install.sh is the installer script. To make life easier, this file is derived from a template file, which is updated by the build.sh script.

Example instructions in the install.template script:

# This script works with a tar archive
# called upgrade.bin and is intended for
# use with mlinux-firmware-upgrade
echo "$NAME starting in directory $(pwd)"
cd flash-upgrade/update-4.0.0
id=$(id -u)
if ((id != 0)) ; then
     echo 'You must be root (admin in AEP) to install packages.'
     exit 1

cat /proc/mounts
ls /
ls -l /tmp
if ! [[ -f ${localcnf} ]] ; then
     echo "Cannot find ${localcnf}"
     echo "This file must be in the current directory."
     exit 1
sed -i "s?FLASHDIR?${dir}?" ${localcnf}
machine=$(mts-io-sysfs show product-id | sed 's/-.*//')
if [[ $machine == MTCAP ]] ; then
     # remove mtcdt
     sed -i '/mtcdt/d' ${localcnf}
     # remove mtcap
     sed -i '/mtcap/d' ${localcnf}
cat ${localcnf}
cat ${pkglist_file} |
(if ! md5sum -c ${pkglist_file}.md5 ; then
     echo "md5sum bad on ${pkglist_file}"
     umount_all error
cat ${localcnf}
cat ${pkglistrm_file} |
(if ! md5sum -c ${pkglistrm_file}.md5 ; then
     echo "md5sum bad on ${pkglistrm_file}"
     umount_all error
echo "Update package list ... /usr/bin/opkg -f ${localcnf} update"
/usr/bin/opkg -t /var/volatile/ -f "${localcnf}" update
/usr/bin/opkg -t /var/volatile/ -f "${localcnf}" upgrade
if [[ -r ${pkglistrm_file} ]] ; then
     for p in $(cat ${pkglistrm_file}) ; do
          echo /usr/bin/opkg --force-depends -t /var/volatile/ -f "${localcnf}" install $p
          /usr/bin/opkg opkg --force-depends -t /var/volatile/ -f "${localcnf}" remove $p
if [[ -r ${pkglist_file} ]] ; then
     for p in $(cat ${pkglist_file}) ; do
          echo /usr/bin/opkg -t /var/volatile/ -f "${localcnf}" install $p
          /usr/bin/opkg -t /var/volatile/ -f "${localcnf}" install $p
version=$(grep mLinux /etc/mlinux-version | sed 's/mLinux //')
sed -ri "s/mLinux [0-9][^ ]* /mLinux ${version} /" /etc/issue
sed -ri "s/Version: [0-9][^ ]*/Version: ${version} /" /etc/issue

Build Script

To generate the package, there is a script for that purpose, called build.sh:

dir=$(ls -d update-*)
sed "s/UPGRADE_DIR/${dir}/" install.template >install.sh
echo "Upgrade directory is ${dir}"
cat install.sh | md5sum >install.sh.md5
cd update-*
cat local.conf | md5sum >local.conf.md5
cat install_list.txt | md5sum >install_list.txt.md5
cat remove_list.txt | md5sum >remove_list.txt.md5
cd ..
set -x
chmod +x install.sh
tar --owner=0 --group=0 -cJf ~/${dir}.bin model install.sh* update-*

The script assumes a directory starting with update- in the current directory. The directory name is used to create the tar file called ${dir}.bin. This file is then copied to /var/volatile, and mlinux-firmware-upgrade ${dir}.bin is executed as root to update the packages. The file http://www.multitech.net/mlinux/upgrades/example/log.txt shows what to expect during the package installs, removals, and upgrades.