This page shows how to bootstrap a multiarch cross toolchain.

Multiarch-Cross-Toolchain, aka as known as Wookey's way, just lke cross-gcc does.

It has pacakges like gcc-<VERSION>-<TRIPLET>, it dpends on

This also shows how to bootstrap for a new architecture.

STEP 0 preparation

sudo debootstrap sid sid-chroot

sudo pbuilder login --no-targz --buildplace sid-chroot

sed -i ’s/^deb http/deb [arch=amd64] http/‘ /etc/apt/sources.list

echo “deb-src http://ftp.us.debian.org/debian sid main” >> /etc/apt/sources.list

dpkg --add-architecture mips64el

apt-get update

apt-get install binutils-mips64el-linux-gnuabi64 devscripts rdfind symlinks

STEP 1 build gcc stage1

apt-get build-dep gcc-5

apt-get purge libx32* libc6-i386 libc6-x32 # they conflicts with mips64el multilib packages

apt-get source gcc-5

apt-get install cross-gcc-dev

cd gcc-5-*;

sed -i '/^ada_no_cross/c ada_no_cross := yes' debian/rules.defs

Then run:

BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage1 dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

We can get these deb files:

STEP 2 build linux-libc-dev

apt-get source linux; cd linux-*

make -f debian/rules.gen binary-libc-dev_mips64el

dpkg -i ../linux-libc-dev*.deb

STEP 3 glibc stage1

apt-get source glibc; cd glibc-*

Then run

dpkg --force-all -i ../libc6*.deb

STEP 4 gcc stage2

on the same source with stage1 gcc.

BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip DEB_STAGE=stage2 dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

We can get these Debs

install them

STEP 5 glibc stage2

DEB_STAGE=stage2 DEB_GCC_VERSION=-5 dpkg-buildpackage -B -amips64el -d

We can get Debs and install them

dpkg -i ../libc6_*_mips64el.deb ../libc6-dev_*_mips64el.deb ../libc6-dev-mips*.deb ../libc6-mips*.deb

STEP 6 gcc stage3

with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d

STEP 7 gmp/selinux

STEP 8 gcc with gnat support

sed -i '/^ada_no_cross/c ada_no_cross := no' debian/rules.defs

with_deps_on_target_arch_pkgs=yes DH_VERBOSE=1 WITH_SYSROOT=/ BACKPORT=false PKG_IGNORE_CURRENTLY_BUILDING=1 DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage --target-arch=mips64el -b -uc -us -d