HOWTO BUILD ARM-Linux Toolchain for ARMXScale

xiaoxiao2021-03-18  203

HOWTO BUILD ARM-Linux Toolchain for ARM / XSCALE ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------ The constructions Document How To Build An Arm-Linux Tool Chain That Contains Both Little-Endian and Big-Endian Target Libraries. 1. Packages Used: binutils-2.3.2.TAR.gz GCC-3.3.2.TAR .gz glibc-2.2.5.tar.gz glibc-linuxthreads-2.2.5.tar.gz 2. Binutils-2.14 tar xvzf binutils-2.14.gz cd binutils-2.4 mkdir xscale_linux_be cd xscale_linux_be ../configure - target = armbe-linux --prefix = / opt / xscale_linux_be --with-lib-path = / opt / xscale_linux_be / armbe-linux / lib --program-prefix = xscale_linux_be- make make install chmod 777 / opt / xscale_linux_be 3. GCC-3.3.2 - Bootstrap GCC TAR XVZF GCC-3.3.2.Tar.gz CD GCC-3.3.2 Cp $ (Attached T-Linux File) GCC / Config / ARM / Perl -Pi-E 'S / GCC_FOR_TARGET = / $ / $ r // gcc // xgcc / gcc_for_target = / $ / $ r // gcc // xgcc -mbig-endian / g 'makefile.in CD GCC perl -pi -e' s / gcc_for_target = /. // xgcc / gcc_for_target = / .//xgcc -mbig-endian / g 'makefile.in cd config / arm perl -pi -e' s / ^ # m ULTILIB_OPTIONS = mlittle-endian // mbig-endian / MULTILIB_OPTIONS = mlittle-endian // mbig-endian / 't-arm-elf perl -pi -e' s / ^ # MULTILIB_DIRNAMES = le be / MULTILIB_DIRNAMES = le be / 'T-ARM-ELF Perl -Pi -e' S / ^ # MULTILIB_MATCHES = Mbig-endian = MBE mlittle-endian = ml / multilib_matches = mbig-endian = mbe mlittle-Endian = ml / 'T-ARM-ELF EXPORT PATH = / opt / xscale_linux_be / bin: / opt / xscale_linux_be / armbe-linux / include: $ PATH mkdir xscale_linux_be cd xscale_linux_be ../configure --program-prefix = xscale_linux_be- --prefix = / opt / xscale_linux_be --target = Armbe-linux --disable-shared --disable-threads --with-headers =

/HOME/JoHN_HO/IXP422/src/snapgear/linux-2.4.x/include --with-gnu-as --with-gnu-ld --enable-multililib --enable-languages ​​= c perl -pi -e ' s / ^ program_transform_cross_name = s, / ^, / $ / (target-alias /) -, / program_transform_cross_name = s, / ^, xscale_linux_be -, / g 'gcc / Makefile make make install 4. glibc-2.2.5 (big -ENDIAN) TAR XVZF GLIBC-2.2.5.Tar.gz CD Glibc-2.2.5 TAR XVZF Glibc-linuxthreads-2.2.5.tar.gz Perl -Pi-E 'S / I386 / ARM *) / N / TLIBC_CV_GCC_UNWIND_FIND_FDE = YES / N / TARCH_MINIMUM_KERNEL = 2.0.10 / n / t ;; / N i386 / 'sysdeps / unix / sysv / linux / configure perl -pi -e' s / weak_alias / (__ old_sys_nerr / $ & / 'sysdeps / unix /sv/linux/Arm/errlist.c perl -pi -e 's / weak_alias / (__ old_sys_nerr / $ & /' sysdeps / unix / sysv / linux / errlist.c cd sysdeps / arm patch -p0 <../. ./Patch.armbe-strlen-fix vi Linuxthreads / sysdeps / pthread / pthread.h - change line 163, "__thread" -> "__thr" - Change Line 591, "__thread" -> "__thr" VI Linuxthreads / Internals. H - Change Line 555, "__thread" -> "__thr" vi Linuxthreads / sysdeps / unix / sysv / linux / bits / si GTHREAD.H - CHANGE LINE 36, "__thread" -> "__thr" vi stdio-common / sprintf.c - line 30, change to "sprintf (char * s, const char * format, ...)" VI stdio- Common / SSCANF.C - LINE 30, CHANGE TO SSCANF (Const Char * S, Const Char * Format, ...) "VI sysdeps / unix / sysv / linux / arm / sysdep.h - line 134, remove" A1 "from clobber list vi sysdeps / arm / dl-machine.h - add '/ n /' to end of all macro asm lines (there is a _lot_ of them) vi config.make.in - change" slibdir = @ .. . @ "To" slibdir = @ libdir @ "

