AArch64 Bootstrap Stage2 Notes
Here's what changed from f17 to get aarch64 to bootstrap (using the rootfs built in stage1) in build order as determined by dependencies in the make file fragments. Stage1 details are here.
A copy of the current state of the stage2 rootfs can be retrieved from:
$ git clone http://fedorapeople.org/groups/armv8/rootfs.git
This rootfs can be used directly as an NFS root mount point if you have access to either the ARM FAST model or the ARM Foundation model (see http://www.arm.com/fvp); details for doing so are in Using ARMv8 Bootstrap Root FS via NFS root. With some preparation, you can also turn this set of files into a rootfs disk image that can be used with the ARM Foundation model (see ARMv8 using Fedora17 Bootstrap Image and ARM Foundation Model).
NB: just as with stage1 ( AArch64 Bootstrap Stage1 Notes), the sources used can be found here:
Look in the subdirectories f17/changed (which should have been copied into SRPMlocal in your copy of the bootstrap directory), and in the subdirectory f17/unchanged (which should be copied into SRPMs in your bootstrap directory).
To work with the stage2 rootfs, follow the instructions pointed to above and boot a model and either an NFS root or a disk image. Once you have booted into the rootfs, however, continuing the stage2 build is pretty straightforward:
# cd /stage2 # ./stage2
You will be running in a BusyBox environment at that point, and you do have most basic commands, and basic job control.
Patched aarch64 support to config.sub and config.guess. Patched use of gnulib to remove deprecated use of gets(). Added patches to cpio.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to ncurses.spec.
Patched aarch64 support to config.sub and config.guess. Patched use of gnulib to remove deprecated use of gets(). Added patches to m4.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to flex.spec.
Patched aarch64 support to config.sub and config.guess. Patched use of gnulib to remove deprecated use of gets(). Added patches to bison.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to readline.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to texinfo.spec.
Started with 7.5 version of the source (from f18), since the upstream patch uses ptrace and as such it did not apply to the 7.4 version; several functions ended up rewritten or replaced so that in some cases the upstream patch was referring to code that did not exist in 7.4.
Further, the upstream patch was incomplete. While it got most parts, it made the assumption that the subdirectories bfd/, opcodes/, and include/ had all been updated to reflect the latest binutils for aarch64; this was not the case for f17. So, merged each of those directories with the binutils files (in the same directories) from stage1 in order to add support for aarch64 everywhere it was needed.
Patched aarch64 support into config.sub and config.guess. Added all of these patches to gdb.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to libtool.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to gdbm.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to db4.spec.
Patched the definition of Perl_repeatcpy() in util.c so that the last argument was consistently defined; it had been type IV (which defaulted to 64-bit on aarch64) in the definition, but type I32 (32-bit) in the declaration. Added patch to perl.spec. Enabled a second patch that correct the installation path from /usr/lib/perl5 to /usr/lib64/perl5.
Patched aarch64 support to config.sub and config.guess. Added patch to curl.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to nspr.spec.
Patched _linux.cfg and _linux.h in pr/include/md to add in the aarch64 architecture; cloned the definitions used from ia64, another LP64 platform. Added patch to nspr.spec.
Patched aarch64 support to config.sub and config.guess. Added patch to pcre.spec.
Changed the recipe.d make snippet so that documentation is not installed. When running
make install, the command lines generated (e.g., when installing the HTML files or man pages) are quite long and will sometimes get cut in odd places causing the make to fail, but only for the documentation; everything else has built properly.
Patched aarch64 support to config.sub and config.guess. Added patch to gettext.spec.
Repaired deprecated use of gets() in old versions of gnulib, added patch to spec file.
Everything compiles automatically just fine; the make install step fails. The cause appears to be overly complex shell code in some of the Makefiles created by ./configure (in particular in gettext-tools/src and gettext-tools/man). For reasons yet to be determined, these Makefiles will fail because portions of shell variables have been completely corrupted; in the gettext-tools/src case, a list of the executables to be installed in the install-binPROGRAMS step gets horribly mangled so it tries to install programs that of course do not exist ('omm', in one case, which I thought was kind of funny, because I was no longer calm since the name should have been 'excomm' :). Because the Makefiles are in error, and not the Makefile.in or Makefile.am, these would have to be patched after running the configure step; this can be fixed in the recipe.d snippet for gettext but for now I have created Makefiles called Makefile.hacked in the directories mentioned above and do the make install step by hand. So, if you want to rebuild gettext in stage2, let it do 'make', and let it get as far it can with 'make install'. When it does fail, go into the stage2/builds/gettext directory and where ever there is a Makefile.hacked file, copy that to Makefile. Then, cd to stage2/builds/gettext and run 'make install', which should now complete. When it does, 'touch stage2/done/gettext' to let the stage2 build continue to the next step.
Patched aarch64 support to config.sub and config.guess. Added patch to popt.spec.
This requires gettext and popt to be built first but did not have them as "#requires" in the recipe.d file; added them.
Patched aarch64 support into config.sub and config.guess. Added patch to sqlite.spec.
Patched aarch64 support into config.sub and config.guess. Added patch to pth.spec.
Add in lib64 as a possibility in the recipe.d/0020-openssl make snippet so correct library search paths are used.
Patched aarch64 support into config.sub and config.guess. Added patch to popt.spec.
Added in upstream patch created by ARM for libffi.
Patched aarch64 support into config.sub and config.guess. Added patch to libffi.spec.
Patched aarch64 support into config.sub and config.guess (two sets of them). Added patches to pkgconfig.spec.
This one was nastier than most. First, recipe.d/0023-glib2 contained a sed of Makefile.in that was a bit overzealous in what it changed, causing the Makefile produced to fail; that has been removed entirely in favor of a patch in the SRPM instead. Secondly, there were instances in glib/Makefile and gio/Makefile where the steps generated by automake for install steps failed when executed -- there appears to be a problem in using pipes via shell commands in makefiles that needs to be hunted down. Regardless, the net result would be that 'make install' would not work in some cases. For those cases, unlike in gettext above, we could create a patch to Makefile.in so that ./configure would work properly. And, finally, config.sub and config.guess both needed to support aarch64. Built a patch for all of the above, and added it to glib2.spec.
No changes needed to the source tree. The recipe.d/0023-nss-utils file from bootstrap.git did need an additional export of USE_64=1 to force a 64-bit version to be built.
The recipe.d/0024-nss-softokn file from bootstrap.git did need an additional export of USE_64=1 to force a 64-bit version to be built.
There is an infinite loop somewhere in the shlibsign command being generated by this package. For the time being, I completely disabled the use of the tool as it is not really needed for the bootstrap. What the command does is generate checksum files that would be used to maintain FIPS140 certification; since we're not likely to need that any time soon during stage2, it was commented out and put in a patch to be un-applied at some point in the future.
Needed autoconf. Added autoconf-2.68-4.fc17.noarch to rootfs. Also needed aarch64 support in config.guess/config.sub.
Patched recipe.d file to install in lib64. There were a couple of errors during install which needed fixing. First, install tried running /usr/sbin/ldconfig but ldconfig was in /sbin. /sbin should be a link to /usr/sbin in fc17, so I moved all files from /sbin to /usr/sbin and made /sbin a link. Second, ldconfig complained about /usr/lib64/libstdc++.so.6.0.17-gdb.py not being an ELF file. That file actually belongs in /usr/share/gdb/auto-load/usr/lib64/ so I moved it there.
Patched config.guess/config.sub for aarch64. Patched recipe file to install in lib64.
Patched recipe.d file to install in lib64.
Patched stage2/rpmbuild/BUILD/tzdata/Makeconfig to have reasonable values for objpfx and install_root variables. The sources in stage2/rpmbuild were created from "rpmbuild -bp" and this left objpfx with a path from the host running rpmbuild. It left install_root defined as @install_root@ because that text replacement isn't done until the install step in the spec file.
Patched recipe.d file to install in lib64. Also patched same file to override TARGET variable defined in local.conf and passed on make command line in stage2 script. The libsepol Makefile defines it's own TARGET variable so TARGET coming from local.conf had to be overridden.
First attempt failed during install:
make: Entering directory `/stage2/builds/attr/attr' ../include/install-sh -m 755 -d /usr/bin /bin/sh ../libtool --mode=install ../include/install-sh -m 755 attr /usr/bin ../libtool: line 3646: install_prog+=../include/install-sh: not found ../libtool: line 3646: install_prog+= -m: not found ../libtool: line 3646: install_shared_prog+= -m: not found ../libtool: line 3646: install_prog+= 755: not found ../libtool: line 3646: install_shared_prog+= 755: not found ../libtool: line 3646: files+= attr: not found libtool: install: you must specify an install program libtool: install: Try `libtool --help --mode=install' for more information.
Investigation showed this to be very much like the problem with gettext builds described above. As seen above, /bin/sh is the shell used to run the libtool script. I could reproduce this by running the command by hand. If I substitute /bin/bash or run libtool directly, the install succeeds. So /bin/sh does indeed seem to be the problem here. The SHELL var used when invoking libtool is hardcoded to /bin/sh in stage2/rpmbuild/BUILD/attr-2.4.4/include/buildmacros. So a patch for this file was added so that SHELL is /bin/bash.
Need same SHELL var patch to buildmacros file as attr package. It would probably be better to just link /bin/sh to /bin/bash rather than using the busybox shell.