Setting up an armv8 bootstrap/crossbuild chroot

Initial chroot setup

Create a basic schroot raring chroot

apt-get install sbuild
sudo sbuild-createchroot --components=main,universe --make-sbuild-tarball=/srv/chroots/raring-cross-arm64.tgz raring  /srv/chroots/raring

If you've not set up sbuild before, ensure you can use it (permissions and keys):

sbuild-adduser <your-username>
sbuild-update --keygen

Set it up:

sudo sbuild-shell raring-amd64-sbuild 

(Anything you do in the chroot during this session will be saved in the tarball, so is permanent)

Start by adding some tools so you can edit and download

apt-get install vim-tiny wget sudo

If you need your packages to be multiarch-installable alongside ones fro the Ubuntu archive (you probably do) you also need pkgbinarymangler so that changelogs are truncated in a matching way.

apt-get install pkgbinarymangler

files to add

(Use vi)


deb raring-bootstrap main universe
deb-src raring-bootstrap main universe

and edit /etc/apt/sources.list to arch-qualify the main archive

deb [arch=amd64] raring main universe
deb-src raring main universe


Package: *
Pin: release n=raring-bootstrap
Pin-Priority: 1001

Until the toolchain gains libssp support (which should be in gcc-4.9), you need this: /etc/dpkg/buildflags.conf

STRIP CFLAGS -fstack-protector


APT::Install-Recommends "0";
APT::Install-Suggests "0";

Commands to run

Install the archive key:

apt-key add bootstrap-archive.key

If you want to keep this as a clean build chroot then ctrl+D out now to save it.

Use with sbuild

Install packages to build with. You currently (May 2013) need the patched versions of dpkg, apt and sbuild from the raring-bootstrap repository to get build-profile support.

apt-get update
apt-get install dpkg  apt dpkg-dev libdpkg-perl sbuild

Then you can do sbuild arm64 builds with:

sbuild -c raring-amd64-sbuild -d raring --host=arm64 <package.dsc>

Ensure you have this in your /etc/sbuild/sbuild.conf (outside the chroot). It should be the default.

$crossbuild_core_depends = {
                              'arm64' => [

Updating the chroot

Sbuild does an "update, upgrade" before every build, but you can save some time by updating your chroot from time to time with

sbuild -c raring-amd64-sbuild --update --upgrade

Installing cross-toolchains

You can install the build-deps in the chroot now and and save them, or let sbuild do it for each build (which will guaranteee uptodateness, but will also require regular updates to libgcc1:arm64, linux-libc-headers:arm64, to keep in sync with uploads to the raring repository)

dpkg --add-architecture arm64
apt-get update
apt-get install crossbuild-essential-arm64 

Which installs libc-dev:arm64, aarch64-linux-gnu-gcc, aarch64-linux-gnu-g++, pkg-cconfig-aarch64-linux-gnu, dpkg-cross and dependencies.

Every time the build-arch versions of libgcc1 (gcc), linux-libc-dev (the kernel) or libc6 are updated in raring, crossbuild-essential-arm64 will become uninstallable until the arm64 versions are back in sync. This is an unfortunate effect of the mulitarch requirements for matching versions of co-installed MA: same packages.

Platform/DevPlatform/CrossCompile/arm64bootstrap (last modified 2013-11-25 12:18:31)