vi sysdeps / unix / sysv / linux / arm / ioperm.c -. add include file to avoid error of BUS_ISA not defined mkdir xscale_linux_be cd xscale_linux_be export CC = "xscale_linux_be-gcc -mbig-endian compile - finline-limit = 10000 "export AR =" xscale_linux_be-ar "export rANLIB =" xscale_linux_be-ranlib "export LD =" xscale-linux_be-ld -mbig-endian "../configure armbe-linux --target = armbe-linux --prefix = / opt / xscale_linux_be / armbe-linux --build = i686-pc-linux-gnu --with-headers = / opt / xscale_linux_be / armbe-linux / sys-include --enable-add-ons = LinuXThreads --enable-shared make make install 6. GCC-3.3.2 (C , ETC) Full Version TAR XVZF GCC-3.3.2.tar.gz CD GCC-3.3.2 CP $ (Attached T-Linux File) GCC / CONFIG / ARM / VI GCC / CONFIG / ARM / T-Linux - Remove All "-dinhibit_libc" Occruan "perl -pi -e 's / gcc_for_target = / $ / $ r // gcc // xgcc / gcc_for_target = / $ / $ / $ R // gcc // xgcc -mbig-endian / g 'makefile.in cd gcc perl -pi -e' s / gcc_for_target = / .//xgcc / gcc_for_target = / .//xgcc -mbig-endian / g 'makefile CD Config / ARM P Erl -Pi -e 's / ^ # multilib_options = mlittle-endian // mbig-endian / multililib_options = mlittle-endian // mbig-endian /' t-arm-elf perl -pi -e 's / ^ # multilib_DirNames = Le Be / multilib_dirnames = le be / 't-arm-Elf perl -pi -e' s / ^ # multilib_matches = mbig-endian = mbe mlittle-endian = ml / multilib_matches = mbig-endian = mbe mlittle-endian = ml / 't-arm-elf export PATH = / opt / xscale_linux_be / bin: / opt / xscale_linux_be / armbe-linux / include: $ PATH mkdir xscale_linux_be cd xscale_linux_be ../configure --program-prefix = xscale_linux_be- - Prefix =

/ opt / xscale_linux_be --target = armbe-linux --enable-multilib --with-headers = / opt / xscale_linux_be / armbe-linux / include --enable-language = c, c perl -pi -e 's / int Namelen / unsigned int namenlen / '../libjava/java/net/natinetaddress.cc [for big-endian] perl -pi -e' s / ^ cc_for_target = / $ / $ r // gcc // xgcc / cc_for_target = / $ / $ r // gcc // xgcc -mbig-endian / 'makefile perl -pi -e' s // $ / $ r // gcc // -nostdinc / / // $ / $ r // GCC // -nostdinc -mbig-endian / 'makefile CD GCC Perl -pi -e' s / libstdc / / / libstdc / / -Mbig-endian / 'makefile make ldflags = "- mbig-endian" MAKE Install 7. GDB-5.1.1 Bzip2 -CD GDB-5.1.1.tar.bz2 | TAR XVF - CD GDB-5.1.1 Mkdir Xscale_Linux_Be CD xscale_linux_be ../configure --prefix = / OPT / XScale_Linux_be --Program- Prefix = xscale_linux_be- --target = armbe-linux make make install 8. CD / tar cvzf /opt/xscale_linux_be-tautchain-20040511.tar.gz / OPT / XScale_Linux_be ---------------------------------------------- -------------------------------------------------- -------------- Appendix A - Modified T-Linux for GCC-3.3.2 ------- -------------------------------------------------- --------------------- # Just for There, We omit the frame pointer Since It Makes Such A BIG # Difference. It is life Pointless adding debugging. Target_libgcc2_cflags = - fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix LIBGCC2_DEBUG_CFLAGS = -g0 # Do not build enquire ENQUIRE = LIB1ASMSRC = arm / lib1funcs.asm LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx # MULTILIB_OPTIONS = mhard-float / msoft-float # MULTILIB_DIRNAMES = Hard-float soft-float multilib_options = mlittle-endian / mbig-endian multilib_dirnames =

le be # If you want to build both APCS variants as multilib options this is how # to do it. # MULTILIB_OPTIONS = mapcs-32 / mapcs-26 # MULTILIB_DIRNAMES = apcs-32 apcs-26 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 -D__gthr_posix_h # Assemble startup files $ (T) crti.o:. $ (srcdir) / config / arm / Crti.asm $ (GCC_Passes) $ (GCC_FOR_TARGET) $ (GCC_CFLAGS) $ (incrudes) / -c-$ (t) crti.o-zembler-with-cpp $ (srcdir) / config / ARM / CRTI.ASM $ (T) CRTN.O: $ (srcdir) /config/arm/crtn.asm $ (GCC_Passes) $ (GCC_FOR_TARGET) $ (GCC_CFLAGS) $ (Includes) / -c-in $ (T) crtn.o -x assembler-with-cpp $ (srcdir) /config/arm/CRTN.ASM ------------------------ -------------------------------------------------- ---- ---------------------------------------------- -------------------------------- Appendix B - Patch.armbe-strlen-fixed for glibc-2.2.5 - -------------------------------- --------------------------------------------- - Strlen. S.ORIG 2003-06-30 14: 55: 04.000000000 0200 Strlen.s 2003-06-30 14: 58: 16.0000000 0200 @@ -53 ,11 53, 20 @@ ldrne r2, [R1 ], $ 4 @ And We Continue To The Next Word Bne Laligned @ Llastword: @Drop through to here once We Find A # IFDEF __ARMEB__ TST R2, $ 0xFF000000 @ Word That Has A Zero Byte IT Addne R0, R0, $ 1 @ TSTNE R2, $ 0x00FF0000 @ and add up to 3 bytes on to it addne R0, R0, $ 1 @ TSTNE R2, $ 0X0000FF00 @ (if First Three All Non-Zero, 4th Addne R0, R0, $ 1 @Must Be Zero # Else TST R2, $ 0x000000FF @

Word That Has A Zero Byte IN IT Addne R0, R0, $ 1 @ TSTNE R2, $ 0x0000FF00 @ Andd Up to 3 bytes On To IT Addne R0, R0, $ 1 @ TSTNE R2, $ 0x00FF0000 @ (if First Three All Non- Zero, 4th Addne R0, R0, $ 1 @Must Be Zero # Endif Retinstr (MOV, PC, LR) End (Strlen) --------------------- -------------------------------------------------- -------