|
|

楼主 |
发表于 2006-10-2 21:47:51
|
显示全部楼层
他上面的编译过程是:
1. Binutils.
Let's assume you have apt'able slind source repository. To obtain binutils sources, issue:
$ apt-get source binutils=2.16.1-2.slind1
and step into binutils source tree:
$ cd binutils-2.16.1
Now, in case you're building for an uclibc target, issue the following command:
$ env TARGET=<cpu>-linux LIBC_TARGET=uclibc fakeroot debian/rules binary-cross
and that will get you a binutils package. If your target of choice is glibc, then instead of the command above, issue:
$ env TARGET=<cpu> fakeroot debian/rules binary-cross
Now that you have a cross binutils package, install it using
$ dpkg -i ../binutils-<gnuarch>_2.16.1-2.slind1_i386.deb
2. Linux kernel headers.
Obtain linux-kernel-headers sources with the following command:
$ apt-get source linux-kernel-headers=2.6.12.0-1.slind1
and step into the source tree
$ cd linux-kernel-headers-2.6.12.0.orig
Build the package with
$ dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d
Now you have to cast a dpkg-cross spell upon this package to make it usable in your cross development environment:
$ cd ..
$ dpkg-cross -a<arch> -b linux-kernel-headers_2.6.12.0-1.slind1_<arch>.deb
And install the freshly built cross-package with
$ dpkg -i linux-kernel-headers-<arch>-cross_2.6.12.0-1.slind1_all.deb
3. Libc development headers.
3.1. For a glibc target, get the glibc sources with
$ apt-get source glibc=2.3.2.ds1-22.slind1
$ cd glibc-2.3.2.ds1
To build the libc6-dev-headers package, issue:
$ env DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d
$ cd ..
Run dpkg-cross over the resulting package:
$ dpkg-cross -a<arch> -b libc6-dev-headers_2.3.2.ds1-22.slind1_<arch>.deb
And install with:
$ dpkg -i libc6-dev-headers-<arch>-cross_2.3.2.ds1-22.slind1_all.deb
3.2 For uclibc target, get the uclibc sources with
$ apt-get source uclibc=0.9.28-1slind0
$ cd uclibc-0.9.28
Build the package with
$ env DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d
$ cd ..
Call dpkg-cross and install the final package:
$ dpkg-cross -a<arch> -b libuclibc-dev-headers_0.9.28-1slind0_<arch>.deb
$ dpkg -i libuclibc-dev-headers-<arch>-cross_0.9.28-1slind0_all.deb
4. Bootstrap compiler.
Get the sources for gcc-3.4:
$ apt-get source gcc-3.4=3.4.4-5.slind1
$ cd gcc-3.4-3.4.4
To build a bootstrap compiler package, issue:
$ env GCC_TARGET=<arch> DEB_CROSS_BOOTSTRAP=yes dpkg-buildpackage -uc -us -rfakeroot -b -d
$ cd ..
Now, install the packages with
$ dpkg -i gcc-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb cpp-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libgcc1-<arch>-cross_3.4.4-5.slind1_all.deb
Now that you have a bootstrap compiler, it's time to build real libc packages.
5. C library.
First of all, you should remove the package with libc development headers. So, for glibc, do
$ dpkg --remove libc6-dev-headers-<arch>-cross_2.3.2.ds1-22.slind1_all.deb
or, in case of uclibc target:
$ dpkg --remove libuclibc-dev-headers-<arch>-cross_0.9.28-1slind0_all.deb
5.1. For glibc, do the following:
$ cd glibc-2.3.2.ds1
$ dpkg-buildpacakge -uc -us -rfakeroot -a<arch> -b -d
$ cd ..
Run dpkg-cross over the packages:
$ dpkg-cross -a<arch> -b libc6_2.3.2.ds1-22.slind1_<arch>.deb libc6-dev_2.3.2.ds1-22.slind1_<arch>.deb
and install them:
$ dpkg -i libc6-<arch>-cross_2.3.2.ds1-22.slind1_all.deb libc6-dev-<arch>-cross_2.3.2.ds1-22.slind1_all.deb
5.2. For an uclibc target, do the following:
$ cd uclibc-0.9.28
$ dpkg-buildpackage -uc -us -rfakeroot -a<arch> -b -d
$ cd ..
Run dpkg-cross:
$ dpkg-cross -a<arch> -b libuclibc0_0.9.28-1slind0_<arch>.deb libuclibc-dev_0.9.28-1slind0_<arch>.deb
And install the packages:
$ dpkg -i libuclibc0-<arch>-cross_0.9.28-1slind0_all.deb libuclibc-dev-<arch>-cross_0.9.28-1slind0_all.deb
6. Build the final compiler.
This one is quite easy as well:
$ cd gcc-3.4-3.4.4
$ env GCC_TARGET=<arch> DEB_TARGET_LIBCXX=yes dpkg-buildpackage -uc -us -rfakeroot -b -d
Note, that if you don't need c++ development packages, you may omit the DEB_TARGET_LIBCXX=yes part.
Now, install the whole lot of gcc packages:
$ dpkg -i gcc-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb cpp-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libgcc1-<arch>-cross_3.4.4-5.slind1_all.deb
(and c++ related packages, if any)
$ dpkg -i g++-3.4-<gnuarch>_3.4.4-5.slind1_i386.deb libstdc++6-<arch>-cross_3.4.4-5.slind1_all.deb libstdc++6-dev-<arch>-cross_3.4.4-5.slind1_all.deb
Congratulations!
You managed to build a cross-compilation toolchain for your favourite <arch> architecture.
Have fun!
Sincerely,
Your toolchain master <alexander.shishkin _at_ siemens.com> |
|