Scripts to build a cross-compiler for Raspberry Pi on Linux.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Thanks to
	Mikhail Kupchik
	http://www.gurucoding.com/en/rpi_cross_compiler/index.php

and
	Sebastian Dreßler
	https://coderwall.com/p/k1wqdw


About my build variants:
~~~~~~~~~~~~~~~~~~~~~~~~

Variant 1:
	I started off with Mikhail's scripts which are well documented and
	thus are a good soure of information for cross-compiler beginners.
	Since Mikhail creates a toolchain running on Windows (mingw), some
	of his steps are not neccesary for a Linux toolchain (see directory
	bin-v1/).

	Build variant 1 uses exactly the same source versions as Mikhail.

Variant 2:
	Use the scripts from variant 1 to build a recent compiler (newer
	software versions, gcc-4.9).

Variant 3:
	Having time to think during endless compiler runs I was wondering
	why Mikhail needs a third gcc build step. Browsing the internet
	I found Sebastian's work which needs only two gcc build steps.

	Build variant 3 uses Sebastian's build procedure with some adoptions
	from Mikhail.



For build variant 1 or 2 run
> bin-v1/00-build-all 1 (or 2)

For build variant 3 run
> bin-v3/00-build-all 3


Results
~~~~~~~

All build variants create a cross toolchain under /opt/gcc-${name}.
Variant 2 and 3 produce a not yet released gcc version 4.9.

I was able to run the gfortran compiler (that was my final target)
on a Debian Wheezy amd64 machine and execute the resulting binary
on a Raspberry Pi. My demo program tests/uses its hardfloat capabilities.


ToDos
~~~~~

Although all build variants obviously create a working toolchain
some doubts and uncertainities remain.

1)
First of all the target triplet for arm on Raspberry Pi seems not
to be defined consistently. RPi itself reports 'arm-linux-gnueabihf'
(dpkg-architecture command) but there are various sources with other
definitions including the scripts from the authors mentioned above.

arm-linux-gnueabihf
arm-none-linux-gnueabihf
armv6l-unknown-linux-gnueabihf

Is it true the triplet (or quad) definition depends on software package
(kernel, gcc, etc.) and version?


2)
Mikhail applies a lot of patches to his source and make files.
With newer software versions many patches fail due to various reasons.
Those who have been incorporated upstream simply can be dropped. But what
whith the others?


3)
If everything works as expected the build process seems to be
rather straightforward. The picture changes completely however if some
build step fails. Then you have to dive into the internal build steps
of gcc (or whatever tool fails). Building the gcc suite from scratch
(cross compiler or not) is not a trivial task. Escpecially those many 
configure options of eglibc and gcc (many of them only defined internally 
like libc_cv_*) leave you puzzled about how the whole things works. 

The commandline arguments in my build scripts have been taken from the 
authors mentioned above. I suspect some of them can be removed still 
giving the same result. May be someone wants to invest some time for 
further research. I didn't. 
