Linux system porting (1)------Build a cross-compilation environment

Source: Internet
Author: User

My development environment is the 64 version of ubuntu12.05, running on 11.00 of virtual machines. First, explain why you need to build a cross-compilation environment. We know that our development is generally on the PC, based on the X86 architecture, and our Development Board is based on the arm architecture. If you edit and compile our program on the PC host, then compile it according to the X86 architecture, so that the compiled binary code will not be able to run on the arm Development Board, so we need to install the cross-compiling environment, it is convenient for us to edit on the PC host, but also to run on the Development Board.

In general, the cross-compilation toolset typically provides a compiled toolchain for the chip Factory chamber. But you can also compile the cross-tool chain yourself. Here I choose the friendly arm provided by the tool chain--arm-linux-gcc-4.5.1-v6-vfp-20120301.tar.

Installing in Ubuntu is actually an uncompressed process, extracted to the standard directory in Linux. Okay, no more nonsense, here's the installation:

    • 1. Copy the compressed package to the shared directory and enter the shared directory in Ubuntu;
    • 2. Unzip the package, typing command sudo tar-zxvf arm-linux-gcc-4.5.1-v6-vfp-20120301.tar-c/; Note that the unzip command for the TAR package, and the-C is a capital letter, which means to change the directory to be installed, The following is to install the directory, because the production of the production of the time has been packaged, directly write the root directory on the line;
    • 3. After successful decompression, you can see the extracted directory in the decompression information, open the directory, you can see the various folders.
    • 4. There are two ways to use the cross-compilation toolchain: One is to use the absolute path method, for example my is to hit the command $/opt/friendlyarm/toolschain/4.5.1/bin/arm-linux-gcc-o build 1.c; The other is to use the simple method of directly knocking command Arm-linux-gcc-o build 1.c, but this method needs to configure environment variables.
    • 5. Configure the environment variables, sudo vi etc/environment after adding: opt/friendlyarm/toolschain/4.5.1/bin/, save exit, and then update on it, source etc/ Environment, you can use the method of relative path to compile, compile the direct knock Arm-linux-gcc-o build 1.c.
    • 6. Special note: Because this tool chain is for 32-bit platforms, if it is 64-bit Ubuntu, you also need to install the sudo apt-get installed ia32-libs Some 32-bit library.

Linux system porting (1)------Build a cross-compilation environment

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.