[ixp1200] Howto make the GCC big-endian toolchain for IXP2400/Linux (ARM XS cale core)

David Mentre Mentre at tcl.ite.mee.com
Wed May 7 04:51:54 EDT 2003


Hello,

You'll find below the build procedure we have used to make a gcc big endian
cross toolchain for Intel IXP2400 which contains an ARM XScale core. I think
this procedure is valid for any ARM target. 

We hope it will help others.

Best regards,
david

--begin--
Howto make the GCC big endian toolchain for IXP2400/Linux (ARM XScale
core) 
=====================================================================

Version 1.3 / 2003-05-07
 David MENTRE <mentre at tcl.ite.mee.com> 
 Mathieu BERTRAND <bertrand at tcl.ite.mee.com>

-1. Last update

 With below procedure, the gcc is usable in -static but cannot produce
 dynamic linked programs. More exactly, the glibc-2.2.3 used in the
 ixp_ramdisk.gz should be replaced by glibc-2.2.5. 2.2.5 version has
 been patched to work with gcc3.

0. Used software

 - binutils-2.12.1.tar.gz
 - gcc-3.2.2.tar.gz
 - glibc-2.2.5.tar.gz
 - glibc-linuxthreads-2.2.5.tar.gz
 - gdb-5.3.tar.gz
(Those packages can be found on ftp.gnu.org mirrors.)

 - sources of patched linux kernel for IXP2400. linux-2.4.19-rmk7-ds1
   is working for us (YMMV)

(Linux sources can be found at:
  http://www.kernel.org/pub/linux/kernel/v2.4/
 Russel King patches can be found at:
  http://www.arm.linux.org.uk/developer/v2.4/ 
 Deepak Saxena patches can be found at:
  ftp://source.mvista.com/pub/ds-patches/2.4
)


1. Compilation overview

 One will need to do the following steps :

  - setup destination directory and apply needed patches to sources 

  - compile the binutils

  - compile a bare-bone gcc (for big endian)

  - compile the glibc

  - re-compile a complete gcc (for big endian)

  - compile gdb

2. packages installation

* In /usr/local/src (or whatever directory you choose):

 - mkdir build-binutils
 - mkdir build-gcc
 - mkdir build-glibc
 - mkdir build-gcc2
 - mkdir build-gdb

 - tar xvf binutils-2.13.tar.gz
 - tar xvf gcc-3.2.1.tar.gz
 - tar xvf glibc-2.2.3.tar.gz
 - cd glibc-2.3.3; tar xvf glibc-linuxthreads-2.2.3.tar.gz; cd ..
 - tar xvf gdb-5.3.tar.gz

* Patch glibc:

 - cd glibc-2.2.5
 - perl -pi -e 's/weak_alias \(__old_sys_nerr/\/\/ $&/'
sysdeps/unix/sysv/linux/arm/errlist.c
 - cd ..

* Patch gcc:

 - cd gcc-3.2.2
 - perl -pi -e 's/^(TARGET_LIBGCC2_CFLAGS.*)/$1 -Dinhibit_libc
-D__gthr_posix_h/' gcc/config/arm/t-linux
 - echo 'T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h' >>
gcc/config/arm/t-linux
 
 edit Makefile.in and rewrite xgcc in xgcc -mbig-endian on definition
 GCC_FOR_TARGET:
GCC_FOR_TARGET = $$r/gcc/xgcc -mbig-endian -B$$r/gcc/ $(FLAGS_FOR_TARGET)

 edit gcc/Makefile.in and rewrite xgcc in xgcc -mbig-endian on
 definition:
GCC_FOR_TARGET = ./xgcc -mbig-endian -B./ -B$(build_tooldir)/bin/ -isystem
$(build_tooldir)/include -isystem $(build_tooldir)/sys-include



 apply following patch to gcc/reload1.c with 
 -  cd gcc; patch -l < the-patch.patch; cd ..

=== start of patch ===
--- reload1.c.orig      Thu Oct 10 16:40:20 2002
+++ reload1.c   Thu Dec 12 14:43:56 2002
@@ -8674,7 +8674,9 @@
         ... (MEM (PLUS (REGZ) (REGY)))... .

         First, check that we have (set (REGX) (PLUS (REGX) (REGY)))
-        and that we know all uses of REGX before it dies.  */
+        and that we know all uses of REGX before it dies.
+        Also, explicitly check that REGX != REGY; our life information
+        does not yet show whether REGY changes in this insn.  */
       set = single_set (insn);
       if (set != NULL_RTX
          && GET_CODE (SET_DEST (set)) == REG
@@ -8684,6 +8686,7 @@
          && GET_CODE (SET_SRC (set)) == PLUS
          && GET_CODE (XEXP (SET_SRC (set), 1)) == REG
          && rtx_equal_p (XEXP (SET_SRC (set), 0), SET_DEST (set))
+         && !rtx_equal_p (XEXP (SET_SRC (set), 1), SET_DEST (set))
          && last_label_ruid < reg_state[REGNO (SET_DEST (set))].use_ruid)
        {
          rtx reg = SET_DEST (set);
=== end of patch ===

This patch comes from following gcc gnats entry:
  http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=8896


3. Setup of installation directory

 - target=arm-linux
 - prefix=/opt/tc-arm-linux-bu2.12.1-gcc3.2.2p-glibc2.2.5p # or whatever you
want

 - mkdir -p $prefix/$target/include
 - cp -r (path to linux sources)/linux/include/linux $prefix/$target/include
 - cp -r (path to linux sources)/linux/include/asm-arm
$prefix/$target/include/asm


4. add $prefix/bin directory into your $PATH

 - PATH=$prefix/bin:$PATH


5. Compilation of binutils

 - cd build-binutils
 - ../binutils-2.12.1/configure --prefix=$prefix --target=$target
 - make all install
 - cd ..

6. Compilation of the bare-bone gcc

 - cd build-gcc
 - ../gcc-3.2.2/configure --target=$target --prefix=$prefix
--enable-languages=c --with-sysroot=$prefix/$target --without-headers
--disable-shared --disable-threads
 - make all-gcc install-gcc
 - cd ..

7. Compilation of glibc

 - cd build-glibc
 - CC="$target-gcc -mbig-endian" AR=$target-ar RANLIB=$target-ranlib
../glibc-2.2.5/configure --host=$target --prefix=$prefix/$target
--enable-add-ons=linuxthreads --with-headers=$prefix/$target/include
 - make all install
 - cd ..

8. Compilation of complete gcc

 - cd build-gcc2
 - ../gcc-3.2.2/configure --prefix=$prefix --target=$target
--enable-languages=c --with-sysroot=$prefix/$target
 - make all install
 - cd ..

Note: At the above step, we haven't been able to active other
      languages like c++. We would accept any idea to fix that.

9. Compilation of gdb

 - cd build-gdb
 - ../gdb-5.3/configure --prefix=$prefix --target=$target
 - make all install
 - cd ..
--end--

-- 
David Mentré <mentre at tcl.ite.mee.com> - Research engineer
Mitsubishi Electric ITE-TCL / European Telecommunication Research Laboratory

Phone: +33 2 23 45 58 29 / Fax: +33 2 23 45 58 59 
http://www.mitsubishi-electric-itce.fr



More information about the ixp1200 mailing list