Cross compilation

From flashrom
Revision as of 21:21, 6 May 2013 by Hailfinger (talk | contribs) (Initial frustration writeup.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cross building on Linux for non-Windows/non-DOS operating systems is what can generally be described as a nightmare. Prepackaged cross compilers are not available, and various websites on the net explain how to build toolchains for either totally obsolete operating system releases or the solutions simply don't work. Having a recent native gcc on the host makes things a lot worse because older gcc versions and their support libraries can't be compiled with recent gcc. If in doubt, gcc documentation should not be followed unless you want to experience failure firsthand.

This page is an attempt to list what worked, what didn't work and where instructions are just crap.

First things first:

  • Get everything in a clean state. If you have any previous unfinished/non-working/working cross compiler, binutils, include files or libraries for a given target, use rm -rf liberally and start from scratch.
  • If you can download a prepackaged cross compiler for DOS (DJGPP) or Windows (cross MinGW), use it! I'm not going to cover this if I can help it.
  • If you can download a prepackaged cross compiler for non-x86 Linux, use it!
  • These instructions are for a host running an x86_64 installation of openSUSE Linux 12.2, but they should work on other distributions.
  • openSUSE has a repository with extra cross compilers in Torsten Duwe's home project at the Open Build Service.
  • Cross compilers and binutils are going to end up in /opt/cross/ .