Yocto: Opkg Package Management System Set Up

From Estone Technology Wiki
Jump to: navigation, search


Most of the time, during development, we want to add software packages that didn't make it during the initial build. We would want to configure the systems to that the embedded board so it can remote access the packages directly on the build station. Hence, Yocto provides three different Package Management System: OPKG, RPM and Debian. Opkg is a lightweight package management system based on Ipkg. In this tutorial, we will set up opkg to install additional packages on sample image x11 for HIO boards.


Bitbake HIO Sample X11 image with opkg installed
Set up Apache web server
Set up opkg
Install example package using opkg


Yocto Environment is set up; Visit Set Up Yocto Environment
Edit bblayers.conf and local.conf; Visit Build HIO Sample Image x11
Note: DO NOT Bitbake the Image yet

Bitbake a x11 image that has Opkg program

The opkg belongs to openembedded-core layer and is located in sources/poky/meta/recipes-devtool/opkg in the HIO project Github.

  • Note: In bblayers.conf, ${BSPDIR}/sources/poky/meta tell Yocto where the recipe of opkg is.
  • Use an editor to add the following bold components to /path/to/build-x11/conf/local.conf

MACHINE ??= 'hio-imx6dl-board'
DISTRO ?= 'poky'
PACKAGE_CLASSES ?= "package_rpm package_ipk"
EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-openssh package-management"
IMAGE_INSTALL_append = " opkg "
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
    STOPTASKS,${DL_DIR},1G,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()*2}" PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count()*2}"
PREFERRED_VERSION_hio-image = "1.01" SOURCE_MIRROR_URL ?= "http://www.hioproject.org/support/images/source_mirror/sources/" INHERIT += "own-mirrors" BB_GENERATE_MIRROR_TARBALLS = "1"
DL_DIR ?= "${BSPDIR}/downloads/" ACCEPT_FSL_EULA = "1"
  • Compile the image using bitbake
Bitbake hio-image-x11

Note: "package_ipk" is for OPKG. package_rpm is for Red Hat, and package_deb is for Debian.

Set Up Apache Web Sever

In a local Ubuntu computer, install Apache2

sudo apt-get install apache2

The Apache server default web page directory is /var/www/html .We need to populate it with a link pointing to our ipk package repository

sudo ln -s /path/to/build-x11/tmp/deploy/ipk /var/www/html/my-repo

Set Up the Port Forwarding in the router to include HTTP and HTTPS. In Amazon EC2, this can be set in Security Group -> inbound.

After that, we can test it by going to (Change the corresponding IP).

Set Up and Test Opkg

Note: to update the package manifest. In the Yocto environment run bitbake package-index

In HIO board, set up an opkg configuration file to tell opkg where to look for packages. Create file opkg.conf in /etc/opkg/

Edit the opkg.conf to something like the following
Note: Replace to the IP of the build station;

src/gz all
src/gz cortexa9hf-vfp-neon-mx6
src/gz cortexa9hf-vfp-neon

Test it

Now we can run

opkg update
opkg upgrade

To install a package, first, we need to bitbake an *.ipk package for that application. Then, on the embedded device, we can just call opkg to install. For example Chromium

opkg install Chromium


opkg install http://localhost/my-repo/cortexa9hf-vfp-neon-mx6/


Yocto Project: Application Installation and OPKG Package Management
Set Up Apache and Install HelloWorld with OPKG Package Manager
Yocto Project: Create"Hello World" Recipe and Custom Meta-Layer