From Fedora Project Wiki

AArch64 Bootstrap Stage 1 Notes

Here's what changed from f17 to get aarch64 to bootstrap (using the ARM supplied 2012Q2 cross-compiler set), in order of the steps taken in DJ's stage1 script.

The current versions of all the scripts used are in git:

$ git clone http://fedorapeople.org/groups/armv8/bootstrap.git 

Patches/improvements are always welcome.

A copy of all of stage1 (as part of a root file system) can be found here:

http://fedorapeople.org/groups/armv8/rootfs.git

A git clone of the repository will get you a copy of everything in its current state.

Most importantly, all of the modified SRPMs used are in changed/ under http://fedorapeople.org/groups/armv8/SRPMs/f17, and the unchanged SRPMs are in the unchanged/ directory also under the above location. It is unclear at this time whether these changes will be committed back into f17 itself; it's more likely they'll end up in f18 or f19.

If you have access to cross-compilers for ARMv8 in your PATH, and those cross-compilers are named aarch64-redhat-linux-gnu-*, you should be able to recreate all of stage1 with the following:

 
$ git clone http://fedorapeople.org/groups/armv8/bootstrap.git
$ cd bootstrap
$ mkdir f17-local
$ scp username@fedorapeople.org:/project/armv8/SRPMs/f17/changed/* f17-local
$ ln -s f17-local SRPMlocal
$ mkdir f17-sources
$ scp username@fedorapeople.org:/project/armv8/SRPMs/f17/unchanged/* f17-sources
$ ln -s f17-sources SRPMs
$ ./stage1

If you do not have cross-compilers with names of the form given above, you will need to edit the stage1 script to point at the right places.

usrlinks

Had to add in 'cd /; ln -s usr/libexec libexec' for use by the ARM compilers during stage2; this was a change to the stage1 script.

kernel-headers

Used the APM provided kernel tree -- jcm or dmarlin may have more details.

binutils

Source: binutils-2.22.52.0.1-13.fc17.aarch64_1.src.rpm

Used version from jcm; I believe this started from the upstream patch originally submitted and was then beat into submission.

gcc-host

Source: gcc-4.7.1-1.fc17.0.aarch64.src.rpm

The f17 version of GCC was not usable; dmarlin started from the upstream created patch, but then found it was necessary to move to GCC 4.7.2 to get the patch to apply in any reasonable fashion.

glibc-headers

Source: glibc-2.16-17.fc17.aarch64_0.src.rpm

Started from the f18 source tree, and applied the upstream glibc patch; this applies pretty cleanly with this version, but not so much with f17.

Further, this path cleared up a problem where fdopen() would segfault when opening a pipe (e.g., stdin or stdout). At the same time, though, this version of glibc deprecates gets() which causes additional changes in some other packages.

gcc-glibc

See gcc-host step.

glibc

See glibc-headers step.

gcc

See gcc-host step.

dev

No changes needed. Make sure you are present when this step is run since it does invoke sudo.

kernel

N/A. This step was ignored for now and a vendor provided kernel was used for expediency's sake.

gmp

Source: gmp-5.0.2-6.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to gmp.spec.

mpfr

Source: mpfr-3.1.0-2.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to mpfr.spec.

mpc

Source: libmpc-0.9-2.fc17.2.aarch64.src.rpm

Added aarch64 to config.sub, added patch to libmpc.spec.

ppl

Source: ppl-0.11.2-8.fc17.aarch64.src.rpm

Added aarch64 to config.sub (two of them), added patch to ppl.spec.

cloog

Source: cloog-0.15.11-3.fc17.1.aarch64.src.rpm

Added aarch64 to config.sub, added patch to cloog.spec. Modified the build step in stage1 from:

make $J

to:

make $J LDADD="-rpath '${ROOTFS}/lib:${ROOTFS}/usr/lib' -lcloog"

to workaround symbols/libraries not being found during build. Unclear whether this is the right fix or not, or whether there's actually a libtool/rpath problem.

libsepol

Source: libsepol-2.1.7-3.fc17.src.rpm

No changes needed.

libselinux

Source: libselinux-2.1.10-4.fc17.src.rpm

No changes needed to the source. Had to modify the make step in the stage1 script to work around missing symbol/library issues found; added the following to the end of the make command:

LDFLAGS="-Wl,-rpath -Wl,${ROOTFS}/lib"

zlib

Source: zlib-1.2.5-7.fc17.src.rpm

No changes needed.

t-binutils

See binutils step.

t-gcc

See gcc-host step.

bash

Source: bash-4.2.37-2.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to bash.spec.

make

Source: make-3.82-13.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to make.spec.

sed

Source: sed-4.2.1-10.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to sed.spec. It was also necessary to modify the make step in the stage1 script to work around symbols/libraries not being found; that step went from:

make $J V=1

to:

make $J V=1 CFLAGS="-lselinux -Wl,-rpath -Wl,${ROOTFS}/lib"

coreutils

Source: coreutils-8.15-7.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to coreutils.spec. It was also necessary to modify the make step in the stage1 script to work around symbols/libraries not being found; that step went from:

make $J V=1

to:

make $J V=1 CFLAGS="-lselinux -Wl,-rpath -Wl,${ROOTFS}/lib"

And finally, since glibc is now at 2.16, use of gets() is deprecated, and the version of gnulib source being used still referenced it, so removed those uses of gets().

util-linux

Source: util-linux-2.21.2-2.fc17.aarch64.src.rpm

Added aarch64 to config.sub(s), added patch to util-linux.spec.

Also had to add aarch64 as a recognized architecture in the fdisk code for disk labels.

tar

Source: tar-1.26-7.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to tar.spec.

Since glibc is now at 2.16, use of gets() is deprecated, but the version of gnulib source being used still referenced it, so removed those uses of gets().

gzip

Source: gzip-1.4-6.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to gzip.spec.

Since glibc is now at 2.16, use of gets() is deprecated, but the version of gnulib source being used still referenced it, so removed those uses of gets().

bzip2

Source: bzip2-1.0.6-4.fc17.src.rpm

No changes needed.

diffutils

Source: diffutils-3.2-6.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to diffutils.spec.

Since glibc is now at 2.16, use of gets() is deprecated, but the version of gnulib source being used still referenced it, so removed those uses of gets().

findutils

Source: findutils-4.5.10-4.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to findutils.spec.

Since glibc is now at 2.16, use of gets() is deprecated, but the version of gnulib source being used still referenced it, so removed those uses of gets().

gawk

Source: gawk-4.0.1-1.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to gawk.spec.

patch

Source: patch-2.6.1-12.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to patch.spec. Added -ldl to the LIBS variable in Makefile.in.

unzip

Source: unzip-6.0-5.fc17.src.rpm

No changes needed.

which

Source: which-2.20-3.fc17.src.rpm

No changes needed.

xz

Source: xz-5.1.2-1alpha.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to xz.spec.

grep

Source: grep-2.14-1.fc17.src.rpm

No changes needed.

distcc

Source: distcc-3.1-5.fc17.aarch64.src.rpm

Added aarch64 to config.sub, added patch to distcc.spec.

ccache

Source: ccache-3.1.7-1.fc17.src.rpm

No changes needed.

stage2

The values "--with-arch=armv8 --with-fp=neon-armv8" were being passed via TCONFIGARGS to the various build steps in stage2. It turns out that nspr really dislikes that in its configure step, and so far no other packages care. So, removed these from the part of this step that generates local.conf for stage2.

I often disable distcc by hand; I'm investigating why, but it appears that the ARM FAST model networking when using the APM kernel will sometimes go awry. If you're using distcc -- which will quite often work -- I'd recommend adding --log-file and --log-level info to the distccd.script and look for fun things like this:

distccd[2087] (dcc_check_client) connection from 172.17.100.2:56109
distccd[2087] compile from chkconfig.c to chkconfig.o
distccd[2087] (dcc_readx) ERROR: unexpected eof on fd5
distccd[2087] (dcc_r_token_int) ERROR: read failed while waiting for token "DOTI"
distccd[2087] (dcc_job_summary) client: 172.17.100.2:56109 OTHER exit:0 sig:0 core:0 ret:108 time:675ms

It is not clear what the root cause of the error is, and it does not always occur, nor does it necessarily occur in the same compile.

Despite that, distcc seems to work just fine.

Note that "disabling" distcc implies setting these values:

J=-j1
DISTCC_HOSTS=localhost

in the file stage2/local.conf in the rootfs.

There is a strangeness with the stage2 building of local.conf where it will not always generate the DISTCC_HOSTS line properly. For example, because of VPNs and bridging my hostname ends up having the address 127.0.0.1 which is completely useless for distcc. It's not clear there's a good way to fix this, though, since desktop environments could vary wildly.

busybox

Source: busybox-1.19.4-4.fc17.aarch64.src.rpm

Added in BusyBox to make the user experience quite a bit nicer. It's not a full version (no NFS mounts or getty yet) but it provides a fairly rich toolset. An /etc/fstab file is also written into the stage2 rootfs that adds in /proc and /sys, and /etc/init.d/rcS is written so that it will mount them (mount -a).

For busybox itself, a patch was added (busybox-aarch64.patch) that adds in the config we use for the rootfs, and another patch that adds an include for <sys/resource.h> for several files that were missing it. The spec file was also updated to include the new patches.