Reprint Please specify source: http://blog.csdn.net/mybelief321/article/details/9076583
Installation Environment
Linux version: Ubuntu 12.04 kernel version: Linux 3.5.0 cross compiler version: arm-linux-gcc-4.4.3 This version of the cross-compiler I have uploaded to the resources, can download freely, click here to download
Pre-Installation ramble
First, a simple introduction, the so-called cross-compilation environment, that is, the installation, configuration cross-compilation tool chain. In this environment, the embedded Linux system needs to compile the operating system, applications, etc., and then uploaded to the target machine.
The cross-compilation Toolchain is a program code for compiling, linking, processing, and debugging cross-platform architectures. For cross-development toolchain, a prefix is added to the file name to distinguish the local toolchain. For example, arm-linux-represents a cross-compilation tool chain to Arm; ARM-LINUX-GCC represents a compiler that uses GCC. In addition to the architecture-related compilation options, it is used the same way as the GCC on a Linux host, so Linux programming techniques are also applicable to embedded systems. However, not all versions can be used, and various packages often have version matching issues. For example, compiling the kernel requires using the arm-linux-gcc-4.3.3 version of the cross-compilation toolchain, and using the arm-linux-gcc-3.4.1 cross-compilation Toolchain will cause compilation to fail.
So what is the difference between GCC and ARM-LINUX-GCC? The difference is that GCC is the C language compiler under Linux, the compiled program is executed locally, and ARM-LINUX-GCC is used to cross-platform C compiler under Linux, the compiled program is executed on the target machine (such as ARM platform), embedded development should use the embedded cross-compiler tool chain.
Installation steps
1, the compression package arm-linux-gcc-4.4.3.tar.gz stored in a directory, this directory is you will unzip the directory, after this directory can not be arbitrarily deleted, my storage path is/home/song/software, such as, remember this path, It will be used for a while.
2. Use the tar command: Tar zxvf arm-gcc-4.4.3.tar.gz to install the arm-linux-gcc-4.4.3.tar.gz decompression under the Software folder into the current directory as
You can see the decompression is successful, and the extracted files are stored in the/home/song/software/opt/friendlyarm/toolschain/4.4.3 folder, as shown, this storage path can be remembered, such as
3, next configure the system environment variables, the cross-compilation tool chain to add the path to the environment variable path, so that you can use these tools in any directory. Note the installation path in the previous step, using the command: Vim/etc/profile edit the profile file and add environment variables.
Add the last line in profile: Export path= $PATH:/home/song/software/opt/friendlyarm/toolschain/4.4.3/bin This path is the path where the bin directory resides, Maybe you are not the same, according to your actual directory to fill in, such as 32 lines
It's good to write the save.
4. Use command: Source/etc/profile make environment variable effective
5, enter the command on the terminal arm-linux and then press the TAB key, you can see that the environment variable setting is successful
6, use command: ARM-LINUX-GCC-V will appear the following error prompt:/home/song/software/opt/friendlyarm/toolschain/4.4.3/bin/arm-linux-gcc:15: EXEC:/home/song/software/opt/friendlyarm/toolschain/4.4.3/bin/.arm-none-linux-gnueabi-gcc:not found
The reason for this problem is that the Ubuntu12.04 is 64-bit, and the workaround is to use the command: sudo apt-get install ia32-libs to install some 32-bit libraries
7, after installing the 32-bit library, then use the command: Arm-linux-gcc-v, this time succeeded, such as
8, verify, compile a hello.c file
Use the command: ARM-LINUX-GCC hello.c-o hello to see if the compilation was successful
It is visible that the binaries were generated successfully.
=======================================
Home:
http://kegel.com/crosstool/#download
http://www.kegel.com/crosstool/
Http://www.kegel.com/c10k.html
==================================================
Other information
Build a Linux development environment
http://wiki.emsym.com/wiki/%E6%90%AD%E5%BB%BALinux%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83
Build an arm Linux cross-compilation tool chain
Http://blog.sina.com.cn/s/blog_4a70d5d9010126si.html
Summary of methods for installing cross-compiler tool chains under Ubuntu
http://blog.csdn.net/yinjiabin/article/details/7369071
Cross-compilation in detail (version:
v1.2Bycrifan Li )
Http://www.crifan.com/files/doc/docbook/cross_compile/release/html/cross_compile.html