Use crosstool tool to build a cross tool chain-2

Source: Internet
Author: User

Open the arm9.dat file under the crosstool-0.43 directory with the following content:

Kernelconfig = 'pwd'/arm. config

Target = arm-unknown-Linux-GNU

Target_cflags = "-o" is generally used to set some variables. You do not need to change them. Use the default value! However, you can change the arm-unknown-Linux-GNU to arm-Linux, and the command may be shorter, so I changed it!

Open the crosstool-0.43 file under the gcc-4.1.0-glibc-2.3.2-tls.dat directory (I believe you also saw, corresponding to your selected above), the content is as follows:

Binutils_dir = binutils-2.16.1

Gcc_core_dir = gcc-3.3.6

Gcc_dir = gcc-4.1.0

Glibc_dir = glibc-2.3.2

Linux_dir = linux-2.6.15.4

Linux_sanitized_header_dir = linux-libc-headers-2.6.12.0

Glibcthreads_filename = glibc-linuxthreads-2.3.2

Gdb_dir = gdb-6.5

Glibc_extra_config = "$ glibc_extra_config -- With-TLS -- With-_ thread -- enable-kernel = 2.4.18"

Then go to the Internet to download several red-marked source code packages, which are usually the * .tar.bz2 file (it seems that crosstool can search for the code package on the Internet, but I can use it quickly ). After renewal, it will be successful. The downloaded files are stored in the/root/downloads directory, and then saved in the/home/downloads directory. (If the files are not stored in the/home/downloads directory, do not know if they can succeed, I just put it here.) Note that you don't need to decompress it !! Now, it's OK!

3, enter the crosstool-0.43 directory, input./demo-arm.sh, according to the online brothers said, it seems that should be successful. However, the following prompt appears: (only part)

+ Abort 'don'/'t run all. Sh or crosstool. Sh as root, it '/' s dangerous'

+ Echo 'don'/'t'run all. Sh or crosstool. Sh as root, 'it'/'s' dangerous

Don't run all. Sh or crosstool. Sh as root, it's dangerous

I can see it. It is not allowed by the root user. It is called "it's dangerous". It's depressing ~~~! Create an account. I have created a tyl. Switch to tyl: su-tyl in the terminal and run it. I thought I had to succeed again, and the result was dumpfounded. The prompt was that I didn't have the write permission under tyl !! Nnd !!! I 've been busy searching for a long time to get the write permission limit for tyl users, but I have no clue. It seems that it's stuck here... I searched the internet again, finally found the answer, and switched it back to the root user !! Enter su directly on the terminal, enter the password as prompted, compile, and everything is OK. After n (n> = 4) hours of compilation, you can see the tool chain, header file, library file, and so on in your/opt/crosstool directory! You can add the directory where the toolchain is located to the environment variable path: enter export Path =/opt/crosstool/gcc-4.1.0-glibc-2.3.2/ARM-Linux/bin: $ path in the terminal

VI/etcbashrc can be used now. Compile the simplest hello. c file, input arm-Linux-gcc-O hello. C, and then file hello.

Hello: Elf 32-bit LSB executable, arm, Version 1 (ARM), for GNU/Linux 2.4.18, dynamically linked (uses SHARED libs), for GNU/Linux 2.4.18, not stripped

It indicates the operation is successful. But it is not completely successful yet. If you open another terminal, you will be prompted that you cannot find the arm-Linux-GCC command, you also need to add export Path =/opt/crosstool/gcc-4.1.0-glibc-2.3.2/ARM-Linux/bin: $ path under the last line of/etc/bashrc

Then OK

Note: The patch directory under the crosstool-0.43 directory contains patches for each tool chain. If there is an error during compilation, can Be In The crosstool-0.43 directory build directory in the decompressed source file in the patch (I did not patch the compilation successful, huh, huh ).

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.