Using crosstool-0.43 to generate cross-compiler for ARM

来源:互联网 发布:dnf账号数据异常 编辑:程序博客网 时间:2024/05/21 17:20

Using crosstool-0.43 to generate cross-compiler for ARM 

 

[Environment setting] 

Ubuntu-10.04 

 

apt-get install patch 

apt-get install bison 

apt-get install flex 

 

apt-get install uboot-mkimage 

apt-get install libncurses5-dev 

 

 

[Initial prepare] 

1: download crosstool-0.43.tar.gz from 

http://kegel.com/crosstool 

2: unzip tar 

 

[Configuration] 

1: demo-arm.sh 

this script is the overall control, uncomment the line that you want to build for specific gcc and glibc version 

e.g.: uncomment the line 

eval `cat arm.dat gcc-3.4.5-glibc-2.3.2.dat` sh all.sh --notest 

 

2: set dirs: 

TARBALLS_DIR: set download tarballs 

RESULT_TOP: set the final build dir 

 

[Running] 

$sh dem0-arm.sh will start the build 

 

[Notes for some internal procedure] 

1: the tool will check and download necessary packages in folder TARBALLS_DIR 

2: the internal files are in folder crosstool-0.43/builds 

3: one drawback is that the scripts will process a tarball one at a time, e.g.: it will do download-unzip-patch-compile procedure for each tarball. If anyone is missing or compile error, run the script again will redo the whole thing 

4: Some error needs to be resolved. see page Resolving some errors 

 

 

Resolving some errors 

 1: Need to lower down gcc version 

[Error log] 

libc_cv_ppc_machine=yes CC=gcc /home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/glibc-2.3.2/configure --prefix=/usr --build=i686-pc-linux-gnu --host=arm-unknown-linux-gnu --without-cvs --disable-sanity-checks --with-headers=/home/eric/work/result/gcc-3.4.5-glibc-2.3.2/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include --enable-hacker-mode 

checking build system type... i686-pc-linux-gnu 

checking host system type... arm-unknown-linux-gnu 

checking sysdep dirs... sysdeps/arm/elf sysdeps/unix/sysv/linux/arm sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common sysdeps/unix/mman sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/fpu sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic/elf sysdeps/generic 

checking for a BSD-compatible install... /usr/bin/install -c 

checking whether ln -s works... yes 

checking for pwd... /bin/pwd 

checking for arm-unknown-linux-gnu-gcc... gcc 

checking version of gcc... 4.4.3, bad 

checking for gnumake... no 

checking for gmake... no 

checking for make... make 

checking version of make... 3.81, ok 

configure: error: 

*** These critical programs are missing or too old: gcc 

*** Check the INSTALL file for required versions. 

[Resolve] 

#apt-get install gcc-4.1 

#/usr/bin:ln -s gcc-4.1 gcc 

 

2: Resolve bug

[Log] 

c/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version.o 

In file included from version.c:33: 

/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version-info.h:1:1: missing terminating " character 

/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version-info.h:2:1: missing terminating " character 

/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version-info.h:3:1: missing terminating " character 

/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version-info.h:4:1: missing terminating " character 

make[2]: *** [/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/build-glibc/csu/version.o] Error 1 

make[2]: Leaving directory `/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/glibc-2.3.2/csu' 

make[1]: *** [csu/subdir_lib] Error 2 

make[1]: Leaving directory `/home/eric/work/crosstool-0.43/build/arm-unknown-linux-gnu/gcc-3.4.5-glibc-2.3.2/glibc-2.3.2' 

make: *** [all] Error 2 

[Resolve] 

Modify the following: 

eric@eric-crosstool:~/work/downloads/tmp$ diff glibc-2.3.2/csu/Makefile ../glibc-2.3.2/csu/Makefile  

226c226 

< "on `date +%Y-%m-%d`.\\n\"" ;; \ 

--- 

> "on `date +%Y-%m-%d`.\\\\n\"" ;; \ 

231c231 

<    echo "\"Available extensions:\\n\""; \ 

--- 

>    echo "\"Available extensions:\\\\n\"";