Make Mipsel Cross Tool chain (updated version)

Source: Internet
Author: User
Tags bz2 gmp

1. The code structure is:

Setup---> Source code compression Pack

: ~/code/cross-compile$ ls setup/
binutils-2.24.tar.bz2  gcc-4.7.1.tar.bz2  gdb-7.6.2.tar.bz2   glibc-2.18.tar.bz2              linux-3.10.tar.bz2
gcc-4.6.4.tar.bz2      gcc-4.8.0.tar.bz2  glibc-2.17.tar.bz2  glibc-linuxthreads-2.5.tar.bz2  termcap-1.3.1.tar.gz
SRC---> Source code

~/code/cross-compile$ ls src/
binutils-2.24  gcc-4.7.1  gdb-7.6.2  glibc-2.18

Build--> Compilation Directory

: ~/code/cross-compile$ ls build/
binutils  gcc  gdb  glibc

Kernel----> Kernel code:

~/code/cross-compile/kernel$ ls
linux-3.10

2. Compiling binutils

Under Build/binutils, execute the command:

.. /.. /src/binutils-2.24/configure--target=mipsel-linux-gnueabi--prefix=/home/charles/code/cross-compile/ Embedded-toolchain/cross-tools--with-sysroot=/home/charles/code/cross-compile/embedded-toolchain
Then, perform make and make install installation

3. Compile GCC Stage 1

Under the BUILD/GCC directory, execute

Ar=ar ldflags= "-wl,-rpath=/home/charles/code/cross-compile/embedded-toolchain/cross-tools/lib". /.. /src/gcc-4.7.1/configure--prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools--target= Mipsel-linux-gnueabi  --with-sysroot=/home/charles/code/cross-compile/embedded-toolchain--with-gmp=/usr/ Local--with-mpfr=/usr/local--with-ppl=/usr/local--with-newlib--without-headers--disable-multilib--disable-nls- -disable-decimal-float--disable-libgomp--disable-libmudflap--DISABLE-LIBSSP--disable-shared--disable-threads-- Enable-languages=c  --with-float=soft--with-arch=mips32r2--with-tune=mips32r2
And then

Make ALL-GCC ALL-TARGET-LIBGCC

Make INSTALL-GCC INSTALL-TARGET-LIBGCC

4. Install Kernel header file

into the kernel code directory,

To execute a command:

Arch=mips make Mrproper
arch=mips make Headers_check
arch=mips Cross_compile=mipsel-gcc-linux-gnueabi INSTALL_HDR_PATH=/HOME/CHARLES/CODE/CROSS-COMPILE/EMBEDDED-TOOLCHAIN/USR Headers_install
 find/home/charles/ code/cross-compile/embedded-toolchain/usr/include/-name ". Install"-or-name ". Install.cmd "| Xargs RM-FV;

5. Compile GLIBC

Go to BUILD/GLIBC, execute

BUILD_CC=GCC CC=MIPSEL-LINUX-GNUEABI-GCC Ar=mipsel-linux-gnueabi-ar ranlib=mipsel-linux-gnueabi-ranlib. /.. /src/glibc-2.18/configure--prefix=/usr--host=mipsel-linux--enable-add-ons--with-fp=no libc_cv_forced_unwind=yes Libc_cv_c_cleanup=yes libc_cv_ctors_header=yes--with-tune=mips32r2--with-arch=mips32r2--with-headers=/home/ Charles/code/cross-compile/embedded-toolchain/usr/include
Add the Mipsel gcc generated in step 3 to path:

Export path= $PATH:/home/charles/code/cross-compile/embedded-toolchain/cross-tools/bin
Perform

Make make
install Install_root=/home/charles/code/cross-compile/embedded-toolchain
6. Compile the final GCC

Ar=ar ldflags= "-wl,-rpath=/home/charles/code/cross-compile/embedded-toolchain/cross-tools/lib". /.. /src/gcc-4.7.1/configure--prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools--target= Mipsel-linux-gnueabi--with-sysroot=/home/charles/code/cross-compile/embedded-toolchain--with-gmp=/usr/local-- With-mpfr=/usr/local--with-ppl=/usr/local--disable-multilib--DISABLE-LIBSSP  --disable-nls-- disable-libstdcxx-pch--with-arch=mips32r2--with-tune=mips32r2--enable-languages=c,c++  --with-float=soft  --with-mips-plt--disable-libgomp--disable-libmudflap--enable-poison-system-directories--enable-symvers= GNU--enable-long-long--enable-threads--enable-shared--enable-lto--enable-__cxa_atexit--with-gnu-as-- With-gnu-ld

Re-execution

Make All-gcc-j10-i-K make
ALL-TARGET-LIBGCC make
install-gcc make  install-target-libgcc
make Make
Install


Finally, take a look at the generated GCC information:

./mipsel-linux-gnueabi-gcc-v Using Built-in specs. COLLECT_GCC=./MIPSEL-LINUX-GNUEABI-GCC collect_lto_wrapper=/home/charles/toolchain/embedded-toolchain/ cross-tools/bin/.. /libexec/gcc/mipsel-linux-gnueabi/4.7.1/lto-wrapper Target:mipsel-linux-gnueabi Configured with:. /.. /src/gcc-4.7.1/configure--prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools--target= Mipsel-linux-gnueabi--with-sysroot=/home/charles/code/cross-compile/embedded-toolchain--with-gmp=/usr/local-- With-mpfr=/usr/local--with-ppl=/usr/local--disable-multilib--DISABLE-LIBSSP--disable-nls-- disable-libstdcxx-pch--with-float=soft--with-arch=mips32r2--with-tune=mips32r2--enable-languages=c,c++-- With-float=soft--with-mips-plt--disable-libgomp--disable-libmudflap--enable-poison-system-directories-- Enable-symvers=gnu--enable-long-long--enable-threads--enable-shared--enable-lto--enable-__cxa_atexit-- 
 With-gnu-as--with-gnu-ld Thread model:posix gcc version 4.7.1 (GCC)


Reference:

Http://toolchain-arm.blogspot.jp/2012/06/building-eglibc.html



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.