Yocto: Opkg Package Management System Set Up

From HIO Wiki
Jump to: navigation, search

About

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.

Goals

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

Requirement:

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"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1" 
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 http://127.0.0.1/my-repo (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 192.168.0.102 to the IP of the build station;

src/gz all http://192.168.0.102/all
src/gz cortexa9hf-vfp-neon-mx6 http://192.168.0.102/cortexa9hf-vfp-neon-mx6
src/gz cortexa9hf-vfp-neon http://192.168.0.102/cortexa9hf-vfp-neon

Test it

Now we can run

opkg
opkg update
opkg upgrade
etc..

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

or

opkg install http://localhost/my-repo/cortexa9hf-vfp-neon-mx6/
chromium_40.0.2214.91-r0_cortexa9hf-vfp-neon-mx6.ipk

Videos

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

References

http://www.yoctoproject.org/docs/latest/adt-manual/adt-manual.html
http://wiki.openwrt.org/doc/techref/opkg
http://www.jumpnowtek.com/yocto/Using-your-build-workstation-as-a-remote-package-repository.html
http://httpd.apache.org/
http://git.yoctoproject.org/cgit/cgit.cgi/opkg/