kernel: http://lwn.net/Articles/505682/ binutils: http://sourceware.org/ml/binutils/2012-07/msg00269.html gcc: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01694.htmlGiven that I have never touched a bare metal toolchain, I thought this was a good thing to pass the time, so I started playing with these pieces and got to compile binutils, gcc and the kernel, from the patches submitted. Now it is easier given that binutils support was merged.
I don't really use cvs, just downloaded the latest snapshot of binutils (2.22.90 doesn't have aarch64):
wget ftp://sourceware.org/pub/binutils/snapshots/binutils.tar.bz2Extract.
Assuming you are at /my_tc, you create build/binutils and compile from there, your source is at /my_tc/binutils-latest/.
$ cd /my_tc/build/binutils/ $ /my_tc/binutils-latest/configure --prefix=/my_tc/out --target=aarch64-none-linux-gnu --disable-werror $ make -j4 && make installAnd for gcc:
svn checkout http://gcc.gnu.org/svn/gcc/branches/ARM/aarch64-branchAssuming you are at /my_tc, you create build/gcc and compile from there, your source is at /my_tc/aarch64-branch/.
$ cd /my_tc/build/gcc/ $ /my_tc/aarch64-branch/configure --prefix=/my_tc/out --target=aarch64-none-linux-gnu --disable-nls --enable-languages=c --disable-threads --without-headers --with-newlib --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath $ make -j4 && make install $ export PATH=/my_tc/out/bin:$PATH $ export CROSS_COMPILE=aarch64-none-linux-gnu- $ export ARCH=arm64Get the kernel:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64.git $ cd linux-aarch64 $ make allnoconfig && make -j4And now you have a compiled kernel with a bare metal toolchain. You can play with the menuconfig or just go randconfig and fix some of the bugs too.
---
Back then when aarch64 binutils wasn't merged, I had to download and patch binutils code and regenerate the makefile and include files. Something like:
1. Download binutils-2.22.90, patch it with aarch64 changes. 2. automake on bfd/, binutils/, gas/, ld/ and opcodes/; automake must be 1.11.1. 3. autoconf on top configure file, bfd/ and opcodes/; autoconf must be 2.64. 4. configure and make, and wait for it to break or just run configure inside bfd in order to get a Makefile there. 5. cd bfd/; make headers and cd -, this will generate some missing symbols. 6. Now you can either clean your previous failed build or continue it.And then follow the steps to compile binutils, gcc and kernel.
No comments:
Post a Comment