Howto adapt Debian packages for Nokia770

Note: this how to is actual for os2005 only! For os2006 and later you have to build packages using maemo SDK!


I try to setup Nokia770 as Plutohome Orbiter. During this work I faced with a problem of absence of needed Debian packages. Unfortunately the standard ARM packages cannot be installed using Application Installer. This document explains how to modify existing Debian packages for Nokia 770.


Nokia770 is Debian-based Internet tablet. Basically you can use Debian ARM packages for it but there is an one problem. All packages should be installed via the Application Installer. It’s not apt-get or dpkg and it needs to remove from packages any maintainer scripts such as a postinst or prerm. Otherwise the installation or removal will fail. But each package from Debian repository includes those scripts. The only one way install them on your Nokia770 is to make some simple hack.

Structure of package for Nokia770

Generally Debian package is an archive contains three mandatory elements: file debian-binary, archive control.tar.gz and data.tar.gz. You can use GNU ar program to manipulate it. Basically Debian package contains three elements: debian-binary, control.tar.gz and data.tar.gz:
ar -t libsdl-sge_020904-5_arm.deb

The file debian-binary contains the version of the deb file format – 2.0. The ‘control.tar.gz’ should contain only two files: control and md5sums. The file control includes generic package information:
Package: package name
Version: package version
Section: unknown
Priority: optional
Architecture: arm
Depends: maemo
Installed-Size: size of your package
Maintainer: package maintainer name and email
Description: brief package description

The file md5sums includes MD5 checksums for all binary files in the package:
cad04bb2ea2ec519e03ce77c927de1e9 usr/lib/

The ‘data.tar.gz’ file contains all the files that will be installed with their destination paths:

Note: Nokia 770 needs relative path, not absolute because all package files will be put in the /var/lib/install after installation.

Modify Debian package for Nokia770

Let’s see an example of adaptation of Debian package libsdl-sge for Nokia 770. If we try to install this package on your Nokia 770 we will see an error message similar to this:
'Cannot install the package. It's built-in'
We have to do a small modification in the package to install it. First of all let’s download it from Debian repository (remember to choose ARM architecture). Go to directory where the package was stored and run command ar vx to get its content:
[misha@misha test]$ ar vx libsdl-sge_020904-5_arm.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz

Now uncompress control.tar.gz:
[misha@misha test]$ tar vzxf control.tar.gz

and data.tar.gz:
[misha@misha test]$ tar vzxf data.tar.gz

Now we should to modify the file control:
Package: SDL_sge_Nokia770
Version: 020904-5
Section: unknown
Priority: optional
Architecture: arm
Depends: maemo
Installed-Size: 124
Maintainer: Michael Stepanov
Description: extension of graphic functions for the SDL multimedia library.

Note: it’ll be enough to specify only maemo package as depend because the Application Installer cannot to resolve depends.
Also, there is no reason to put sources and documentation in the package. To save a space we can leave only lib directory. Therefore we should measure its size and put it in the control:
[misha@misha test]$ du -ks ./usr/lib/
124 ./usr/lib/

To get a MD5 checksum we can use an utiliy md5sum:
[misha@misha test]$ md5sum ./usr/lib/
cad04bb2ea2ec519e03ce77c927de1e9 ./usr/lib/

and put its outout into new md5sums. After that we should put control and md5sums in the archive control.tar.gz:
[misha@misha test]$ tar zcvf control.tar.gz control md5sums

We have to create data.tar.gz as well:
[misha@misha test]$ tar zcvf data.tar.gz ./usr/lib/

And finally we need to check debian-binary. It should contains ‘2.0’:
[misha@misha test]$ cat debian-binary

Now it’s time put all together:
[misha@misha test]$ ar -q SDL_sge_Nokia770_arm.deb debian-binary control.tar.gz data.tar.gz
ar: creating SDL_sge_Nokia770_arm.deb

To get the package name we just add to the name from control postfix ‘_arm’ and extension ‘deb’. Please, note that the order of entities in the package is important!
We can check the created package content:
[misha@misha test]$ ar -t SDL_sge_Nokia770_arm.deb

It seems correct. So, we are ready to install it on Nokia770.


This instruction for adaptation of Debian packages from Nokia770 is a result of reading many tech documents and my own experience.
If you have some suggestions or find some inaccuracies I’ll be glade to read you email (my email is stepanov.michael [at] gmail [dot] com) or comment.

Modified packages for Nokia770

The packages which are needed to be installed to run Plutohome Orbiter on Nokia770 you can find here.