发 帖  
原厂入驻New

[转帖]制作arm-linux交叉编译工具ForXscaleBig-Endian

2008-9-27 09:08:15  1341
分享
制作ARM-linux交叉编译工具ForxscaleBig-Endian<br><br>&nbsp;&nbsp;<br>HOWTO&nbsp;build&nbsp;arm-linux&nbsp;toolchain&nbsp;for&nbsp;ARM/XSCALE<br>----------------------------------------------<br>These&nbsp;instructions&nbsp;document&nbsp;how&nbsp;to&nbsp;build&nbsp;an&nbsp;arm-linux&nbsp;tool&nbsp;chain<br>that&nbsp;contains&nbsp;big-endian&nbsp;target&nbsp;libraries.<br><br>1.&nbsp;Packages&nbsp;used:<br>binutils-2.14.tar.gz<br>gcc-3.3.2.tar.gz<br>glibc-2.2.5.tar.gz<br>glibc-linuxthreads-2.2.5.tar.gz&nbsp;<br>2.&nbsp;binutils-2.14<br>tar&nbsp;xvzf&nbsp;binutils-2.14.tar.gz<br>cd&nbsp;binutils-2.14<br>mkdir&nbsp;xscale_linux_be<br>cd&nbsp;xscale_linux_be<br>../configure&nbsp;--target=armbe-linux&nbsp;--prefix=/opt/xscale_linux_be&nbsp;--with-lib-path=/opt/xscale_linux_be/armbe-linux/lib&nbsp;--program-prefix=xscale_linux_be-<br>make<br>make&nbsp;install<br>chmod&nbsp;777&nbsp;/opt/xscale_linux_be<br>3.&nbsp;gcc-3.3.2&nbsp;--&nbsp;bootstrap&nbsp;gcc<br>tar&nbsp;xvzf&nbsp;gcc-3.3.2.tar.gz<br>cd&nbsp;gcc-3.3.2<br>cp&nbsp;$(ATTACHED&nbsp;t-linux&nbsp;file)&nbsp;gcc/config/arm/<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/GCC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc&nbsp;/GCC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc&nbsp;-mbig-endian&nbsp;/g'&nbsp;Makefile.in<br>cd&nbsp;gcc<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/GCC_FOR_TARGET&nbsp;=&nbsp;\.\/xgcc&nbsp;/GCC_FOR_TARGET&nbsp;=&nbsp;\.\/xgcc&nbsp;-mbig-endian&nbsp;/g'&nbsp;Makefile.in<br>cd&nbsp;config/arm<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_OPTIONS&nbsp;=&nbsp;mlittle-endian\/mbig-endian/MULTILIB_OPTIONS&nbsp;+=&nbsp;mlittle-endian\/mbig-endian/'&nbsp;t-arm-elf<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_DIRNAMES&nbsp;=&nbsp;le&nbsp;be/MULTILIB_DIRNAMES&nbsp;+=&nbsp;le&nbsp;be/'&nbsp;t-arm-elf<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_MATCHES&nbsp;=&nbsp;mbig-endian=mbe&nbsp;mlittle-endian=ml/MULTILIB_MATCHES&nbsp;+=&nbsp;mbig-endian=mbe&nbsp;mlittle-endian=ml/'&nbsp;t-arm-elf<br><br>export&nbsp;PATH=/opt/xscale_linux_be/bin:/opt/xscale_linux_be/armbe-linux/include:$PATH<br>mkdir&nbsp;xscale_linux_be<br>cd&nbsp;xscale_linux_be<br>../configure&nbsp;--program-prefix=xscale_linux_be-&nbsp;--prefix=/opt/xscale_linux_be&nbsp;--target=armbe-linux&nbsp;--disable-shared&nbsp;--disable-threads&nbsp;--with-headers=/home/john_ho/ixp422/src/snapgear/linux-2.4.x/include&nbsp;--with-gnu-as&nbsp;--with-gnu-ld&nbsp;--enable-multilib&nbsp;--enable-languages=c<br><br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^program_transform_cross_name&nbsp;=&nbsp;s&nbsp;\^&nbsp;\$\(target-alias\)-&nbsp;/program_transform_cross_name&nbsp;=&nbsp;s&nbsp;\^&nbsp;xscale_linux_be-&nbsp;/g'&nbsp;gcc/Makefile<br>make<br>make&nbsp;install<br>4.&nbsp;glibc-2.2.5&nbsp;(big-endian)<br>tar&nbsp;xvzf&nbsp;glibc-2.2.5.tar.gz<br>cd&nbsp;glibc-2.2.5<br>tar&nbsp;xvzf&nbsp;glibc-linuxthreads-2.2.5.tar.gz<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/i386/arm*)\n\tlibc_cv_gcc_unwind_find_fde=yes\n\tarch_minimum_kernel=2.0.10\n\t;;\n&nbsp;i386/'&nbsp;sysdeps/unix/sysv/linux/configure<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/weak_alias&nbsp;\(__old_sys_nerr/\/\/&nbsp;$&amp;/'&nbsp;sysdeps/unix/sysv/linux/arm/errlist.c<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/weak_alias&nbsp;\(__old_sys_nerr/\/\/&nbsp;$&amp;/'&nbsp;sysdeps/unix/sysv/linux/errlist.c<br><br>cd&nbsp;sysdeps/arm<br>patch&nbsp;-p0&nbsp;&lt;&nbsp;../../Patch.armbe-strlen-fix<br>vi&nbsp;linuxthreads/sysdeps/pthread/pthread.h<br>-&nbsp;change&nbsp;line&nbsp;163&nbsp;__thread&nbsp;-&gt;&nbsp;"__thr"<br>-&nbsp;change&nbsp;line&nbsp;591&nbsp;__thread&nbsp;-&gt;&nbsp;"__thr"<br>vi&nbsp;linuxthreads/internals.h<br>-&nbsp;change&nbsp;line&nbsp;555&nbsp;__thread&nbsp;-&gt;&nbsp;"__thr"<br>vi&nbsp;linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h<br>-&nbsp;change&nbsp;line&nbsp;36&nbsp;__thread&nbsp;-&gt;&nbsp;"__thr"<br>vi&nbsp;stdio-common/sprintf.c<br>-&nbsp;line&nbsp;30&nbsp;change&nbsp;to&nbsp;"sprintf(char&nbsp;*s&nbsp;const&nbsp;char&nbsp;*format&nbsp;...)"<br>vi&nbsp;stdio-common/sscanf.c<br>-&nbsp;line&nbsp;30&nbsp;change&nbsp;to&nbsp;"sscanf(const&nbsp;char&nbsp;*s&nbsp;const&nbsp;char&nbsp;*format&nbsp;...)"<br>vi&nbsp;sysdeps/unix/sysv/linux/arm/sysdep.h<br>-&nbsp;line&nbsp;134&nbsp;remove&nbsp;"a1"&nbsp;from&nbsp;clobber&nbsp;list<br>vi&nbsp;sysdeps/arm/dl-machine.h<br>-&nbsp;add&nbsp;'\n\'&nbsp;to&nbsp;end&nbsp;of&nbsp;all&nbsp;macro&nbsp;asm&nbsp;lines&nbsp;(there&nbsp;is&nbsp;a&nbsp;_lot_&nbsp;of&nbsp;them)<br>vi&nbsp;config.make.in<br>-&nbsp;change&nbsp;"slibdir=@...@"&nbsp;to&nbsp;"slibdir=@libdir@"<br><br>vi&nbsp;sysdeps/unix/sysv/linux/arm/ioperm.c<br>-&nbsp;add&nbsp;include&nbsp;file&nbsp;to&nbsp;avoid&nbsp;compile&nbsp;error&nbsp;of&nbsp;BUS_ISA&nbsp;not&nbsp;defined.<br>mkdir&nbsp;xscale_linux_be<br>cd&nbsp;xscale_linux_be<br>export&nbsp;CC="xscale_linux_be-gcc&nbsp;-mbig-endian&nbsp;-finline-limit=10000"<br>export&nbsp;AR="xscale_linux_be-ar"<br>export&nbsp;RANLIB="xscale_linux_be-ranlib"<br>export&nbsp;LD="xscale-linux_be-ld&nbsp;-mbig-endian"<br>../configure&nbsp;armbe-linux&nbsp;--target=armbe-linux&nbsp;--prefix=/opt/xscale_linux_be/armbe-linux&nbsp;--build=i686-pc-linux-gnu&nbsp;--with-headers=/opt/xscale_linux_be/armbe-linux/sys-include&nbsp;--enable-add-ons=linuxthreads&nbsp;--enable-shared<br>make<br>make&nbsp;install<br>6.&nbsp;gcc-3.3.2&nbsp;(c++&nbsp;etc)&nbsp;full&nbsp;version<br>tar&nbsp;xvzf&nbsp;gcc-3.3.2.tar.gz<br>cd&nbsp;gcc-3.3.2<br>cp&nbsp;$(ATTACHED&nbsp;t-linux&nbsp;file)&nbsp;gcc/config/arm/<br>vi&nbsp;gcc/config/arm/t-linux&nbsp;<br>-&nbsp;remove&nbsp;all&nbsp;"-Dinhibit_libc"&nbsp;occruances<br><br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/GCC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc&nbsp;/GCC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc&nbsp;-mbig-endian&nbsp;/g'&nbsp;Makefile.in<br>cd&nbsp;gcc<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/GCC_FOR_TARGET&nbsp;=&nbsp;\.\/xgcc&nbsp;/GCC_FOR_TARGET&nbsp;=&nbsp;\.\/xgcc&nbsp;-mbig-endian&nbsp;/g'&nbsp;Makefile.in<br>cd&nbsp;config/arm<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_OPTIONS&nbsp;=&nbsp;mlittle-endian\/mbig-endian/MULTILIB_OPTIONS&nbsp;+=&nbsp;mlittle-endian\/mbig-endian/'&nbsp;t-arm-elf<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_DIRNAMES&nbsp;=&nbsp;le&nbsp;be/MULTILIB_DIRNAMES&nbsp;+=&nbsp;le&nbsp;be/'&nbsp;t-arm-elf<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^#&nbsp;MULTILIB_MATCHES&nbsp;=&nbsp;mbig-endian=mbe&nbsp;mlittle-endian=ml/MULTILIB_MATCHES&nbsp;+=&nbsp;mbig-endian=mbe&nbsp;mlittle-endian=ml/'&nbsp;t-arm-elf<br>export&nbsp;PATH=/opt/xscale_linux_be/bin:/opt/xscale_linux_be/armbe-linux/include:$PATH<br>mkdir&nbsp;xscale_linux_be<br>cd&nbsp;xscale_linux_be<br>../configure&nbsp;--program-prefix=xscale_linux_be-&nbsp;--prefix=/opt/xscale_linux_be&nbsp;--target=armbe-linux&nbsp;--enable-multilib&nbsp;--with-headers=/opt/xscale_linux_be/armbe-linux/include&nbsp;--enable-languages=c&nbsp;c++<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/int&nbsp;namelen/unsigned&nbsp;int&nbsp;namelen/'&nbsp;../libjava/java/net/natInetAddress.cc<br>[&nbsp;For&nbsp;big-endian&nbsp;]<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/^CC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc/CC_FOR_TARGET&nbsp;=&nbsp;\$\$r\/gcc\/xgcc&nbsp;-mbig-endian&nbsp;/'&nbsp;Makefile<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/\$\$r\/gcc\/&nbsp;-nostdinc\+\+&nbsp;/\$\$r\/gcc\/&nbsp;-nostdinc++&nbsp;-mbig-endian&nbsp;/'&nbsp;Makefile<br>cd&nbsp;gcc<br>perl&nbsp;-pi&nbsp;-e&nbsp;'s/libstdc\+\+&nbsp;/libstdc\+\+&nbsp;-mbig-endian&nbsp;/'&nbsp;Makefile<br>make&nbsp;LDFLAGS="-mbig-endian"<br>make&nbsp;install<br><br>7.&nbsp;gdb-5.1.1<br>bzip2&nbsp;-cd&nbsp;gdb-5.1.1.tar.bz2&nbsp;|&nbsp;tar&nbsp;xvf&nbsp;-<br>cd&nbsp;gdb-5.1.1<br>mkdir&nbsp;xscale_linux_be<br>cd&nbsp;xscale_linux_be<br>../configure&nbsp;--prefix=/opt/xscale_linux_be&nbsp;--program-prefix=xscale_linux_be-&nbsp;--target=armbe-linux<br>make<br>make&nbsp;install<br>8.&nbsp;cd&nbsp;/<br>tar&nbsp;cvzf&nbsp;/opt/xscale_linux_be-toolchain-20040511.tar.gz&nbsp;/opt/xscale_linux_be&nbsp;<br>------------------------------------------------------------------------------<br>APPENDIX&nbsp;A&nbsp;--&nbsp;modIFied&nbsp;t-linux&nbsp;for&nbsp;gcc-3.3.2<br>------------------------------------------------------------------------------<br>#&nbsp;Just&nbsp;for&nbsp;these&nbsp;we&nbsp;omit&nbsp;the&nbsp;frame&nbsp;pointer&nbsp;since&nbsp;it&nbsp;makes&nbsp;such&nbsp;a&nbsp;big<br>#&nbsp;difference.&nbsp;It&nbsp;is&nbsp;then&nbsp;pointless&nbsp;adding&nbsp;debugging.<br>TARGET_LIBGCC2_CFLAGS&nbsp;=&nbsp;-fomit-frame-pointer&nbsp;-fPIC&nbsp;-Dinhibit_libc&nbsp;-D__gthr_posix<br>LIBGCC2_DEBUG_CFLAGS&nbsp;=&nbsp;-g0<br>#&nbsp;Don't&nbsp;build&nbsp;enquire<br>ENQUIRE=<br>LIB1ASMSRC&nbsp;=&nbsp;arm/lib1funcs.asm<br>LIB1ASMFUNCS&nbsp;=&nbsp;_udivsi3&nbsp;_divsi3&nbsp;_umodsi3&nbsp;_modsi3&nbsp;_dvmd_lnx<br>#&nbsp;MULTILIB_OPTIONS&nbsp;=&nbsp;mhard-float/msoft-float<br>#&nbsp;MULTILIB_DIRNAMES&nbsp;=&nbsp;hard-float&nbsp;soft-float<br>MULTILIB_OPTIONS&nbsp;=&nbsp;mlittle-endian/mbig-endian<br>MULTILIB_DIRNAMES&nbsp;=&nbsp;le&nbsp;be<br>#&nbsp;If&nbsp;you&nbsp;want&nbsp;to&nbsp;build&nbsp;both&nbsp;APCS&nbsp;variants&nbsp;as&nbsp;multilib&nbsp;options&nbsp;this&nbsp;is&nbsp;how<br>#&nbsp;to&nbsp;do&nbsp;it.<br>#&nbsp;MULTILIB_OPTIONS&nbsp;+=&nbsp;mapcs-32/mapcs-26<br>#&nbsp;MULTILIB_DIRNAMES&nbsp;+=&nbsp;apcs-32&nbsp;apcs-26<br>EXTRA_MULTILIB_PARTS&nbsp;=&nbsp;crtbegin.o&nbsp;crtbeginS.o&nbsp;crtend.o&nbsp;crtendS.o&nbsp;crti.o&nbsp;crtn.o<br>LIBGCC&nbsp;=&nbsp;stmp-multilib<br>INSTALL_LIBGCC&nbsp;=&nbsp;install-multilib<br>T_CFLAGS&nbsp;=&nbsp;-Dinhibit_libc&nbsp;-D__gthr_posix_h<br>#&nbsp;Assemble&nbsp;startup&nbsp;files.<br>$(T)crti.o:&nbsp;$(srcdir)/config/arm/crti.asm&nbsp;$(GCC_PASSES)<br>$(GCC_FOR_TARGET)&nbsp;$(GCC_CFLAGS)&nbsp;$(MULTILIB_CFLAGS)&nbsp;$(INCLUDES)&nbsp;\<br>-c&nbsp;-o&nbsp;$(T)crti.o&nbsp;-x&nbsp;assembler-with-cpp&nbsp;$(srcdir)/config/arm/crti.asm<br>$(T)crtn.o:&nbsp;$(srcdir)/config/arm/crtn.asm&nbsp;$(GCC_PASSES)<br>$(GCC_FOR_TARGET)&nbsp;$(GCC_CFLAGS)&nbsp;$(MULTILIB_CFLAGS)&nbsp;$(INCLUDES)&nbsp;\<br>-c&nbsp;-o&nbsp;$(T)crtn.o&nbsp;-x&nbsp;assembler-with-cpp&nbsp;$(srcdir)/config/arm/crtn.asm<br>------------------------------------------------------------------------------<br>------------------------------------------------------------------------------<br>APPENDIX&nbsp;B&nbsp;--&nbsp;Patch.armbe-strlen-fix&nbsp;for&nbsp;glibc-2.2.5<br>------------------------------------------------------------------------------<br>---&nbsp;strlen.S.orig&nbsp;2003-06-30&nbsp;14:55:04.000000000&nbsp;+0200<br>+++&nbsp;strlen.S&nbsp;2003-06-30&nbsp;14:58:16.000000000&nbsp;+0200<br>@@&nbsp;-53&nbsp;11&nbsp;53&nbsp;20&nbsp;@@<br>ldrne&nbsp;r2&nbsp;[r1]&nbsp;$4&nbsp;@&nbsp;and&nbsp;we&nbsp;continue&nbsp;to&nbsp;the&nbsp;next&nbsp;word<br>bne&nbsp;Laligned&nbsp;@<br>Llastword:&nbsp;@&nbsp;drop&nbsp;through&nbsp;to&nbsp;here&nbsp;once&nbsp;we&nbsp;find&nbsp;a<br>+#ifdef&nbsp;__ARMEB__<br>+&nbsp;tst&nbsp;r2&nbsp;$0xff000000&nbsp;@&nbsp;word&nbsp;that&nbsp;has&nbsp;a&nbsp;zero&nbsp;byte&nbsp;in&nbsp;it<br>+&nbsp;addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@<br>+&nbsp;tstne&nbsp;r2&nbsp;$0x00ff0000&nbsp;@&nbsp;and&nbsp;add&nbsp;up&nbsp;to&nbsp;3&nbsp;bytes&nbsp;on&nbsp;to&nbsp;it<br>+&nbsp;addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@<br>+&nbsp;tstne&nbsp;r2&nbsp;$0x0000ff00&nbsp;@&nbsp;(if&nbsp;first&nbsp;three&nbsp;all&nbsp;non-zero&nbsp;4&nbsp;addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@&nbsp;must&nbsp;be&nbsp;zero)<br>+#else<br>tst&nbsp;r2&nbsp;$0x000000ff&nbsp;@&nbsp;word&nbsp;that&nbsp;has&nbsp;a&nbsp;zero&nbsp;byte&nbsp;in&nbsp;it<br>addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@<br>tstne&nbsp;r2&nbsp;$0x0000ff00&nbsp;@&nbsp;and&nbsp;add&nbsp;up&nbsp;to&nbsp;3&nbsp;bytes&nbsp;on&nbsp;to&nbsp;it<br>addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@<br>tstne&nbsp;r2&nbsp;$0x00ff0000&nbsp;@&nbsp;(if&nbsp;first&nbsp;three&nbsp;all&nbsp;non-zero&nbsp;4&nbsp;addne&nbsp;r0&nbsp;r0&nbsp;$1&nbsp;@&nbsp;must&nbsp;be&nbsp;zero)<br>+#endif<br>RETINSTR(mov&nbsp;pc&nbsp;lr)<br>END(strlen)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;本文可能所用到的IC型号:&nbsp;<strong>SN74ALS569AN</strong>&nbsp;<strong>BUZ104</strong>&nbsp;<strong>ADM3202AN</strong>&nbsp;<strong>MC10H174FNR2</strong>&nbsp;<strong>MC74HC393FL1</strong>&nbsp;<strong>UC3901N</strong>&nbsp;<strong>XC4006E-2PQ160C</strong>&nbsp;<strong>XC3042-100TQ100C</strong>&nbsp;<strong>XC2V500-5FG456C</strong>
<p align="right"><font class="Apple-style-span" color="#000066"><br></font></p>
0
2008-9-27 09:08:15   评论 分享淘帖
1 个讨论
清除广告回复  分割主题.
2011-6-7 17:29:06 评论

举报

只有小组成员才能发言,加入小组>>

136个成员聚集在这个小组

加入小组

创建小组步骤

关闭

站长推荐 上一条 /8 下一条

快速回复 返回顶部 返回列表