Steps to build a Cross compiler for MIPS (fwd)
hanishkvc@fedtec.com
hanishkvc@fedtec.com
Mon Jul 30 00:27:00 GMT 2001
---------- Forwarded message ----------
Date: Thu, 26 Jul 2001 21:58:05 +0530 (IST)
From: Hanish Menon C <hanishkvc@fedtec.com>
To: linuxce-devel@linuxce.org
Cc: bgat@billgatliff.com, Steven J. Hill <sjhill@cotw.com>
Subject: Steps to build a Cross compiler for MIPS
Hi,
Recently I had tried getting a MIPS cross compiler up, so I am attaching
the steps I had to follow and the modifications I had to do to get the
Compiler up and running.
Also when trying the cross compiler for ARM, I found that at some places c
headers where being included into the libgcc even thou inhibit_libc was
specified, one such thing was pthread.h. However I didn't try to correct
it, as its a older version of gcc (v 2.95.2) and hopefully gcc v3.0
doesn't have such problems.
#
# Creating CROSS COMPILERS from related GNU Source codes
# C Hanish Menon <www.hanishkvc.com>
# Start: July 2001
# Last: 25 july 2001
#
****************************************
A MIPS cross compiler creation journey
Host: Linux x86 system - RedHat v7.1
Target: mipsel-linux
Based on the Cross Compiler tools
sources provided at the LinuxVR site.
Last: 25 july 2001
****************************************
Step 1 - binutils 2.8.1 with MIPS patches
-----------------------------------------
cd binutils-src_dir
mkdir target-mipsel-linux
cd target-mipsel-linux
../configure --prefix=/usr/local/root-mipsel-linux --target=mipsel-linux
make all 2>&1 | tee make-all.log
make install 2>&1 | tee make-install.log
ADD /usr/local/root-mipsel-linux/bin to the PATH enviornment variable.
Step 2 - egcs 1.0.3a with MIPS patches (bootstraping)
------------------------------------------------------
cd gcc-src_dir
mkdir target-mipsel-linux
cd target-mipsel-linux
../configure --prefix=/usr/local/root-mipsel-linux --target=mipsel-linux
--with-newlib --enable-languages=c
make LANGUAGES="c" all-gcc ( or even cross should do )
make LANGUAGES="c" install-gcc 2>&1 | tee make-install-gcc.log
-- Note --
* --without-headers doesn't seem to work so ignore it, its ok
* tool-include-dir is /usr/local/root-mipsel-linux/mipsel-linux/include
as shown during the make process
* SFtype needs to be replaced by DFtype in gcc/bc-typecd.def
* when using cross instead of all-gcc in make, it does fail after
sometime (in libiberty) ignore it and install whatever is ready
till now, the rest will be rectified and everything properly
installed after installing the glibc library.
Step 3 - glibc 2.0.7 (980711) with MIPS patches
-----------------------------------------------
-- 3.1 Kernel Headers --
Install the Linux include files i.e include/linux and include/asm-mips.
This involves configuring linux as required for the target and doing a
make dep before copying these include files into
/usr/local/root-mipsel-linux/mipsel-linux/include
linux
asm (from asm-mips)
-- 3.2 glibc --
BUILD_CC=gcc CC=mipsel-linux-gcc ../configure
--prefix=/usr/local/root-mipsel-linux/mipsel-linux mipsel-linux
--build=i686-pc-linux-gnu --enable-add-ons
BUILD_CC=gcc CC=mipsel-linux-gcc make all install 2>&1 | tee make.log
Note:
* for both configure and make
BUILD_CC=gcc
CC=target_name_gcc
* Also during configure
--build=build_system_canonical_name and
target_name directly specified without --target
Step 4 - GCC revisited
----------------------
../configure --prefix=/usr/local/root-mipsel-linux --target=mipsel-linux
make all install 2>&1 | tee make.log
******************************************
MIPS new tool set
Host: Linux x86 system - RedHat v7.1
Target: mipsel-linux
Based on the latest cvs based tool
sources along with some mips patches
uploaded by Steven J Hill (have to verify)
around March-April 2001
Last: 23 July 2001
*******************************************
step 1 - binutils
-----------------
../configure --prefix=/usr/local/mipsel-linux-new --target=mipsel-linux
make all install
step 1.5 - kernel headers
-------------------------
Copy the linux and asm-mips from linux kernel source include directory to
the /usr/local/mipsel-linux-new/include. Also set the link asm to point to
asm-mips.
step 2 - gcc basic
------------------
../configure --prefix=/usr/local/mipsel-linux-new --target=mipsel-linux
--with-newlib --disable-shared --enable-languages=c
make LANGUAGES="c" -j4
make LANGUAGES="c" install
* --disable-shared used has there was few errors without it.
step 3 - glibc
---------------
BUILD_CC=gcc CC=mipsel-linux-gcc ../configure --prefix=/usr/local/mipsel-linux-new/mipsel-linux mipsel-linux --build=i686-pc-linux-gnu --enable-add-ons --with-elf --with-headers=/usr/local/mipsel-linux-new/include --disable-profile
* had to declare NULL in settimeofday.c
* have to add UNAME_* seems like 2.4 has UTS_*
Looked further into the matter. There is a config-name.in file which should
be used to create a config-name.h file by configure script, but for some
reason its not working. So explicitly created a config-name.h and filled
it with the info got using the uname program.
* Updated swapon function in sysdep/generic/swapon.c by adding int flag as
part of the swapon function
* --disable-profile seems to have solved the cachectl.o required by stamp.o
problem
* --prefix points to the mipsel-linux directory within the root directory for
the target tool chain, when compared to the binutils's or gcc's prefix
BUILD_CC=gcc CC=mipsel-linux-gcc make -j4
make install
step 3.5 - kernel headers revisited
-----------------------------------
Copy the kernel headers from /usr/local/mipsel-linux-new/include to
/usr/local/mipsel-linux-new/mipsel-linux/include
step 4 - gcc revisited
----------------------
../configure --prefix=/usr/local/mipsel-linux-new --target=mipsel-linux
make LANGUAGES="c c++" -j4
make LANGUAGES="c c++" install
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list