Using OPKG with mLinux

Creating a Package Repository for OPKG

A simple way to create a package repository is to use the mLinux™ build tree. To create a repository, place the packages needed into one of the directories under build/tmp/deploy/ipk. Remove any ipk files that are not part of your recipe, and are normally a part of mLinux.

In this case we assume our custom recipe created packages in the directory arm926ejste:

$ cd build/tmp/deploy/ipk/arm926ejste
$ cp my_ipk1.ipk my_ipk2.ipk ~/save
$ rm *.ipk
$ cp ~/save/*.ipk .
$ bitbake package-index
$ ls -1
myipk1_2.9.3-r0.0_arm926ejste.ipk
myipk2_4.13-r0.0_arm926ejste.ipk
Packages
Packages.gz
Packages.stamps

The bitbake recipe package-index will create a new package index based on the ipk packages present in the directory.

The complete set of files compose the repository, and can be placed on a web server, or in a local directory on the device.

Configuration

Files Found in /etc/opkg

/etc/opkg/mlinux-feed.conf

This lists the mlinux feed that is used to find packages. This file will be set to the current level of mLinux. If you wish to update packages because of a problem, you could set this to a newer level. Be aware that Multitech may release incompatible levels in the future. An incorrect upgrade could make your device not able to boot Linux, and you will need to re-flash your device.

To use the mlinux-feed.conf file as is, the Conduit® should be connected to the public internet.

If the public internet is not available, the files may be mirrored on a local web server, and the URLs in mLinux.conf should be updated accordingly.

/etc/opkg/local.conf

A local configuration file. You may create this file if you have your own repository with your own applications. You may add files named *.conf for additional repositories. Repositories may be on local storage. This could include a usb connected drive, or SD card if available (not possible on MTCAP).

Example contents of /etc/opkd/local.conf:

src/gz local file:///var/volatile/myrepo

Any repository placed in /var/volatile will be deleted on a reboot or power outage.

Contents of the repository:

$ ls /var/volatile/myrepo
myipk1_2.9.3-r0.0_arm926ejste.ipk
myipk2_4.13-r0.0_arm926ejste.ipk
Packages
Packages.gz
Packages.stamps


OPKG Cache

Found in /var/lib/opkg. These should not be modified.

The package lists with checksums are here:

local
mlinux-arm926ejste
mlinux-mtcap
mlinux-all

These are package lists from the repositories.

There is also an info directory with configuration files from each package, package install, and package removal instructions.

The lists directory has descriptions of packages.

Enabling the package repositories

After making the files available on the Conduit, either through a web server, or in a local directory, issue the package update command on the device:

$ opkg update
Downloading http://multitech.net/mlinux/feeds/3.3.9/all/Packages.gz.
Inflating http://multitech.net/mlinux/feeds/3.3.9/all/Packages.gz.
Updated list of available packages in /var/lib/opkg/mlinux-all.
Downloading http://multitech.net/mlinux/feeds/3.3.9/arm926ejste/Packages.gz.
Inflating http://multitech.net/mlinux/feeds/3.3.9/arm926ejste/Packages.gz.
Updated list of available packages in /var/lib/opkg/mlinux-arm926ejste.
Downloading http://multitech.net/mlinux/feeds/3.3.9/mtcap/Packages.gz.
Inflating http://multitech.net/mlinux/feeds/3.3.9/mtcap/Packages.gz.
Updated list of available packages in /var/lib/opkg/mlinux-mtcap.
Downloading file:///var/volatile/myrepo/Packages.gz.
Inflating file:///var/volatile/myrepo/Packages.gz.
Updated list of available packages in /var/lib/opkg/local.

Package Revision Level Concerns and Checksums

After you issue the package update command, bear in mind that the checksums in the package lists will be applied to all packages of the same name. This includes ipk packages that are not installed as part of the repositories.

If you need to make changes to a recipe that creates a package that is normally part of a repository, you should update the revision level of the package, so that opkg will use the latest revision, and not use the checksum from the older revision of the file which will cause your package to not install. The revision level of a package is set by the PR variable in a bitbake recipe.

If you intend on using a package that is already in a repository, you should not create your own of the same name. You should either install it from the repository, or copy the file from the repository to the device if you do not wish to install from the repository.

Do not use your own mLinux build tree to create a new functionally identical package and attempt to install it. The file named Packages in each repository lists the package names from the repository. You can also browse the mLinux packages in the file /etc/opkg/mlinux-feed.conf by using the URL in a browser:

http://multitech.net/mlinux/feeds/3.3.12/arm926ejste

Upgrading packages

If you are able to do the opkg update command you should be able to list the upgradable packages that are currently installed:

# opkg list-upgradable
libmts-io0  -  0.6 - r0.0  -  1.0.1 - r0.0
lora-network-server  -  1.0.36-r1.0   -  1.0.40-r1.0
radio-cmd  -  0.3-r0.0  -  0.4-r0.0
mts-io  -  1.5.13-r9.0.0  -  1.5.16-r9.0.0
sms-utils -1.0.2-r0.0  -  1.0.4-r0.0
ppp  -  2.4.7-r8.1  -  2.4.7-r9.0
mlinux-scripts 1.0-r5.0  - 1.1-r2.0
radio-query 0.2-r0.0  -  0.4-r0.0
mlinux-version - 1:3.3.9_0947d212fc4c10871c66b4d83c97c5634dc1b8c7-r2.0  -  1:3.3.12_110a59d3c27c7b5923b32c6430e681059128a26e-r2.0
mts-id-eeprom  - 0.2.10-r0.0.1 - 0.3.3-r0.0.0

To perform the upgrade you may either select individual packages or install all the upgrades:

# opkg upgrade
Upgrading libmts-io0 on root from 0.6-r0.0 to 1.0.1-r0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/libmts-io0_1.0.1-r0.0_arm926ejste.ipk.
Upgrading radio-cmd on root from 0.3-r0.0 to 0.4-r0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/radio-cmd_0.4-r0.0_arm926ejste.ipk.
Upgrading mts-io on root from 1.5.13-r9.0.0 to 1.5.16-r9.0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/mtcap/mts-io_1.5.16-r9.0.0_mtcap.ipk.
Unloading mts-io module
[INFO] mts-io:cleanup:967:  cleaning up....
[INFO] mts-io:mts_io_exit:1050: exiting
update-rc.d: /etc/init.d/mts-io exists during rc.d purge (continuing)
Removing any system startup links for mts-io ...
/etc/rcS.d/S39mts-io
Upgrading sms-utils on root from 1.0.2-r0.0 to 1.0.4-r0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/sms-utils_1.0.4-r0.0_arm926ejste.ipk.
Upgrading ppp on root from 2.4.7-r8.1 to 2.4.7-r9.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/ppp_2.4.7-r9.0_arm926ejste.ipk.
Upgrading mlinux-scripts on root from 1.0-r5.0 to 1.1-r2.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/mlinux-scripts_1.1-r2.0_arm926ejste.ipk.
Upgrading radio-query on root from 0.2-r0.0 to 0.4-r0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/radio-query_0.4-r0.0_arm926ejste.ipk.
Upgrading mlinux-version on root from
1:3.3.9_0947d212fc4c10871c66b4d83c97c5634dc1b8c7-r2.0 to
1:3.3.12_110a59d3c27c7b5923b32c6430e681059128a26e-r2.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/mtcap/mlinux-version_3.3.12_110a59d3c27c7b5923b32c6430e681059128a26e-r2.0_mtcap.ipk.
Upgrading mts-id-eeprom on root from 0.2.10-r0.0.1 to 0.3.3-r0.0.0...
Downloading http://multitech.net/mlinux/feeds/3.3.12/mtcap/mtsideeprom_0.3.3-r0.0.0_mtcap.ipk.
Configuring libmts-io0.
…

Installing a Package

When installing a package, the opkg package manager will determine the dependencies. If the device is connected to the repository, these dependencies will be installed automatically. In this example, an install of gpsd brings in all of its dependencies:

$ opkg install gpsd
Installing gpsd (3.16-m3.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/gpsd_3.16-m3.0_arm926ejste.ipk.
gpsd: unsatisfied recommendation for gpsd-machine-conf
Installing bluez4 (4.101-r10.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/bluez4_4.101-r10.0_arm926ejste.ipk.
Installing libudev0 (182-r7.mlinux2.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/mtcap/libudev0_182-r7.mlinux2.0_mtcap.ipk.
Installing libglib-2.0-0 (1:2.38.2-r0.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/libglib-2.0-0_2.38.2-r0.0_arm926ejste.ipk.
Installing libffi6 (3.0.13-r0.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/libffi6_3.0.13-r0.0_arm926ejste.ipk.
Installing libusb-0.14 (1:0.1.5-r0.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/libusb-0.14_0.1.5-r0.0_arm926ejste.ipk.
Installing gpsd-gpsctl (3.16-m3.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/gpsd-gpsctl_3.16-m3.0_arm926ejste.ipk.
Installing gpsd-conf (3.16-m3.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/gpsd-conf_3.16-m3.0_arm926ejste.ipk.
Installing gpsd-udev (3.16-m3.0) to root...
Downloading http://multitech.net/mlinux/feeds/3.3.12/arm926ejste/gpsd-udev_3.16-m3.0_arm926ejste.ipk.
update-rc.d: /etc/init.d/gpsd exists during rc.d purge (continuing)
Removing any system startup links for gpsd ...
Configuring libusb-0.1-4.
Configuring libffi6.
Configuring gpsd-conf.
update-alternatives:
Linking //etc/default/gpsd to /etc/default/gpsd.default
Configuring libudev0.
Configuring libglib-2.0-0.
Configuring bluez4.
Configuring gpsd-gpsctl.
Configuring gpsd-udev.
Configuring gpsd.
Adding system startup for /etc/init.d/gpsd.
$

More Information

For more information on OPKG:

https://wiki.openwrt.org/doc/techref/opkg