JDP : Crosscompiler

Home :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are a guest
This is an old revision of Crosscompiler from 2003-12-28 12:57:53.

Building a crosscompiler for sparc32 using a Debian/Linux box


This is how I did it, the result can be found in the files section.
CrosscompilingKernel

get the toolchain package
apt-get install toolchain-source fakeroot automake1.4 dpkg-cross binutils-multiarch


edit /etc/dpkg/cross-compile:
crossbase = /usr


configure the toolchain
cd /usr/src EMAIL="someone@somedomain.com" tpkg-make sparc-linux

NOTE: you have to have a valid gpg secret key, because the debian package requires gpg signing. Looking up your gpg key involves the GECOS field in your /etc/passwd entry, so make sure your GECOS matches your key.

create binutils
First screw up binutils, otherwise it will build binutils-sparc-linux instead of binutils-sparc:
FIXME: This should be done in some configfile. I do not know where to do that, so we do it by hand for the time being.

edit debian/rules:
... PACKAGE=binutils-sparc ...

edit debian/control:
... Source: binutils-sparc ... Package: binutils-sparc

and compile
cd binutils-sparc-linux-''version'' debuild debi


libc
create and install the cross-dkpg'd SPARC packages.
su -c "TPKG_SERVER=ftp.nl.debian.org tpkg-install-libc sparc-linux"

by default, tpkg-install-libc will use the british debian server.

make GCC
The woody toolchain package presents a 3.* GCC version, which is not what we want. What we do want is GCC 2.95. How to do it? Simply read the fine manual:
apt-get source gcc-2.95 cd gcc-2.95-2.95.4.ds13 less debian/README.cross

Which reads about gcc:
... - Edit the file gcc-2.95-*/debian/rules.defs where it defines TARGETS. Change this to 'TARGETS = ${target}'. - In order to speed up the build process, disable the regression tests. Search for 'with_check := disabled by hand' in gcc-2.95-*/debian/rules.defs and uncomment it. - In order to speed up the build process, disable building of the Pascal compiler if you don't need it. Search for 'with_pascal := disabled by hand' in gcc-2.95-*/debian/rules.defs and uncomment it. The same thing can be done for the CHILL, Fortran and Java compilers. - Build using 'dpkg-buildpackage -rfakeroot'. This will take a _long_ time, as it builds a bootstrap native compiler first, and also builds the native packages.


And this is simply why Debian is the best: for every complex task, there is a Debian way to solve it.
There is no comment on this page. [Display comments/form]