ts-7000
[Top] [All Lists]

Re: [ts-7000] Anyone have directions on how to build crosstools on a Mac

To:
Subject: Re: [ts-7000] Anyone have directions on how to build crosstools on a Mac?
From: Christopher Friedt <>
Date: Wed, 23 Jan 2008 13:11:59 +0100
You should have no problem if you wanted cross compile the toolchain 
from scratch, as long as you have gcc, binutils, etc that work natively 
on your machine.

I use gentoo's crossdev to compile all of my toolchains, but that's also 
simply building from source using a set of pre-defined functions, 
environment variables, etc.

If you wanted to use the same method to build, without having to install 
any gentoo-specific stuff, simply write your own bash script to do all 
of the steps that crossdev / emerge do.

Find a portage mirror at http://www.gentoo.org/main/en/mirrors2.xml

download <mirror>/snapshots/portage-latest.tar.bz2

make a directory in your home called portage_tmp
mkdir ~/portage_tmp

tar xjf portage-latest.tar.bz2 \
        portage/eclass/toolchain* \
        portage/sys-devel/gcc \
        portage/sys-devel/binutils \
        portage/sys-libs/glibc \
        portage/sys-devel/crossdev \
        portage/sys-kernel/linux-headers \
        -C ~/portage_tmp

What crossdev does is this, in this order:

1) build binutils
2) build a stage1 cross-gcc
3) pre-process/install the linux kernel headers for the target arch
3) build a cross-glibc
4) build a stage2 cross-gcc
optionally
5) build g++,gcj, etc

(read crossdev for more info, it's in the portage tree under 
portage/sys-devel/crossdev/files)

It also uses the following standard variables for ./configure:

--prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/info
--datadir=/usr/share
--sysconfdir=/etc
--localstatedir=/var/lib

Crossdev installs the cross-toolchain in your / filesystem in certain 
non-invasive paths, such as

/usr/arm-softfloat-linux-gnu
/usr/lib/gcc/arm-softfloat-linux-gnu

I would suggest for each of binutils,gcc,linux-headers, & glibc, having a
<pkg>/
<pkg>/<pkg>-<ver>
<pkg>/<pkg>-build
<pkg>/<pkg>-install

structure. For example, extract gcc-<ver>.tar.bz2 to gcc/gcc-<ver>, 
apply any patches that are necessary[2], cd to <pkg>-build, run 
../gcc-<ver>/configure (with the appropriate OPTS, --host, --target, 
--build defined), and when you do the install, say make 
DESTDIR=../gcc-install install.

WARNING: glibc does not recognize DESTDIR, you must use
make install_root=../glibc-install. If you install to / you will 
paralyze practically your entire system whenever the ld cache tries to 
refresh.

Furthermore, when cross-compiling for arm, you will need to apply the 
@probits patch for arm/sysv.S.

See this thread:

http://www.nabble.com/bug-introduced-in-GCC-patches-td14946303.html

[2] Use any of the portage mirrors for patches, like this mirror for 
instance:

http://adelie.polymtl.ca/distfiles/

I had at one point in the summer attempted to use crossdev to create 
canadian-cross-compile a toolchain for mac, built on my linux pc, 
targeting the arm - i think i ran into problems when i needed the mac 
osx headers though.


Cheers,

Chris


gamehoser wrote:
> I'm running Leopard and figured that it'd be pretty straightforward to
> get a cross compiler set up so that I could build my 2.6 kernel and
> other stuff on a faster machine instead of compiling right on my TS7300.
> 
> I downloaded crosstools and configured it according to what I was able
> to glean out of examining the linux binary distribution that TS
> provides for the 2.6 kernel, but I'm having no end to the number of
> problems I get.  Some of them have been easy to fix, but I now have
> one and I don't even understand what the error is telling me.
> 
> If anyone has instructions on how to build a working crosstool chain
> that can compile a 2.6 kernel for a TS board on Leopard(or maybe even
> 10.4 instructions would be close enough), I'd be forever grateful.
> 
> In the mean time, I'll keep banging away at what I have so far, but
> I'm not too confident there's a light at the end of the tunnel so far.
> 
> Thanks,
> James
> 
> 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU