reprage

I am completely besotted with the Intel Edison. I love it. I think it is the most exciting hardware Intel has developed since my trusty old Pentium 200 MMX.

The only downside lies in the software ecosystem; it is still pretty small. The operating system the Edison ships with is ‘Yocto’, a linux distribution targeted at embedded systems. It is great, but pre-built packages (ipk) of many of your favourite open source tools don’t exist yet.

This guide steps you through the process of creating a package that the opkg package manager can install on the Intel Edison. It assumes you have bootstrapped your Edison, logged in and are comfortable executing programs at the command prompt.

Step #1 - Install opkg utilities.

$ opkg install http://iotdk.intel.com/repos/1.1/iotdk/i586/tar_1.27.1-r0_i586.ipk
$ opkg install http://iotdk.intel.com/repos/1.1/iotdk/i586/findutils_4.4.2-r6_i586.ipk
$ opkg install opkg-utils

Step #2 - Download and compile the utility you want to turn into an ipk

The following will use monit as a concrete example, but similar steps will apply to most Linux applications.

$ wget https://mmonit.com/monit/dist/monit-5.16.tar.gz
$ tar -xvzf monit-5.16.tar.gz
$ cd monit-5.16
$ ./configure --without-pam
$ make

Step #3 - Create the ipk file structure

The folder structure for an ipk is pretty straight forward, if you wanted to just install a file to /etc/foo. Create a directory structure only containing that file.

ipk-build
└── etc
    └── foo

Now if you are building a utility from source, often make install will let you specify a destination directory.

$ mkdir ipk-build
$ make install DESTDIR=ipk-build

For monit, this generated the following:

ipk-build
└── usr
    └── local
        ├── bin
            └── monit
        └── share
            └── man
                └── man1
                    └── monit.1

For monit, I also copied the default monitrc configuration file into the package so that it would be installed into etc.

Step #4 - Created control file

The control file contains metadata that opkg uses to describe and install the package. It should be placed in a directory called ‘CONTROL’:

ipk-build
├── CONTROL
    └── control
├── etc
    └── monitrc
└── usr
    └── local
        ├── bin
            └── monit
        └── share
            └── man
                └── man1
                    └── monit.1

The control file I created for monit contained the following:

Package: monit
Version: 5.16
Architecture: x86
Maintainer: reprage
Section: admin
Priority: optional
Source: https://mmonit.com/monit/
Description: Manages and monitors Unix systems.

Step #5 - Build ipk

To bundle everything up into a single file that can be installed by opkg:

$ opkg-build ipk-build

For my monit example, this created the file: monit_5.16_x86.ipk this can then be installed with:

$ opkg install monit_5.16_x86.ipk

References

Comments:

You can join the conversation on Twitter or Instagram

Become a Patreon to get early and behind-the-scenes access along with email notifications for each new post.