Ubuntu Install Cross tool chain

Source: Internet
Author: User
Tags bz2

First, download the toolchain and unzip it to the root directory.

(1) Copy the downloaded toolchain (I use toolchains_for_s3c2410.tar.bz2) to the/home directory via Samba

Decompression toolchains_for_s3c2410.tar.bz2:

TAR–JXVF toolchains_for_s3c2410.tar.bz2

The Crosstool directory is generated and is typically copied to the root directory.

caoyi@ubuntu:/home$ ls
Caoyi Crosstool Kernel Study toolchains_for_s3c2410.tar.bz2

caoyi@ubuntu:/home$ sudo mv crosstool//

(2), get the absolute path of the crossover tool

CD crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin/

PWD command gets the absolute path where the cross-tool chain executable file is stored

/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

(3), modify the value of the environment variable path

caoyi@ubuntu:/home$ CD ~ (current user directory, my:/home/caoyi)

caoyi@ubuntu:/home$ vim. BASHRC

In the last line, add:

Export path= $PATH:/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

Save exit

or modify/etc/profile

Execute command: Vim/etc/profile

Add to:

Export path= $PATH:/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

Save exit

Last executed: Source/etc/profile

Ok

Execute command: Source ~/.BASHRC

Second, compile C code using the Cross tool chain

(1), create a new folder in/opt/filesystem, specifically to store the cross-compiled executable code

caoyi@ubuntu:/home$ Cd/rootfs/filesystem

caoyi@ubuntu:/rootfs/filesystem/$ sudo mkdir work

caoyi@ubuntu:/rootfs/filesystem/$ sudo chmod 777-r work (note to change the properties, otherwise the compiler will have permission issues)

caoyi@ubuntu:/home$ cd/rootfs/filesystem/work/
caoyi@ubuntu:/rootfs/filesystem/work$ sudo vim hello.c

caoyi@ubuntu:/rootfs/filesystem/work$ sudo arm-linux-gnu-gcc hello.c–o Hello

caoyi@ubuntu:/rootfs/filesystem/work$ ls
Hello hello.c
(2), in the terminal of the Development Board, namely Putty (serial port), enter the/work/directory to run Hello

# CD Work
# ls
Hello hello.c
#./hello
Hello world!
#

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.