Initial Debian/Ubuntu arm64 bootstrap

This page is now largely of historical interest. The current state of the port is documented on Arm64Port.

The initial port was done entirely as cross-build using Ubuntu raring packages as multiarch and the cross-toolchains were more advanced there than in Debian. The resulting image and updates were then used to natively build most of saucy once real hardware that worked was available. Then that image was used (in Qemu) to natively build a Debian buildd image.

Raring rootfs for Foundation model

Here is an older (512MB) basic configured image to download for use in the model (or on real hardware should you have some).

You will need the ARM Foundation Model to run it on which is proprietary, but cost-free, and available from http://www.arm.com/products/tools/models/fast-models/foundation-model.php (you will need to get an account).

Download that and unpack it (it will make a dir called Foundation_v8pkg).

All the other files you needs are available here

Get the arm64 disk image (last updated 2013-03-12 16:30):

wget http://people.debian.org/~wookey/bootstrap/rootfs/raring.img.gz
gunzip raring.img.gz

Now has networking, apt, build-essential and debhelper and thus can be used for native building.

Alternatively you can use the Ubuntu Core base system tarball built from Ubuntu 13.10's binaries (Ubuntu builds arm64 as of 13.10).

Get the kernel+bootwrapper:

This is a kernel and also contains the kernel command line. There are two, linux-system-foundation.axf, which runs init=/bin/sh, and linux-system-foundation-upstart-verbose.axf which runs init=upstart --verbose

wget http://people.debian.org/~wookey/bootstrap/rootfs/linux-system-foundation.axf
wget http://people.debian.org/~wookey/bootstrap/rootfs/linux-system-foundation-upstart-verbose.axf

Now you can run the model/image with:

Foundation_v8pkg/Foundation_v8 --image linux-system-foundation-upstart-verbose.axf --block-device raring.img --network=nat

That's it. It uses 2G of memory, and on my machine takes about 35 seconds to show the 'serial console' window, then another 1.5 mins or so to boot to a prompt, with a long pause whilst it mounts, displaying nothing new. Have patience!

log in as 'root', no password

Networking should work automatically. If not see what :

ifup eth0

does. You should get an outward-only network connection if a dhcp server is visible. See https://fedoraproject.org/wiki/Architectures/ARM/AArch64/FoundationModel_Networking for more networking details.

Building your own rootfs image

You can build an image as above very easily. The image the models take are a simple ext4fs block device. makeimg is a handy script to make a blank device, format it, then run multistrap with a suitable config to download and unpack debs, plus install a few config files to set things up.

Currently thats: add an upstart job for the serial console, set a root password to nothing (care!), set PERL5LIB to work round the fact that it's currently incomplete in the multiarch perl package, turn off recommends, and set up /etc/fstab, and /etc/networkin/interfaces

Download the makeimg script and the multistrap config files:

wget http://people.debian.org/~wookey/bootstrap/rootfs/arm64-makeimage.tgz
tar -xzvf arm64-makeimage.tgz

Build an image with:

./makeimg

Which will ask for sudo password. You need to be in the makeimg dir. And note that this is the sort of script that can accidentally format your hard drive if things go wrong. It has some checks to try and avoid disaster, but take a bit of care and don't blame me if it all goes badly.

That image now has unpacked deps in it, but they need their configure scripts (and in some cases preinsts) running natively to make it properly bootable.

Run the model with the 'init=/bin/sh' kernel:

Foundation_v8pkg/Foundation_v8 --image linux-system-foundation.axf --block-device raring.img

Assuming you get a prompt run the config script to do some fixups and the second-stage bootstrap

./config.sh

A few packages will still fail to configure as they depend on upstart having started.

Look inside config.sh to see what it does and do manual fixups if needed (a different package set may need this).

One possible problem is:

Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

This can be fixed by diverting /sbin/initctl :

dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
./config.sh

See https://www.nesono.com/node/368

If you need to type anything more than a line then run bash (after export PATH) . It's _much_ nicer.

Reboot with upstart running:

Foundation_v8pkg/Foundation_v8 --image linux-system-foundation-upstart-verbose.axf --block-device raring.img --network=nat

It should either get to a prompt you can log in at as root (no password), or offer a maintenance shell.

bash
dpkg --configure -a

Should get everything set up.

Chroot bodges needed

The perl package in this chroot has a bug so you need to set: PERL5LIB=/usr/lib/aarch64-linux-gnu/perl/5.14.2 before using it.

Best thing to do is create a /etc/environment file containing:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
PERL5LIB=/usr/lib/aarch64-linux-gnu/perl/5.14.2

Toolchain Bootstrap Issues

Quantal bootstrap

The initial arm64 packaged toolchain was done in Ubuntu Quantal, as the first release where multiarch crossbuilding basically worked. The details of this are documented on toolchain/BootstrapIssues#Quantal.

Raring bootstrap

