Subject: gcc-2.7.2.2

From: "Ka'Plaagh" <[email-masked]>
Date: Wed, 28 Jan 1998 13:48:07 +0000

All,
	following help from the list, I have managed to build gcc-2.7.2.2.  I've
written down the steps for myself (rotten memory), so here they are for anyone 
who wants to do the same thing...

Dave

--------
HOWTO Build GNU Cross Tools for (Strong)ARM
-------------------------------------------

David A Rusling ([email-masked]) January 1998

Overview
--------

This HOWTO describes, step by step, how to build cross compiler
version of GCC-2.7.2.2 and binutils-2.7 on an Intel Linux system.
This results in a set of ARM compilers, assemblers, linkers and
so on that will run on an Intel Linux system but generate A.OUT
format ARM object files and executable images.   This is the
set of tools currently being used for Linux kernel development in
the ARM world.

I did the following on a Red Hat 5.0 Intel Linux system, I cannot
comment on what other systems this would work on.

Step 1: Find the Sources
------------------------

You will need a number of source trees:

binutils-2.7.tar.gz	- the master repository for GNU tools is

		ftp://prep.ai.mit.edu:/pub/gnu

binutils-arm-2.7.gz	- ARM Linux specific patch file for 
			  binutils-2.7.  This can be found on the
			  ARM Linux tools ftp/web site:

		http://www.arm.uk.linux.org/~rmk/armlinux/tools.html

gcc-2.7.2.2.tar.gz	- Again you can get this from

		ftp://prep.ai.mit.edu:/pub/gnu

crossgcc-gcc-2.7.2.2.patch
			- This is a set of patches to more easily
			  allow you to build cross compilation
			  tools.  You can find this on Cygnus's website

		ftp://ftp.cygnus.com:/pub/embedded/crossgcc

gcc-2.7.2.2.patch	- ARM Linux specific patch file for gcc-2.7.2.2,
			  again you can find this on

		http://www.arm.uk.linux.org/~rmk/armlinux/tools.html

Step 2: Unpack the Sources 
--------------------------

I suggest that you have a nicely separate area for these sources.  I used
/usr/src/ARM for the sources and the kits were all in /usr/kits.  I will 
assume those directories in these instructions:

[a] binutils-2.7

$ cd /usr/src/ARM
$ tar -zxvf /usr/kits/binutils-2.7.tar.gz
$ cd binutils-2.7
$ cp /usr/kits/binutils-arm-2.7.gz . ; gunzip binutils-arm-2.7.gz
$ patch -p1 < binutils-arm-2.7

[g] gcc-2.7.2.2

$ cd /usr/src/ARM
$ tar -zxvf /usr/kits/gcc-2.7.2.2.tar.gz
$ patch -p1 < /usr/kits/crossgcc-gcc-2.7.2.2.patch
$ patch -p1 < gcc-2.7.2.2.patch

NOTE: When applying the patch gcc-2.7.2.2.patch do NOT answer yes
to the 'previously applied patch' question.

Step 3: Make Separate Build Areas
---------------------------------

You can build the tools within their source trees but I prefer not
too, it just gets too cluttered.  So, make some build areas:

$ mkdir build-binutils build-gcc-2.7.2.2

Step 4: Understand configure
----------------------------

All GNU tools use a shell script called 'configure' to (yes you've 
guessed it) configure themselves.  Basically you pass this script the
appropriate information.  This information is:

