1 / 22

Make Toolchain

Make Toolchain. Speaker: Yi-Ji Jheng Date: 2007.11.21. Outline. Make Toolchain. Make Toolchain. Compiler of envirnoment. Compiler envirnoment need : Binutil ( Assembler and linker ) Gcc ( C compiler ) Glibc ( C library ) Difficult point when implement:. Solve questions of menthod.

melba
Télécharger la présentation

Make Toolchain

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Make Toolchain Speaker: Yi-Ji Jheng Date: 2007.11.21

  2. Outline • Make Toolchain

  3. Make Toolchain

  4. Compiler ofenvirnoment • Compiler envirnomentneed: • Binutil(Assembler and linker) • Gcc(Ccompiler) • Glibc(Clibrary) • Difficultpointwhenimplement:

  5. Solvequestionsofmenthod • 1.Usenewlibreplaceglibc • 2.Stealsomecodefromglibctocompilergcc • 3.(a)Compiletinygccfirst (b)Usetinygcctocompileglibc (c)Useglibctocompilecompletegcc

  6. Install Flow Make Kernel Header Install binutils Install gcc (temporary) Install glibc Key Install gcc (complete) Packet Toolchain

  7. Source Of Environment • /root/ |-linux-2.4.25.tar.gz • toolchain/ |-binutils-2.14.tar.gz |-gcc-3.2.3.tar.gz |-glibc-2.2.5.tar.gz |-glibc-2.2.5.patch |-glibc-linuxthreads-2.2.5.tar.gz |-t-linux.final |-t-linux.temp

  8. Make Kernel Header • #tar zxvf linux-2.4.25.tar.gz • #cd ./linux-2.4.25 • #make clean && make mrproper • #cp -a /boot/config-2.4.20-8 ./.config • #make menuconfig linux-2.4.25/include/linux/ |-autoconf.h |-version.h

  9. Backup • #mv /usr/local /usr/local.bak • #mkdir -p /usr/local • Default install path (gcc、glibc、binutils) is in /usr/local/

  10. Install Binutils • #tar zxvf binutils-2.14.tar.gz • #cd ./binutils-2.14 • #mkdir i586-linux&&cd ./i586-linux/ • #../configure --target=i586-linux • #make && make install • #ll /usr/local/bin |-i586-linux-ld |-i586-linux-as . .

  11. Install GCC (temporary) (1/2) • #tar zxvf gcc-3.2.3.tar.gz • #cd ./gcc-3.2.3 • #cp -f ../t-linux.temp gcc/config/t-linux • #mkdir i586-linux-temp • #cd ./i586-linux-temp

  12. Install GCC (temporary) (2/2) • #../configure \ --target=i586-linux \ --disable-shared \ --disable-threads \ --with-headers=/root/linux-2.4.25/include \ --enable-languages=c • #make && make install • #ll /usr/local/bin |-i586-linux-cpp |-i586-linux-gcc .

  13. Install Glibc (1/2) • #tar zxvf glibc-2.2.5.tar.gz • #tar zxvf glibc-linuxthreads-2.2.5.tar.gz \ -C ./glibc-2.2.5 • #cd ./glibc-2.2.5 • #patch -p1 < ../glibc-2.2.5.patch • #mkdir i586-linux • #cd ./i586-linux/

  14. Install Glibc (2/2) • #CC=i586-linux-gcc && \ AS=i586-linux-as && \ LD=i586-linux-ld • #../configure i586-linux \ --with-headers=/root/linux-2.4.25/include \ --enable-add-ons \ --enable-shared \ --prefix=/usr/local/i586-linux • #make && make install

  15. Install GCC (complete) (1/2) • #cd gcc-3.2.3 • #cp -f ../t-linux.final gcc/config/t-linux • #mkdir i586-linux-final • #cd i586-linux-final

  16. Install GCC (complete) (2/2) • #../configure \ --target=i586-linux \ --disable-shared \ --with-headers=/root/linux-2.4.25/include \ --with-gnu-as \ --with-gnu-ld \ --enable-multilib \ --enable-languages="c,c++" • #make && make install

  17. Packet Toolchain • #tar cvzf i586-linux-tools.tar.gz /usr/local/

  18. Test • Compile a program(hello world) with i386-toolchain • Put it on the floppy linux • Execute it

  19. REPLENISH

  20. t-linux.temp • STMP_FIXPROTO = • CRTSTUFF_T_CFLAGS_S = -fPIC • TARGET_LIBGCC2_CFLAGS = -fPIC -Dinhibit_libc -D__gthr_posix_h • T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h • SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver • LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c $(srcdir)/unwind-sjlj.c • LIB2ADDEHDEP = unwind.incunwind-dw2-fde.h unwind-dw2-fde.c

  21. errlist.os • #vi sysdeps/unix/sysv/linux/errlist.c strong_alias(__old_sys_nerr,_old_sys_nerr); weak_alias(__old_sys_nerr, _old_sys_nerr) Change to : weak_alias(__old_sys_nerr, _old_sys_nerr) strong_alias(__old_sys_nerr,_old_sys_nerr);

  22. t-linux.final • STMP_FIXPROTO = • CRTSTUFF_T_CFLAGS_S = -fPIC • TARGET_LIBGCC2_CFLAGS = -fPIC -D__gthr_posix_h • T_CFLAGS = -D__gthr_posix_h • SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver • LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c $(srcdir)/unwind-sjlj.c • LIB2ADDEHDEP = unwind.incunwind-dw2-fde.h unwind-dw2-fde.c

More Related