[TriLUG] OT: cross compiling

Joseph Mack NA3T jmack at wm7d.net
Tue May 9 10:04:06 EDT 2006


This is my first attempt at cross compiling and I'm a little 
unclear as to how it works. I'm following the recipe at 
slacy.com, cross compiling on Linux for the target cpu = 
Atmel AVR (the real target is IBM AIX).

The first step is to produce the binutils. To prevent 
namespace collisions, the output binaries are given the 
prefix "avr-", so I get avr-ar, avr-nm etc in /usr/bin after 
make install on my linux box.

The only collision is a new /usr/lib/libiberty.a which 
overwrites my current libiberty.a - it has a different size 
than the one I produced in a parallel run with the target 
set to i686-pc-linux-gnu.

Is this libiberty.a OK to leave in /usr/lib/? According to 
`file`, it's a regular LSB 80386 executable.

I had asssumed that the avr-ar, avr-nm I was producing were
for the target AVR CPU, but according to `file`, they're 
also regular linux binaries. They fire up quite happily on 
my linux box from the command prompt.

If I've done this right, then presumably avr-ar etc are used 
to make the cross compiler (the next step) and not to be 
copied to the target machine?

Presumably the next stage, I produce the cross compiler 
which will have a name like avr-gcc and will live in 
/usr/bin/. To produce the native ar for the target box, I 
would use /usr/bin/avr-gcc to compile binutils with the 
target being "avr"? Assuming I have the native ar, how do I 
handle the `make install`? I can't use --prefix=/usr or it 
will clobber my linux files. If I use --prefix=/usr/avr, 
this will clobber my cross compile executables. Where should 
I install to on my linux box (/usr/avr-native/ ?). Assuming 
I can compile these native executables, and I tar| untar 
them to the target box, say under /usr/gnu, will the native 
ar, nm etc expect to be in the original install directory 
(say /usr/avr-native) and looking for files/libs there 
rather than under /usr/gnu?

Thanks Joe

  -- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml 
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list