How to setup debian build environment for both amd64 and x86 platform

This article describes how to setup environment in which you can build both amd64 as well x86 .deb packages. It’s assuming that you already have working debian on amd64 kernel.

First step: install debootstrap

sudo apt-get install debootstrap chroot
sudo mkdir /opt/jessie-386
sudo debootstrap --arch i386 jessie /opt/jessie-386/

Now you should have fully working x86 debian in /opt/jessie-386

Second step: make a script to switch into i386 version

Create a script anywhere you like, for example /bin/switch_32 with following content:

sudo mount -o bind /proc $r/proc
sudo mount -o bind /dev $r/dev
sudo mount -o bind /sys $r/sys
sudo chroot $r
echo "Unmounting the filesystems from x86 system"
sudo umount $r/sys
sudo umount $r/proc
sudo umount $r/dev

Then make it executable. Now running it would switch you into fully working debian x86 in which you can install all required packages using apt-get and build your x86 packages.

No Comments

You can leave the first : )

Leave a Reply

Your email address will not be published. Required fields are marked *