First we need to build binutils for crosscompiling. They are the really small utilities that do big things :)
We are going to set $MACH to represent our host system.
export MACH=i386-linux
We have already set aside two directories for building our toolchain.
If you remember our directories reside in $HOME or at any other location you have used.
./build is where our build object files go and
./parisc is where our finished toolchain will reside
export DEST=$ST/parisc
cd $ST
cd build
mkdir binutils
cd binutils
$ST/src/binutils/configure --host=$MACH --build=$MACH --prefix=$DEST\
--target=hppa-linux --disable-nls
N.B. If you want nls support (i.e. non-native English speaker) then remove the "--disable-nls" option.
make
N.B. Optionally on SMP xc boxes, you can try "make -j8" and thus allowing make to start multiple compile threads across CPU's. Though this sometimes obscures the exact location of errors when the build fails.
make install
cd $ST
cd src
cd gcc
./contrib/gcc_update --touch
cd $ST/build
mkdir gcc
cd gcc
At this point we are about to compile a simple C cross compiler, but we will require some of the binutils we built above. Take note that we preface the regular $PATH with the path of our newly built toolchain, this means that if you are not cross compiling then you will always be using the freshly built binaries (path order precedence).
export PATH=$DEST/bin:$PATH
$ST/src/gcc/configure --host=$MACH --build=$MACH --prefix=$DEST\
--target=hppa-linux --disable-shared --disable-nls\
--enable-languages=c
make -j8
make install
cd $ST/src/linux
make oldconfig
make dep
Sometimes Glibc builds... sometimes it doesn't. Sometimes it's just magic. Applying the following recipe should give good results. Note the use of '--enable-hacker-mode' so don't complain if other things complain (Thanks go to JDA for this bit of the recipe).
cd $ST/build
mkdir glibc
cd glibc
unset LD_LIBRARY_PATH
unset LD_RUN_PATH
export CC=$DEST/bin/hppa-linux-gcc
export CLFAGS="-O2 -g"
$ST/src/glibc/configure --host=hppa-linux --build=$MACH\
--prefix=$DEST/hppa-linux --with-headers=$ST/src/linux/include\
--disable-profile --without-cvs --enable-add-ons\
--enable-hacker-mode
make -j8
make install
Symlink the appropriate headers:
cd $DEST/hppa-linux/include
ln -s $ST/src/linux/include/linux .
ln -s $ST/src/linux/include/asm .
unset CC
unset CFLAGS
(Set CC or CFLAGS for the native compiler)
cd $ST/build/gcc
$ST/src/gcc/configure --host=$MACH --build=$MACH --prefix=$DEST\
--target=hppa-linux --enable-shared --disable-nls
make -j8
make install
Tada!
You now have a fully built cross compiler for PARISC!
If you want to build a 64bit cross compiler (to build 64bit kernels), go again through steps 4.1 and 4.2, replacing '--target=hppa-linux' by '--target=hppa64-linux'.