First we debootstrap a normal wheezy (amd64 in my case) chroot.
Code: Select all
debootstrap wheezy /chroots/wheezy-raspbian-crossbuild/
Code: Select all
mount -t proc proc /chroots/wheezy-raspbian-crossbuild/proc
mount -t devpts devpts /chroots/wheezy-raspbian-crossbuild/dev/pts
chroot /chroots/wheezy-raspbian-crossbuild
Code: Select all
echo '#!/bin/sh' > /usr/sbin/policy-rc.d
echo 'echo "************************************" >&2' >> /usr/sbin/policy-rc.d
echo 'echo "All rc.d operations denied by policy" >&2' >> /usr/sbin/policy-rc.d
echo 'echo "************************************" >&2' >> /usr/sbin/policy-rc.d
echo 'exit 101' >> /usr/sbin/policy-rc.d
chmod 755 /usr/sbin/policy-rc.d
echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf
Code: Select all
echo 'deb [arch=amd64] http://ftp.uk.debian.org/debian wheezy main' > /etc/apt/sources.list
echo 'deb [arch=armhf] http://archive.raspbian.org/raspbian wheezy main' >> /etc/apt/sources.list
echo 'deb-src http://archive.raspbian.org/raspbian wheezy main' >> /etc/apt/sources.list
dpkg --add-architecture armhf
wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb
dpkg -i raspbian-archive-keyring_20120528.2_all.deb
apt-get update
Code: Select all
apt-get install build-essential
Code: Select all
mkdir gccnativebuild
cd gccnativebuild
export DEB_BUILD_OPTIONS=nocheck
apt-get build-dep gcc-4.7
apt-get source gcc-4.7
cd gcc-4.7-4.7.1
for patch in debian/thibgpatches/*.patch; do patch -p1 < $patch ; done
debian/rules control
dpkg-buildpackage -b
cd ..
dpkg -i *4.7.1-8+rpi1_amd64.deb
cd ..
Code: Select all
apt-get source binutils
cd binutils-2.22/
export TARGET=$(dpkg-architecture -aarmhf -qDEB_HOST_GNU_TYPE 2>/dev/null)
dpkg-buildpackage -b
cd ..
unset TARGET
dpkg -i binutils-arm-linux-gnueabihf_2.22-6.1_amd64.deb
Code: Select all
apt-get install binutils-multiarch
Code: Select all
wget http://ftp.uk.debian.org/debian/pool/main/l/linux/linux-libc-dev_3.2.23-1_armhf.deb
dpkg -i linux-libc-dev_3.2.23-1_armhf.deb
Code: Select all
apt-get install libc6-dev:armhf libstdc++6-4.7-dev:armhf
Code: Select all
mkdir gcccrossbuild
cd gcccrossbuild
apt-get source gcc-4.7
cd gcc-4.7-4.7.1
for patch in debian/thibgpatches/*.patch; do patch -p1 < $patch ; done
export DEB_CROSS_NO_BIARCH=yes
echo armhf > debian/arch
debian/rules control
dpkg-buildpackage -b
unset DEB_CROSS_NO_BIARCH
cd ..
dpkg -i *4.7.1-8+rpi1_*.deb
cd ..
Code: Select all
cd /usr/bin
ln -s arm-linux-gnueabihf-gcc-4.7 arm-linux-gnueabihf-gcc
ln -s arm-linux-gnueabihf-g++-4.7 arm-linux-gnueabihf-g++
ln -s ../share/pkg-config-crosswrapper arm-linux-gnueabihf-pkg-config
cd /
Now lets try cross-building something, i'm going to use pidgin as an example of a moderately tricky package.
Code: Select all
mkdir pidgin
cd pidgin
apt-get build-dep -aarmhf pidgin
[code]
This fails with an error about tcl-dev. It turns out this is arch all which confuses the multiarch support in apt-get build-dep. Looking further it turns out to be a dependency package depending on tcl-8.5-dev which we want the raspbian version of. Unfortunately this currently requires some hackery to make dpkg/apt accept it. tk turns out to have the same issue.
First we install tcl-dev and tk-dev
[code]
apt-get install tcl-dev tk-dev
We can now replace the amd64 tcl8.5 and tcl8.5-dev packages with the raspbian ones.
Code: Select all
aptitude install tcl8.5:armhf tcl8.5-dev:armhf tk8.5:armhf tk8.5-dev:armhf tcl8.5:amd64- tcl8.5-dev:amd64- tk8.5:amd64- tk8.5-dev:amd64-
Unfortunately it's still not possible to install the pidgin build-deps, i'm still looking into this.