Programming own applications | IPK how-tos

IPK how-tos

Installing IPK packages

Small description

The IPK feed directory contains precompiled and prepackaged software for the MATRIX VISION mvBlueLYNX. This package system is based loosely on the Debian packages but is simpler and script-based. An identical system is used on the Sharp Zaurus PDA.

To install packages you will need the script called ipkg. This script is included in mvBlueLYNX filesystems from 23.10.2002 or newer. For older firmware a copy is included on the CD.

Type in ipkg without any parameters to see how it works:

==========================================================
usage: ipkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
        update                  Update list of available packages
        upgrade                 Upgrade all installed packages to latest version
        install <pkg>           Download and install <pkg> (and dependencies)
        install <file.ipk>      Install package <file.ipk>
        install <file.deb>      Install package <file.deb>
        remove <pkg>            Remove package <pkg>

Informational Commands:
        list                    List available packages and descriptions
        files <pkg>             List all files belonging to <pkg>
        search <file>           Search for a packaging providing <file>
        info [pkg [<field>]]    Display all/some info fields for <pkg> or all
        status [pkg [<field>]]  Display all/some status fields for <pkg> or all
        depends <pkg>           Print uninstalled package dependencies for <pkg>

Options:
        -d <dest_name>          Use <dest_name> as the the root directory for
        -dest <dest_name>       package installation, removal, upgrading.
                                <dest_name> should be a defined dest name from the
                                configuration file, (but can also be a directory
                                name in a pinch).
        -o <offline_root>       Use <offline_root> as the root for offline 
                                   installation.
        -offline <offline_root>

Force Options (use when ipkg is too smart for its own good):
        -force-depends          Make dependency checks warnings instead of errors
        -force-defaults         Use default options for questions asked by ipkg.
                                (no prompts). Note that this will not prevent
                                package installation scripts from prompting.
==========================================================

Examples of use

To install a package file called mvstest.ipk:

mvBL:/# ipkg install mvstest.ipk

To install this package from a URL (this URL does not really exist!):

mvBL:/# ipkg install http://feed.mvsensor.org/mvstest.ipk

To upgrade this package to a newer version:

mvBL:/# ipkg upgrade mvstest

To remove this package:

mvBL:/# ipkg remove mvstest

To list installed packages:

mvBL:/# ipkg list

etc.

Hint

You could just allow http or ftp access to a complete directory and then any mvBlueLYNX can access it and update their software at will.

Note:
MATRIX VISION is setting up IPK feeds on its website:

If you want to setup an own IPK feed please have a look at Setting up an IPK feed.

Some IPK packages cannot be installed on the mvBlueLYNX-M. For details please have a look at the particular IPK package description.

Installing via VMware

With the preconfigured development environment "mvSDK for intelligent cameras", which is available on DVD, you can use the Virtual Machine (VMware) to install IPK packages. This could be useful, if your development environment has no connection to the internet.

The IPK packages are located here:

/var/www/ppc_603e   # for mvBlueLYNX IPK packages
/var/www/ppc_6xx    # for mvBlueLYNX-M7 and mvBlueCOUGAR-P IPK packages

The Apache webserver of the Virtual Machine (VMware) makes them available and by using a browser you can navigate through the directories. The only thing you have to know is the IP address of the Virtual Machine (VMware).

The path to the directory can be entered in the ipk.conf of device (/var/www/ppc_603e for mvBlueLYNX IPK packages; /var/www/ppc_6xx for mvBlueLYNX-M7 and mvBlueCOUGAR-P IPK packages).

Installing via Server2Go

If you have neither an internet access nor the VMware locally nor a webserver available, there is still a possibility to install IPK packages. The tool is called Server2Go and can be downloaded here (the Micro-Package is enough for this type of installation and it is a self-extracting EXE file):

http://www.server2go-web.de/download/download.html

Please follow these steps, to get the webserver running:

  1. Extract the Server2Go tool on an USB stick.
    Afterwards, a htdocs folder is available.
  2. Copy the IPK packages you want to install/upgrade in the htdocs folder.
  3. Now, change the following line of the pms_config.ini which you can find in the Server2Go folder.
    ...
    HostName=192.168.1.133
    ...
    
    You have to use the IP address of the host PC where you want to start this webserver.
  4. Afterwards, start the webserver by clicking "Server2Go.exe".
    A popup window will be appear. Don't close this window, otherwise the webserver will be shut down!

Please follow the next steps, to set the mvBlueLYNX and to install the packages:

  1. On the mvBlueLYNX, change the corresponding line in the ipkg.conf:
    mvBL:/> remount rw           // Write access
    mvBL:/> vi /etc/ipkg.conf    // Open the ipkg config file to edit it
    
    ...
    src cd http://192.168.1.133/
    ...
    
    Replace the IP address with the address you've entered in pms_config.ini (the IP where the webserver is running).
  2. Afterwards, you can, for example, update the mvBlueLYNX:
    mvBL:/> ipkg update
    mvBL:/> ipkg upgrade
    

Building IPK packages