[a] The type of target that this cross compiler will build for
(arm-unknown-linuxaout, it's a tuple architecture-manufacturer-os)

[b] Where this set of tools will be installed on your system
(I assume /usr/local/ARM but you can put it anywhere) 

[c] The type of host, actually the configure script works this
out for itself (usually).

Step 5: Build Binutils-2.7
--------------------------

$ cd /usr/src/ARM/build-binutils
$ ../binutils-2.7/configure --target=arm-unknown-linux --prefix=/usr/local/ARM -v
$ make all

You need to be superuser to install the built binutils:

$ make install

This puts them into /usr/local/ARM/bin and /usr/local/ARM/arm-unknown-linuxaout

Step 6: Build Gcc-2.7.2.2
-------------------------

[a] There is a little gotcha.  First you have got to edit a line in

/usr/src/ARM/gcc-2.7.2.2/config/arm/t-linux

Change the line 

MULTILIB_OPTIONS = m2/m3/m6/m7

to 

MULTILIB_OPTIONS = m2/m3/m6

[b] Configure

$ cd /usr/src/ARM/build-gcc-2.7.2.2
$ ../gcc-2.7.2.2/configure --target=arm-unknown-linux --prefix=/usr/local/ARM -v

[c] Build it:

$ make all

This will fail when it is trying to make glibc for the cross tools (ie a C
library containing ARM object code).  To make this you need to type

$ make libgcc1-asm.a
$ mv libgcc1-asm.a libgcc1.a

After you have done that you can continue the build:

$ make all

Finally, you need to be superuser to install it:

$make install

Step 7: Sit Back and Admire Your Work
-------------------------------------

You should now have the following tools in your system (this is not a
complete list, just the highlights):

/usr/local/ARM/arm-unknown-linuxout/bin

  -rwxr-xr-x   2 root     users      569727 Jan 26 11:50 ar
  -rwxr-xr-x   2 root     users     1018501 Jan 26 11:50 as
  -rwxr-xr-x   1 root     users      112622 Jan 26 19:23 gcc
  -rwxr-xr-x   2 root     users      930542 Jan 26 11:50 ld
  -rwxr-xr-x   2 root     users      578883 Jan 26 11:50 nm
  -rwxr-xr-x   2 root     users      569726 Jan 26 11:50 ranlib
  -rwxr-xr-x   2 root     users      976042 Jan 26 11:50 strip

/usr/local/ARM/arm-unknown-linuxaout/include

  -rw-r--r--   1 root     users        1486 Jan 26 19:22 assert.h

/usr/local/ARM/include

  -rw-r--r--   1 root     users        4393 Jan 26 11:50 ansidecl.h
  -rw-r--r--   1 root     users       89253 Jan 26 11:50 bfd.h
  -rw-r--r--   1 root     users       18948 Jan 26 11:50 bfdlink.h
  -rw-r--r--   1 root     users       19750 Jan 26 11:50 obstack.h

/usr/local/ARM/bin

  -rwxr-xr-x   2 root     users      569727 Jan 26 11:50 arm-unknown-linuxaout-ar
  -rwxr-xr-x   2 root     users     1018501 Jan 26 11:50 arm-unknown-linuxaout-as
  -rwxr-xr-x   2 root     users       17954 Jan 26 19:22 arm-unknown-linuxaout-c++
  -rwxr-xr-x   1 root     users       60864 Jan 26 11:50 arm-unknown-linuxaout-c++filt
  -rwxr-xr-x   2 root     users       17954 Jan 26 19:22 arm-unknown-linuxaout-g++
  -rwxr-xr-x   1 root     users      150511 Jan 26 11:50 arm-unknown-linuxaout-gasp
  -rwxr-xr-x   1 root     users      112622 Jan 26 19:23 arm-unknown-linuxaout-gcc
  -rwxr-xr-x   2 root     users      930542 Jan 26 11:50 arm-unknown-linuxaout-ld
  -rwxr-xr-x   2 root     users      578883 Jan 26 11:50 arm-unknown-linuxaout-nm
  -rwxr-xr-x   1 root     users      976043 Jan 26 11:50 arm-unknown-linuxaout-objcopy
  -rwxr-xr-x   1 root     users     1002142 Jan 26 11:50 arm-unknown-linuxaout-objdump
  -rwxr-xr-x   2 root     users      569726 Jan 26 11:50 arm-unknown-linuxaout-ranlib
  -rwxr-xr-x   1 root     users      532558 Jan 26 11:50 arm-unknown-linuxaout-size
  -rwxr-xr-x   1 root     users      525393 Jan 26 11:50 arm-unknown-linuxaout-strings
  -rwxr-xr-x   2 root     users      976042 Jan 26 11:50 arm-unknown-linuxaout-strip
  -rwxr-xr-x   1 root     users       87807 Jan 26 19:22 protoize
  -rwxr-xr-x   1 root     users       77237 Jan 26 19:22 unprotoize

/usr/local/ARM/lib

  drwxrwsr-x   3 root     users        1024 Jan 26 19:22 gcc-lib
  -rw-rw-r--   1 root     users     1358676 Jan 26 11:50 libarm-unknown-linuxaout-bfd.a
  -rw-rw-r--   1 root     users       86518 Jan 26 11:50 libarm-unknown-linuxaout-opcodes.a
  -rw-rw-r--   1 root     users      156468 Jan 26 11:50 libiberty.a

----------------------------------------------------------------------
David A Rusling				Consulting Engineer
European Semiconductor Applications	Digital Equipment Co Ltd.,
	Engineering			PO Box 121,
					Imperial Way,
					Worton Grange
					Reading RG2 0TU
Linux, Alpha, StrongArm, PCI		Tel: UK-(0)1734-204380
					Fax: UK-(0)1734-203133
----------------------------------------------------------------------

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Wed, 28 Jan 1998 17:09:27 +0000

>library containing ARM object code).  To make this you need to type

That's not glibc - you mean libgcc.  They're not the same thing.

p.

---

From: "Ka'Plaagh" <[email-masked]>
Date: Wed, 28 Jan 1998 18:20:41 +0000

duh, thanks, I thought one thing and wrote another...

Dave