Build packages for SLIND

From wiki.network-crawler.de
Jump to: navigation, search

Prepare the chroot environment

Notice: I used Debian Etch as base system

apt-get install debootstrap
cd /
mkdir /sarge_root_mnt
debootstrap sarge /sarge_root_mnt http://ftp.debian.org/debian/

This will take some time...

After that a mount point for the proc file system in your fstab would be nice:

echo "proc-sarge /sarge_root_mnt/proc proc none 0 0" >> /etc/fstab

Mount it

mount proc-sarge

Now chroot in your brand new sarge

chroot /sarge_root_mnt

Create a generic subset of devices. This subset consists of the standard devices, plus floppy drives, various hard drives, CD-ROM drives, pseudo-terminals, console devices, basic serial devices, busmice, audio devices, video framebuffers, printer ports, and some specialized devices.

cd /dev
/sbin/MAKEDEV generic

Download some programs for development

apt-get install vim libselinux1 dpkg-dev autoconf automake dh-make fakeroot file gcc g++ devscripts gnupg xutils

Adding the SLIND sources

vi /etc/apt/sources.list

And add

# SLIND repository
deb http://www.emdebian.org/slind/host suffolk main

Update apt-get

apt-get update

Download SLIND dpkg

cd /home
wget http://www.emdebian.org/slind/host/pool/d/dpkg/dpkg_1.13.10.slind1_i386.deb
wget http://www.emdebian.org/slind/host/pool/d/dpkg/dpkg-dev_1.13.10.slind1_all.deb
wget http://www.emdebian.org/slind/host/pool/d/dpkg-cross/dpkg-cross_1.25.slind2_all.deb

Download your favourite program source

wget http://ftp.debian.org/debian/pool/main/j/joe/joe_3.1.orig.tar.gz

Untar:

tar -xzf joe_3.1.orig.tar.gz
apt-get install gcc-3.4-i486-linux-uclibc linux-kernel-headers-uclibc-i386-cross libuclibc-dev-uclibc-i386-cross

Now its time to install SLIND dpkg

dpkg -i dpkg_1.13.10.slind1_i386.deb 
dpkg -i dpkg-dev_1.13.10.slind1_all.deb
dpkg -i dpkg-cross_1.25.slind2_all.deb

Ok now

cd joe-3.1
dh_make
Type of package: single binary, multiple binary, library, or kernel module? 
choose single binary
dpkg-buildpackage -auclibc-i386

Additional Information

About dpkg-deb

Get overview about the package

dpgk-deb -I joe_3.1-1_uclibc-i386.deb

For joe it looks like that:

 new debian package, version 2.0.
 size 215106 bytes: control archive= 1417 bytes.
     295 bytes,    10 lines      control
    2239 bytes,    37 lines      md5sums
 Package: joe
 Version: 3.1-1
 Section: unknown
 Priority: optional
 Architecture: uclibc-i386
 Depends: libgcc1 (>= 1:3.4.4), libuclibc0 (>= 0.9.28-1)
 Installed-Size: 597
 Maintainer: root <root@Marvin>
 Description: <insert up to 60 chars description>
  <insert long description, indented with spaces>

Get files in the package

dpkg-deb -c joe_3.1-1_uclibc-i386.deb

List content of the .deb file

ar tv somepackage.deb

Use the 'x' option to extract the files.

ar tv joe_3.1-1_uclibc-i386.deb
rw-r--r-- 0/0      4 Jun 15 15:43 2006 debian-binary
rw-r--r-- 0/0   1417 Jun 15 15:43 2006 control.tar.gz
rw-r--r-- 0/0 213496 Jun 15 15:43 2006 data.tar.gz

data.tar.gz contains all the files that will be installed with their destination paths. control.tar.gz man 5 deb-control ;)

Prepare build of .deb file

mkdir -p ./debian/usr/bin
cd ./debian/usr/bin
touch test.sh test.txt
mkdir -p ./debian/DEBIAN
cd -
echo "
Package: testfiles
Version: 0.1
Section: base
Priority: optional
Architecture: all
Depends:
Maintainer: Philipp Beyer <mail@network-crawler.de>
Description: Linux testfiles
" > ./debian/DEBIAN/control
chmod -R 0755 .
dpkg-deb --build debian
mv debian testfiles

To install it

dpkg -i testfiles

To remove

dpkg -r testfiles

References: Debian HOWTOs