HowTo SimpleDeb

Describe How a SimpleDeb looks like

And how you can create your own Debian packages for Maemo.

Autopsy of 'some-gnu-utils_0.1_arm.deb' (available from ApplicationCatalog Wiki):

user@linux:/tmp> ar -vx some-gnu-utils_0.1_arm.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz

Yes, it is an ar-archive, not a tar-archive.

'debian-binary' must be the first file in this archive:

user@linux:/tmp> cat debian-binary
2.0

'control.tar.gz' just contains a single file:

user@linux:/tmp> tar -xvzf control.tar.gz
control
user@linux:/tmp> cat control
Package: some-gnu-utils
Version: 0.1
Section: unstable
Priority: optional
Architecture: arm
Depends: maemo
Installed-Size: 1085
Maintainer: Armin M. Warda <Armin.Warda AT Web.De>
Description: some GNU utilities for Maemo that I miss on my Nokia 770: wget 1.10.2, bc 1.06, find, xargs 4.2.25, gcal 3.01

You can determine the installed size with the 'du -k' command before packaging.

'data.tar.gz' must contain relative path names (no leading '/'), but remember, installation will occur relative to '/var/lib/install/', e.g. 'usr/bin/bc' will be installed to '/var/lib/install/usr/bin/bc':

user@linux:/tmp> tar -xvzf data.tar.gz
usr/
usr/bin/
usr/bin/bc
usr/bin/find
usr/bin/gcal
usr/bin/wget
usr/bin/xargs

To save space, please strip-off debug information from executables and libraries before packaging, this can be done with the 'strip' command:

user@linux:/tmp> file usr/bin/*
usr/bin/bc:    ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped
usr/bin/find:  ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped
usr/bin/gcal:  ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped
usr/bin/wget:  ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped
usr/bin/xargs: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), stripped

ArminMWarda


...also simple to build one!

You can easily reverse this process to build a package. create a subdir for everything under /var/lib/install you intend to install, including links. Everything relative to /var/lib/install. Add debian-binary and modify the control file. Then run the following script:

#!/bin/sh
tar -zcvf data.tar.gz ./usr ./etc
tar -zcvf control.tar.gz control
rm winzig_1.71-N770v0.1_arm.deb 
ar q winzig_1.71-N770v0.1_arm.deb debian-binary control.tar.gz data.tar.gz 
ar t winzig_1.71-N770v0.1_arm.deb
ls -al winzig_1.71-N770v0.1_arm.deb

To see another example of the files, check this one: winzig-1.71_N770_source.tar.gz

Michael Mlivoncic


Created with the following little script. (After actually bootstrapping with ar from the binutils package for arm.)

#!/bin/sh

PACKAGE=ar-maemo
VERSION=0.1
DIRS="usr"
find $DIRS| grep \~ && rm -i $(find $DIRS| grep \~)

SIZE=$(du -sc $DIRS|grep total|sed s/total//)

echo "Package: $PACKAGE
Version: $VERSION
Section: unstable
Priority: optional
Architecture: arm
Installed-Size: $SIZE
Maintainer: Kasper Souren <kasper DOT souren AT gmail DOT com>
Description: ar from GNU binutils " > control
cat control

tar -zcvf data.tar.gz ./usr ./etc
tar -zcvf control.tar.gz control
NAME=$PACKAGE-$VERSION.deb
rm $NAME
ar q $NAME debian-binary control.tar.gz data.tar.gz
ar t $NAME
ls -al $NAME