Setting Up a Yocto Build Server as a Remote Package Repository

If you are using Yocto to create your embedded linux system, it can really useful to set your server up to act as a package repository.

Setting up

Assuming that you have set your local.conf to have

PACKAGE_CLASSES ?= "package_ipk"

then when you create a full system image, you will have all of the ipk files under your ${TMPDIR}/deploy/ipk

If ${TMPDIR} has not been defined in your local.conf, it will default to <BUILD DIR>/tmp

Mine looks like:

ming@gweinydd:~/wip/yocto/build/tmp/deploy/ipk$ ls -l
total 416
drwxr-xr-x 2 ming ming 4096 Jul 9 14:50 all
drwxr-xr-x 2 ming ming 397312 Jul 11 16:49 cortexa8hf-neon
drwxr-xr-x 2 ming ming 20480 Jul 12 19:35 my_hub

What you now need to do is set up a web server to serve files from that directory.

For me, I have the standard Apache installation, so I just create a link from /var/www/html/project to the ipk directory.

ln -s /home/ming/wip/yocto/build/tmp/deploy/ipk /var/www/html/client

Then restart the server

apachectl restart

To get Yocto to create a package manifest run the bitbake command:

bitbake package-index

The, over on your embedded system, edit the file /etc/opkg/opkg.conf and add the lines (editing the build-server and repo names):

src/gz all http://build-server/repo/all
src/gz cortexa8hf-neon http://build-server/repo/cortexa8hf-neon
src/gz my_hub http://build-server/repo/my_hub

Now you can run an opkg update to update the list of available packages.

Note: Updates are not cached, so you may need to re-run that after a reboot.

Installing a package

To install a package that you have previously built, run opkg install <PACKAGE NAME>

If you add a new package or update an existing one (in which case you need to ensure you update the PR value in the recipe!), you will need to build the complete system image in order for bitbake to create the ipk file.

To get a full list of opkg commands, just run opkg without any arguments.