SH4 Cross Toolchain howto
The goal is to setup a cross compiler to build glibc and then cross-compilong the sh4 native toolchain.
First, you must understant what does host, build and target correspond to:
- host = The host arch where the code is supposed to _run_
- build = The arch from where you _build_ the code
- target = The arch that the code is supposed to _generate_ code for
Current cross-toolchain repository
Add "deb http://people.dunnewind.net/arthur/sh4/cross/ ./" to your sources.list
Install gcc-4.1-sh4-linux-gnu libc6-dev-sh4-cross or whatever you want.
Build our own toolchain
Get the binutils sources:
- $ apt-get source binutils
Go to the source dir:
- $ binutils-2.18/
Binutils packaging system already have all the targets you'll need to build an _i386_ binutils for _sh4_ targets, just run:
- $ TARGET=sh4-linux-gnu fakeroot debian/rules binary-cross
You'll get a wonderful "binutils-sh4-linux-gnu_2.18-1_i386.deb", install it.
Since there already are some built glibc for sh4, we are going to install them instead of bootstrapping a minimal cross-compiler just to build the glibc and rebuild a full cross-compiler then...
Get libc6-dev-sh4-cross and all its deps on http://people.dunnewind.net/arthur/sh4/cross/
The package is already dpkg-cross'ed, just install it.
As for binutils, there already are cross targets in the packaging, run:
- $ apt-get source gcc-4.2 $ cd gcc-4.2-4.2.2/ $ GCC_TARGET=sh4 fakeroot debian/rules binary