Easier than quantal as all the base porting has already been done. However not quite as easy as one might like. arm64-cross-toolchain-base was updated with some fixes/updates from the armhf/armel-c-t-b packages. Binutils and linux-libc-dev headers were straightforward.

But gcc stage1 build fell over first with bugs in gcc-4.7.2-12ubuntu2 (patches that didn't apply, missing arm64 symbols-files). Then with missing bits/predefs.h header when building libgcc. This turned out to be 1091823.

Then the build completed but there was a libgconv.a packaging error for some reason. Updating to gcc-4.7-2-14ubuntu2 seemed to fix that.

Building packages

The initial (quantal) version of the cross-toolchain only searched the old dpkg-cross library paths by default so you need this in /etc/dpkg/buildflags too:

DEB_LDFLAGS_APPEND="-L/usr/lib/aarch64-linux-gnu -L/lib/aarch64-linux-gnu -L/usr/lib -Wl,-rpath-link=/usr/lib/aarch64-linux-gnu:/lib/aarch64-linux-gnu:/usr/lib"

This is not an issue from gcc-4.7-14 onwards, so the above is not needed in raring or unstable. This is good because it breaks packages that need to build both BUILD_ARCH _and_ HOST_ARCH stuff.

Packages that are (cross) built for raring

Packages that needed fixes

Build-dependencies that need(ed) fixes

Mostly things need multiarchifying.

xz-utils builds fine if its cross build-deps are installed, but apt-get build-dep -aarm64 xz-utils fails saying that perl is not available. It doesn't matter if multiarch perl is already installed or not. xz-utils has a perl:any build-dep. This should now be a perl-base:any build-dep. This tested in quantal. Needs checking in unstable and raring.

Current list of things needed for debootstrap which have missing build-deps:

Packages that still need cross-building, but do have satisfiable cross-build deps (analysis done in quantal-bootstrap using dose-debbuildcheck):

acl
attr
base-passwd
bc
bison
bluez
boost1.49
bsdmainutils
bzip2
cairo
chrpath
consolekit
coreutils
cpio
cracklib2
cups
curl
cyrus-sasl2
datefudge
db-defaults
dbus-glib
docbook-to-man
doxygen
ed
elfutils
fastjar
fftw3
file
flac
fontconfig
freeglut
freetds
freetype
gcc-4.7
gcj-4.7
gconf
gdk-pixbuf
ghostscript
giflib
git
glib2.0
gnutls26
gobject-introspection
graphviz
groff
heimdal
hesiod
icu
ifupdown
ijs
iproute
iptables
jackd2
jasper
java-atk-wrapper
java-common
jbig2dec
jbigkit
json-c
keyutils
krb5
lcms
lcms2
libasyncns
libcap-ng
libcroco
libdatrie
libdrm
libedit
libevent
libffibinutils
libfontenc
libgcrypt11
libgd2
libglu
libgpg-error
libhdate
libice
libidn
libjpeg-turbo
libjpeg8-empty
libmng
libnfnetlink
libnih
libnl3
libogg
libpaper
libsamplerate
libsndfile
libthai
libtool
libunistring
libusbx
libverto
libvorbis
libx11
libxau
libxaw
libxcb
libxcomposite
libxcursor
libxdamage
libxdmcp
libxext
libxfixes
libxfont
libxi
libxinerama
libxml2
libxmu
libxpm
libxrandr
libxrender
libxslt
libxt
libxtst
libxv
libxxf86vm
linux
lirc
lynx-cur
m4
mawk
mesa
mscgen
mysql-5.5
nas
netpbm-free
nspr
nss
openjade1.3
openjdk-7
openldap
openslp-dfsg
opensp
openssh
orc
oss4
p11-kit
pam
pango1.0
patch
pcsc-lite
perl
pixman
pkg-config
plymouth
pmake
policykit-1
postgresql-9.1
procps
pulseaudio
python-defaults
python2.7
qt4-x11
rtmpdump
shadow
source-highlight
speex
swig2.0
sysvinit
tdb
texinfo
tiff
unixodbc
upstart
wayland
xfonts-utils
xft
xmlstarlet
xmlto

Packages that still need cross-building but don't have satisfiable build-deps (analysis done in quantal-bootstrap using dose-debbuildcheck):

binutils
eglibc
gawk
gcc-4.7
libxml2
linux
man-db
mpfr4
perl
fontconfig
freetype
gcj-4.7
gdk-pixbuf
git
gobject-introspection
gtk+2.0
libidn
libxcb
lynx-cur
openjdk-7
openldap
pango1.0
python2.7
gconf
ghostscript
ijs
jackd2
jbig2dec
libtool
libxslt
lirc
mysql-5.5
postgresql-9.1
bison
fftw3
gst-plugins-base0.10
gstreamer0.10
boost1.49
elfutils
graphviz
libgd2
policykit-1
source-highlight