2011-08-01
lianyiquan
crosstool-ng主页
http://crosstool-ng.org/
crosstool-ng是新的用来建立交叉工具链的工具,它是crosstool的替换者。
使用crosstool最多只能编译gcc 4.1.1 glibc 2.x的版本。而crosstool-ng一直保持着更新,现在最新能够建立 gcc 4.3.2版本 glibc 2.9版本。
下载解压后,在根目录下执行以下操作(若是下载的crosstool-ng源码包有补丁文件的,也需要自己下载打补丁)
mkdir -p /opt/powerpc/install_dir/
tar -xjvf crosstool-ng-1.9.3.tar.bz2 -C /opt/powerpc
step:
1.配置crosstool
[root@localhost crosstool-ng-1.9.3]# ./configure --prefix=/opt/powerpc/install_dir/
Checking for 'grep'... /bin/grep
Checking whether '/bin/grep' supports -E... yes
Checking for 'sed'... /bin/sed
Checking whether '/bin/sed' supports -i and -e... yes
Checking for 'bash'... /bin/bash
Checking for 'cut'... /bin/cut
Checking for 'install'... /usr/bin/install
Checking for 'make'... /usr/bin/make
Checking for 'gcc'... /usr/lib/ccache/gcc
Checking for 'awk'... /bin/awk
Checking for 'bison'... /usr/bin/bison
Checking for 'flex'... /usr/bin/flex
Checking for 'makeinfo'... /usr/bin/makeinfo
Checking for 'automake'... /usr/bin/automake
Checking for 'libtool'... /usr/bin/libtool
Checking for 'stat'... /usr/bin/stat
Checking for 'aria2c'... no
Checking for 'curl'... /usr/bin/curl
Checking for 'cvs'... /usr/bin/cvs
Checking for 'patch'... /usr/bin/patch
Checking for 'tar'... /bin/tar
Checking for 'gzip'... /bin/gzip
Checking for 'bzip2'... /usr/bin/bzip2
Checking for 'lzma'... no
lzma: none found
Either you are missing entirely the needed tool,
or the version you have is too old.
configure: Bailing out...
(yum install lzma后继续下一步)
2.配置crosstool
[root@localhost crosstool-ng-1.9.3]# ./configure --prefix=/opt/powerpc/install_dir/
Checking for 'grep'... /bin/grep
Checking whether '/bin/grep' supports -E... yes
Checking for 'sed'... /bin/sed
Checking whether '/bin/sed' supports -i and -e... yes
Checking for 'bash'... /bin/bash
Checking for 'cut'... /bin/cut
Checking for 'install'... /usr/bin/install
Checking for 'make'... /usr/bin/make
Checking for 'gcc'... /usr/lib/ccache/gcc
Checking for 'awk'... /bin/awk
Checking for 'bison'... /usr/bin/bison
Checking for 'flex'... /usr/bin/flex
Checking for 'makeinfo'... /usr/bin/makeinfo
Checking for 'automake'... /usr/bin/automake
Checking for 'libtool'... /usr/bin/libtool
Checking for 'stat'... /usr/bin/stat
Checking for 'aria2c'... no
Checking for 'curl'... /usr/bin/curl
Checking for 'cvs'... /usr/bin/cvs
Checking for 'patch'... /usr/bin/patch
Checking for 'tar'... /bin/tar
Checking for 'gzip'... /bin/gzip
Checking for 'bzip2'... /usr/bin/bzip2
Checking for 'lzma'... /usr/bin/lzma
Checking for 'readlink'... /usr/bin/readlink
Checking for 'objcopy'... /usr/bin/objcopy
Checking for 'objdump'... /usr/bin/objdump
Checking for 'readelf'... /usr/bin/readelf
Checking for 'patch'... /usr/bin/patch
Checking for 'ncurses/ncurses.h'... yes
Checking for 'libncursesw.so'... yes
Computing version string... 1.9.3
Building up Makefile... done
crosstool-NG configured as follows:
PREFIX='/opt/powerpc/install_dir/'
BINDIR='/opt/powerpc/install_dir//bin'
LIBDIR='/opt/powerpc/install_dir//lib/ct-ng-1.9.3'
DOCDIR='/opt/powerpc/install_dir//share/doc/ct-ng-1.9.3'
MANDIR='/opt/powerpc/install_dir//share/man'
Now run:
make
make install
3. 编译
[root@localhost crosstool-ng-1.9.3]# make
SED 'ct-ng'
SED 'scripts/crosstool-NG.sh'
SED 'scripts/saveSample.sh'
SED 'scripts/showTuple.sh'
GEN 'paths.mk'
SED 'docs/ct-ng.1'
GZIP 'docs/ct-ng.1.gz'
4. 安装到prefix指定路径
[root@localhost crosstool-ng-1.9.3]# make install
MKDIR '/opt/powerpc/install_dir//bin/'
INST 'ct-ng'
RMDIR '/opt/powerpc/install_dir//lib/ct-ng-1.9.3/'
MKDIR '/opt/powerpc/install_dir//lib/ct-ng-1.9.3/'
INSTDIR 'config/'
INSTDIR 'contrib/'
INSTDIR 'kconfig/'
INSTDIR 'patches/'
INSTDIR 'scripts/'
INST 'steps.mk'
INST 'paths.mk'
INSTDIR 'sampl