How to deploy applications on Maemo
Once your application is properly implemented, tested and documented, it is time to deploy it into the target device. For Maemo platform, you need to create a Debian package for them.
Maemo uses the Debian package management system for installing and managing application packages and their dependencies. For end-users the actual package management is invisible and the application installation and removal in the Internet Tablet is done by the Application Manager. The Debian package management system uses packages which consists of application binaries, optional libraries, meta data describing the package, dependencies to other packages and optional pre-install and post-install scripts. Packaging the applications is done with standard Debian packaging tools.
After creating the Debian package (creation is identical to the desktop Linux environment) the application is ready to be installed on the Internet Tablet. The Application is either copied to the device and installed using Application manager, or by placing the package into the package repository (essentially a web or FTP site containing application packages) and creating a single-click install-file. The single-click install-file eliminates the need for user to manually configure repositories in the Application manager, providing an easy-to-use way for end-user to install the application.
Creating a Debian package
In order to pack your application into a Debian package, it is necessary to provide some necessary files which are used to retrieve important information during such process. In addition, such files are supposed to be inside a debian directory. This is the structure you are supposed to provide in order to create a Debian package from your application (other additional files may also be added, but the following ones are necessary):
The control file is the most important one. It contains several fields used during generation of Debian package and mainly during installation process. As example control file from the maemo.org HOWTOs looks like this:
Package: myapplication Section: user/other Priority: optional Maintainer: Your Name <email@example.com> Build-Depends: debhelper (>= 5) Standards-Version: 3.7.2 Package: myapplication Architecture: any Depends: libhildon1 (>= 1.0.11) Description: A simple test application A very simple application with a short description. Which spans multiple lines actually.
- Package - gives the package name. Such name is used to manipulate the package by the package tools;
- Version - gives both the upstream developer's version number;
- Architecture - specifies the hardware platform for which this particular binary was built;
- Depends - gives a list of packages that have to be installed in order to install this package successfully;
- Priority - indicates how important is this package for installation;
- Maintainer - gives the e-mail address of the person who is currently responsible for maintaining this package;
- Description - gives a brief summary of the package's features.
The changelog file contains modifications made in the Debian package compared to the upstream one as well as other changes and updates to the package.
The copyright file is a copy of its copyright and distribution license.
File rules is a executable makefile, and contains the package-specific recipes for compiling the package and building binary package(s) from the source.
The compat file basically lists the version of debhelper used when the package was created.
In order to generate all of this files, you can use Debian tools. Since it is supposed to generate a Debian package to be installed into an Internet Tablet, remember to use ARMEL rootstrap.
At first, your project path must be named as yourpackage_version. Then, execute the following command in your project directory (it is supposed that you're logged in Maemo development environment) to generate the necessary structure used to generate a Debian package:
$ dh_make -e firstname.lastname@example.org -f ../path-to-dist.tar.gz
This command generate a lot of files, but you can remove the ones that you don't need. Edit the files according to your project. Finally, execute the following command to generate the Debian package (change back to the source directory just above debian):
$ dpkg-buildpackage -rfakeroot .
The package is left at the directory above the current one.
Installing a Debian package on Internet Tablet
Once your Debian package is properly created, we can now install it on your device. It is necessary to transfer the package to the device:
- you can use the device as a USB mass storage. So, you have to attach the USB cable and then mount the device into some suitable directory under Linux. Finally, you can copy the package to the directory you want;
- you can copy the package using a SSH connection (SCP).
Once the Debian package is on the device, you can install the package by using command line (use Xterm application or even an SSH section from you Desktop) or by using the Application Manager.
If you want to install by using command line, execute the following command (inside Scratchbox):
$ dpkg -i you_package.deb
As another option, use the Application Manager and select the package file to install as shown on the following picture.
The easiest way: Debian package generation/installation with ESbox
ESbox provides interesting features to generate and install Debian packages. For more information, visit ESbox User's Guide.