Step-by-step description

  1. Create the directory structure and files you want to appear on the mvBlueLYNX.

  2. Create a directory named CONTROL at the top-level of this directory structure.

  3. Inside CONTROL create a file named control with lines of the form "Field: value". Required fields are Package, Version, Architecture, Source, Maintainer, and Description. Optional fields include Priority, Section, and Depends. The meaning of each of the fields will be given later in this document.

  4. If your package has any configuration files, then create a file CONTROL/conffiles which lists the absolute path of each configuration file, (as it will appear on the installed system), one per line. This will prevent the package management system from automatically overwriting configuration changes when the user upgrades the package.

  5. If needed your package may include some scripts that will be invoked by the package maintenance system. There are four possible times a script will be run: just before your package is installed, just after your package is installed, just before the package is removed, and just after the package is removed. These scripts are named preinst, postinst, prerm, and postrm and should be located in the CONTROL directory. The scripts should return 0 on success, (a non-zero return value from preinst will prevent your package from being installed -- this can be useful in rare situations). The scripts can assume a tty is available so they may prompt the user.

Note:
On the mvBlueLYNX the root file system is usually accessible only in "read-only" mode i.e. you cannot write to any directories. Exceptions to this include /flash, /var, /tmp and /dev, but changes to /tmp (RAM disk) and /dev will not be permanent i.e. will be lost on the the next startup. Usually you would install user applications to "/flash" but if you need to write to other directories like "/etc" you will need to include the command /usr/sbin/remount rw in the script "preinst" and also /usr/sbin/remount ro in "postinst".

/usr/lib is actually a symbolic link to /flash/lib and is therefore always writable. Here is an example of preinst and postinst including the remount command:

### Begin CONTROL/preinstexample
#!/bin/sh
/usr/sbin/remount rw
exit 0
### End CONTROL/preinst example

### Begin CONTROL/postinst example
#!/bin/sh
/usr/sbin/remount ro
exit 0
### End CONTROL/postinst example
The same applies to the other scripts if you need to remove files from the read-only system when removing an installed package.

  1. Now simply run:
    ipkg-build directory [destination_directory]
    

    where directory is the directory you have created. The destination_directory is optional and defaults to the current directory. The ipkg build script performs several sanity checks on the package directory and should guide you through any problems.

    Here is an example control file which you may use as a template:

    ### Begin CONTROL/control example
    Package: foo
    Priority: standard
    Version: 1.9.16
    Architecture: ppc603e
    Maintainer: Joe Bloggs <info _at_ joesdomain.de>
    Source: http://www.joesdomain.de
    Depends: mvs, mvslib
    Section: base lib
    Description: foo is the ever-present example program -- it does everything
     foo is not a real package. This is simply an example that you
     may modify if you wish.
     .
     When you modify this example, be sure to change the Package, Version,
     Maintainer, Depends, and Description fields.
    ### End CONTROL/control example
    

    The meaning of the various fields in CONTROL/control is as follows:

    • Package is the name of the package and should match the regular expression [a-z0-9.+-]\+ Version should have at least one digit and should match [a-zA-Z0-9.+]*.
    • Priority should be one of: required, standard, important, optional, or extra. Most programs should use optional.
    • Architecture should specify the architecture for which the package is compiled. A valid value for mvBlueLYNX-2xx,-4xx or -6xx is ppc603e.
    • Maintainer should be the name and email address of the person responsible for maintaining the package, (not necessarily the author of the program). The e-mail address is notr checked for validity and may be modified to confuse spammers if you like.
    • Source should be a valid URL pointing to a website containing the source code (if GPL).
    • Depends indicates packages which must also be installed in order for this package to work. The packages should be listed on a single line, separated by commas.
    • Section can be one of the following: admin, base, comm, editors, extras, graphics, libs, misc, net, text, web, x11.
    • Description should be a short, (less than 80 characters) description of the program. It may also include a long description on subsequent lines, (each indented by a single space character). Blank lines in the long description may be indicated by a line consisting of a space character followed by a period, i.e. "."

Setting up an IPK feed

Introduction

The ipkg script is able to install local packages by supplying a complete filename. Alternatively you may make IPK packages accessible via FTP or HTTP in a so-called IPK Feed. This has the following advantages:

Setting up an IPK feed is very easy: Just create a new directory on your existing FTP or HTTP server. Place all the required IPK packages in this directory and then generate an index file called Packages by running the script IPKg-make-index. e.g.

Step-by-step description

E.g. to install the "xyz" and "qwe" packages in a feed on a Linux/Unix server follow these steps:

mkdir feed
cd feed
cp /abc/xyz_1.2.3_ppc603e.ipk .
cp /abc/qwe_2.3.4_ppc603e.ipk .
ipkg-make-index . > Packages

This should also work on Windows PCs running Virtual Machine (VMware) or the older Cygwin.

< prev. section: How to generate a mvBlueLYNX example | top | next section: mvslib reference manual >

MATRIX VISION
Generated on Tue Jul 17 13:43:11 2012