原创
HOWTO build arm-linux toolchain for ARM/XSCALE 4.1
---------------------------------------------- HOWTO build arm-linux toolchain for ARM/XSCALE ---------------------------------------------- These instructions document how to build an arm-linux toolchain for big-endian and little-endian target libraries. 0. Links accessed If you want to know how did I get to this...http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/build-arm-linux-3.4.4 http://sourceware.org/ml/libc-alpha/2006-02/msg00102.html http://gcc.gnu.org/onlinedocs/gccint/Target-Fragment.html http://documents.jg555.com/cross-lfs/mips64-64/index.html http://xcgl-port.sourceforge.net/index.html http://gcc.gnu.org/gcc-4.1/changes.html http://linuxfromscratch.org/pipermail/faq/2004-July/000159.html 1. Download sites linux-libc-headers - http://ep09.pld-linux.org/~mmazur/linux-libc-headers binutils - ftp://ftp.gnu.org/gnu/binutils glibc - ftp://ftp.gnu.org/gnu/glibc gcc - ftp://ftp.gnu.org/gnu/gcc 2. Packages used binutils-2.17.tar.bz2 gcc-4.1-20060721.tar.bz2 (prerelease) linux-libc-headers-2.6.12.0.tar.bz2 glibc-ports-2.4.tar.bz2 glibc-2.4.tar.bz2 3. binutils-2.17 tar jxvf binutils-2.17.tar.bz2 cd binutils-2.17 mkdir arm-linux cd arm-linux ../configure --target=arm-linux --with-lib-path=/usr/local/arm-linux/lib:/usr/local/arm-linux/lib/be:/usr/local/arm-linux/lib/soft-float:/usr/local/arm-linux/lib/be/soft-float make make install chmod 777 /usr/local/arm-linux 4. linux-libc-headers tar jxvf linux-libc-headers-2.6.12.0.tar.bz2 cd linux-libc-headers-2.6.12.0/include ln -s asm-arm asm 5. gcc-4.1.2 (gcc only) tar jxvf gcc-4.1-20060721.tar.bz2 cd gcc-4.1-20060721 cp $(ATTACHED t-linux file) gcc/config/arm/ vi gcc/config/arm/linux-elf.h - remove line that defines LIBGCC_SPEC mkdir arm-linux cd arm-linux ../configure --target=arm-linux --disable-shared --disable-threads \ --prefix=/usr/local --with-gnu-as --with-gnu-ld --enable-multilib \ --enable-languages=c --disable-libmudflap --disable-libssp make make install 6. glibc-2.4 (big-endian/soft-float) tar jxvf glibc-2.4.tar.bz2 cd glibc-2.4 tar jxvf ../glibc-ports-2.4.tar.bz2 mv glibc-ports ports vi config.make.in - change "slibdir = @...@" to "slibdir = @libdir@" vi Makeconfig - remove any occurrences of -lgcc_eh mkdir arm-linux cd arm-linux echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache CC="arm-linux-gcc -mbig-endian -msoft-float -finline-limit=10000" \ AS="arm-linux-as -mbig-endian" \ LD="arm-linux-ld -EB" \ ../configure --host=arm-linux --build=i686-pc-linux-gnu \ --with-headers=<path_to_linux_libc_headers>/include \ --enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \ --without-fp --libdir=/usr/local/arm-linux/lib/be/soft-float \ --cache-file=config.cache make make install 7. glibc-2.4 (big-endian) (you must be in "glibc-2.4/arm-linux" directory) rm -rf * echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache CC="arm-linux-gcc -mbig-endian -finline-limit=10000" \ AS="arm-linux-as -mbig-endian" \ LD="arm-linux-ld -EB" \ ../configure --host=arm-linux --build=i686-pc-linux-gnu \ --with-headers=<path_to_linux_libc_headers>/include \ --enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \ --libdir=/usr/local/arm-linux/lib/be --cache-file=config.cache make make install 8. glibc-2.4 (little-endian/soft-float) (you must be in "glibc-2.4/arm-linux" directory) rm -rf * echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache CC="arm-linux-gcc -msoft-float -finline-limit=10000" \ AS="arm-linux-as" \ LD="arm-linux-ld" \ ../configure --host=arm-linux --build=i686-pc-linux-gnu \ --with-headers=<path_to_linux_libc_headers>/include \ --enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \ --without-fp --libdir=/usr/local/arm-linux/lib/soft-float \ --cache-file=config.cache make make install 9. glibc-2.4 (little-endian) (you must be in "glibc-2.4/arm-linux" directory) rm -rf * echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache CC="arm-linux-gcc -finline-limit=10000" \ AS="arm-linux-as" \ LD="arm-linux-ld" \ ../configure --host=arm-linux --build=i686-pc-linux-gnu \ --with-headers=<path_to_linux_libc_headers>/include \ --enable-add-ons --enable-shared --prefix=/usr/local/arm-linux \ --cache-file=config.cache make make install 10. gcc 4.1.2 (c++, objc and fortran) cd gcc-4.1-20060721 vi gcc/config/arm/t-linux - remove all "-Dinhibit_libc" occurrences cd arm-linux rm -rf * ../configure --target=arm-linux --prefix=/usr/local --enable-__cxa_atexit \ --enable-c99 --enable-long-long --enable-multilib --enable-shared \ --disable-libmudflap --disable-libssp --enable-languages=c,c++,fortran,objc \ --with-headers=/usr/local/arm-linux/include make make install 11. Create the tar.gz file cd / strip /usr/local/arm-linux/bin/* strip /usr/local/bin/arm-linux-* tar cvzf /tmp/arm-linux-tools-xxxxxxxx.tar.gz \ /usr/local/arm-linux \ /usr/local/bin/arm-linux-* \ /usr/local/bin/genext2fs \ /usr/local/include/c++/4.1.2 \ /usr/local/lib/gcc/arm-linux/4.1.2 \ /usr/local/libexec/gcc/arm-linux/4.1.2 12. If everything works fine it may take ~8 hours (on a good machine ) -- Thierry Panthier ------------------------------------------------------------------------------ APPENDIX A -- modified t-linux for gcc-4.1.2 ------------------------------------------------------------------------------ # Just for these, we omit the frame pointer since it makes such a big # difference. It is then pointless adding debugging. TARGET_LIBGCC2_CFLAGS = -fno-inline -fomit-frame-pointer -fPIC -Dinhibit_libc LIBGCC2_DEBUG_CFLAGS = -g0 # Don't build enquire ENQUIRE= LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls \ _bb_init_func _call_via_rX _interwork_call_via_rX \ _lshrdi3 _ashrdi3 _ashldi3 \ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ _fixsfsi _fixunssfsi _floatdidf _floatdisf MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float MULTILIB_DIRNAMES = le be hard-float soft-float MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle EXTRA_MULTILIB_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crti.o crtn.o LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib T_CFLAGS = -Dinhibit_libc # Assemble startup files. $(T)crti.o: $(srcdir)/config/arm/crti.asm $(GCC_PASSES) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/arm/crti.asm $(T)crtn.o: $(srcdir)/config/arm/crtn.asm $(GCC_PASSES) $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/arm/crtn.asm ------------------------------------------------------------------------------
文章评论(0条评论)
登录后参与讨论