How To Use OPKG package management system in Factory

Factory provides different packages like opkg, rpm which allows customer to build their own package management system. This document explains how to use opkg utility as package manager, create local repositories and install packages in target.

Notes about the following example:
  • Arm architecture is used as reference.
  • An ftp server is used for package distribution (custom opkg repository), here at IP address 192.168.321.321 (which you will replace with your server).

Procedure:

1. In Desktop Factory, configure opkg to utilize a specific location on the target system for status and info files by adding the entry --with-opkglibdir=/var/lib to opkg configure options. This can be done through the menuconfig interface from the top-level Factory directory.

$ make menuconfig > Target Software > Software Packages > Utility > Packaging > opkg > opkg Configure Options 

2. Select Binary IPKG as the package output format

$ make menuconfig > Output Package Format (Binary IPKG packages)

Build the BSP/SDK by running make from the top-level Factory directory. Once complete, deploy the BSP on the target system. The next steps occur on the target system itself.

3. Next, create the necessary directory structure for opkg status and info files on the target system.

# mkdir -p /var/lib/opkg
# mkdir -p /etc/opkg                                                                                                                                   

Then add opkg configuration file with the below content:
# cat /etc/opkg/opkg.conf
src/gz snapshots ftp://192.168.321.321/opkg_sources/snapshots
dest root /
lists_dir ext /var/lib/opkg/opkg-lists
arch all 1
arch arm 200                                                                                                                                         

Create a custom opkg repository:

To create the custom repository, you need package manifest file in the repository. Ipkg-utils provides ipkg-make-index utility which is used to generate the package manifest file.

1. Get the ipkg-utils package from the link:

https://github.com/luthiano/ipkg-utils

2. Install the ipkg-utils to the host system, create a repository directory and copy all package files (*.ipk found in build_[arch]-timesys-linux-[libc]/packages/) to this repository.

$ mkdir snapshots
$ cd snapshots
$ cp /PATH/TO/FACTORY/build_armv7l-timesys-linux-gnueabi/packages/* . -R                                                

3. Then generate a package manifest using:

$ ipkg-make-index . > Packages                                                                                                       

4. Compress the package manifest using:

$ gzip -c9 Packages > Packages.gz

Copy this compressed Packages file to the ftp directory and update the repository path in the opkg configuration file created earlier (on the target system at /etc/opkg/opkg.conf).

Note: You can verify the repository with a web browser, i.e.:

ftp://192.168.321.321/opkg_sources/snapshots/

Install packages to target:

In target, update the list of available packages and install the packages.

# opkg-cl update
Downloading ftp://192.168.321.321/opkg_sources/snapshots/Packages.gz.
Inflating ftp://192.168.321.321/opkg_sources/snapshots/Packages.gz.
Updated list of available packages in /var/lib/opkg/opkg-lists/snapshots.

# opkg-cl install openssl
Installing openssl (1.0.1i-1) to root...
Downloading ftp://192.168.321.321/opkg_sources/snapshots/openssl-1.0.1i-1-arm-glibc.ipk.
Configuring openssl.

Reference:

http://www.jumpnowtek.com/yocto/Managing-a-private-opkg-repository.html