Using Crosstool to make cross-compilation tools under Ubuntu

Source: Internet
Author: User

1, Ubuntu version: unbutu10.10 (the above version should also be, I did not test)

2, the production of cross-compilation tools need files:

L BINUTILS-2.16.1.TAR.BZ2 http://mirrors.ustc.edu.cn/gnu/binutils/

L gcc-3.3.6.tar.gz http://mirrors.ustc.edu.cn/gnu/gcc/gcc-3.3.6/

L glibc-2.3.2.tar.gz http://mirrors.ustc.edu.cn/gnu/glibc/

L glibc-linuxthreads-2.3.2.tar.gz http://mirrors.ustc.edu.cn/gnu/glibc/

L linux-2.6.10.tar.gz https://www.kernel.org/pub/linux/kernel/v2.6/

L LINUX-LIBC-HEADERS-2.6.12.0.TAR.BZ2 http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ linux-libc-headers-2.6.12.0.tar.bz2

4, the production of low version of GCC needs files:

This example is based on gcc-3.4.6

L GCC-3.4-BASE_3.4.6-6UBUNTU3_I386.DEB,

L GCC-3.4_3.4.6-6UBUNTU3_I386.DEB,

L CPP-3.4_3.4.6-6UBUNTU3_I386.DEB,

L G++-3.4_3.4.6-6UBUNTU3_I386.DEB,

L Libstdc++6-dev_3.4.6-6ubuntu3_i386.deb

Libstdc++6_3.4.6_6ubuntu3_i386.deb

Above package download Address:

http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/

5, should first install some plug-ins

sudo apt-get install Ncurses-dev

sudo apt-get install Bison

sudo apt-get install Flex

sudo apt-get install build-essential

These plug-ins are required to compile a lower version of GCC.

6, oneself in the main directory under a new directory for gcc-3.4.6, the production of low version of GCC need to copy the files to the directory.

Run Dpkg-i *.deb in this directory

This command is to install all the files with the suffix. Deb, and you can install individual files separately

7, after the successful installation, run the command

Update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-3.4 40

Update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-4.4 30

At this point you may be prompted that no update-alternatives command does not exist, then install what is missing

8, switch to gcc-3.4.6

Run command update-alternatives--config GCC

Select the GCC version you want, and select the gcc-3.4.6 you just installed.

9. View current GCC version

Run Command gcc-v

Here's how to make your own cross-compilation tool:

10, in the main directory decompression crosstool-0.43.tar.gz generated directory crosstool-0.43

Run command tar zxvf crosstool-0.43.tar.gz

11, into the extract after the directory, modify the relevant documents

Run Command CD crosstool-0.43.tar.gz enter directory

Run command CP demo-arm.sh arm.sh

Run Command VI arm.sh

Arm.sh contents are as follows:

#!/bin/sh

# This script has one line for each known working toolchain

# for this architecture. Uncomment the one you want.

# generated by generate-demo.pl from Buildlogs/all.dats.txt

Set-ex

tarballs_dir= $HOME/mydown

result_top= $HOME/opt/crosstool

Export Tarballs_dir Result_top

Gcc_languages= "C,c++"

Export Gcc_languages

# really, you should doing the mkdir before running this,

# and Chown/opt/crosstool to yourself so don ' t need to run as root.

sudo mkdir-p $RESULT _top

#eval ' cat arm.dat gcc-2.95.3-glibc-2.1.3.dat ' sh all.sh--notest

#eval ' cat arm.dat gcc-2.95.3-glibc-2.2.2.dat ' sh all.sh--notest

#eval ' cat arm.dat gcc-2.95.3-glibc-2.2.5.dat ' sh all.sh--notest

#eval ' cat arm.dat gcc-3.2.3-glibc-2.2.5.dat ' sh all.sh--notest

#eval ' cat arm.dat gcc-3.2.3-glibc-2.3.2.dat ' sh all.sh--notest

#eval ' C

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.