Using your Linux host as a opkg package server

It is very useful to have your computer working as a opkg package server in the sence that you can install packages built and test instantly instead of rebuilding the entire image.

To enable this I did the following:

Install nginx

apt-get install nginx

Create a new nginx server config

sudo vi /etc/nginx/site-enabled/opkg-server
server {
  listen 80 default_server;

  root /home/myuser/repos/myyocto/mybuild/tmp/eglibc/deploy/ipk;

  autoindex on;
}

Remove the nginx default enabled site

sudo rm /etc/nginx/sites-enabled/default

Enable the new opkg site

sudo ln -s /etc/nginx/sites-enabled/opkg-server/etc/nginx/sites-available/opkg-server

Restart the server

sudo /etc/init.d/nginx restart

You should now be able to surf into your localhost using a web-browser

Next step is to enable this on your device

ssh target
vi /etc/opkg/opkg.conf
src/gz all http://192.168.1.4/all
src/gz armv5te http://192.168.1.4/armv5te
src/gz armv7a-vfp-neon http://192.168.1.4/armv7a-vfp-neon
src/gz cortexa8-vfp-neon http://192.168.1.4/cortexa8-vfp-neon
src/gz cortexa8-vfp-neon-mx5 http://192.168.1.4/cortexa8-vfp-neon-mx5
src/gz x86_64-nativesdk http://192.168.1.4/x86_64-nativesdk

Where 192.168.1.4 is the IP-address of your host machine

Next update the package list

opkg update
Downloading http://169.254.1.4/all/Packages.gz.
Inflating http://169.254.1.4/all/Packages.gz.
Updated list of available packages in /var/lib/opkg/all.
Downloading http://169.254.1.4/armv5te/Packages.gz.
Inflating http://169.254.1.4/armv5te/Packages.gz.
Updated list of available packages in /var/lib/opkg/armv5te.
Downloading http://169.254.1.4/armv7a-vfp-neon/Packages.gz.
Inflating http://169.254.1.4/armv7a-vfp-neon/Packages.gz.
Updated list of available packages in /var/lib/opkg/armv7a-vfp-neon.
Downloading http://169.254.1.4/cortexa8-vfp-neon/Packages.gz.
Inflating http://169.254.1.4/cortexa8-vfp-neon/Packages.gz.
Updated list of available packages in /var/lib/opkg/cortexa8-vfp-neon.
Downloading http://169.254.1.4/cortexa8-vfp-neon-mx5/Packages.gz.
Inflating http://169.254.1.4/cortexa8-vfp-neon-mx5/Packages.gz.
Updated list of available packages in /var/lib/opkg/cortexa8-vfp-neon-mx5.
Downloading http://169.254.1.4/x86_64-nativesdk/Packages.gz.
Inflating http://169.254.1.4/x86_64-nativesdk/Packages.gz.
Updated list of available packages in /var/lib/opkg/x86_64-nativesdk.

And then your’e ready to update any package from your computer

opkg install mypackage
This entry was posted in Yocto and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *