1. Download arm-linux-gcc-3.4.1.tar.bz2 to any directory.
ARM-LINUX-GCC-3.4.1.TAR.BZ2 is as follows:
http://www.handhelds.org/download/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2
2. Unzip the ARM-LINUX-GCC-3.4.1.TAR.BZ2
#tar-jxvfarm-linux-gcc-3.4.1.tar.bz2
Decompression process takes a period of time, the extracted files form the usr/local/folder, into the folder, the Arm folder copy to/usr/local/under the #说明此处如果文件放在/2410 under the decompression in/2410/usr/local
# CD usr/local/
#cp-RV arm/usr/local/
Now the cross-compiling assembly is under/usr/local/arm/3.4.1/bin.
3. Modify the environment variables to add the path of the cross-compiler to path. (There are three methods, it is strongly recommended to use method one)
Method One: Modify the/ETC/BASH.BASHRC file
#vim/ETC/BASH.BASHRC
At the end add:
Exportpath= $PATH:/usr/local/arm/3.4.1/bin
Export PATH
(If you cannot edit, first modify the permissions of the relevant file by using the chmod command.) )
Method Two: Modify the/etc/profile file:
# Vim/etc/profile
Add the path settings, at the end of the following, save the/etc/profile file:
Export path= $PATH:/usr/local/arm/3.4.1/bin
Method Three: #export path= $PATH:/usr/local/arm/3.4.1/bin
Note: (This is only valid under the current terminal!) )
4. Immediately make the new environment variable effective without restarting the computer:
Correspondence method One: #source/ROOT/.BASHRC
Correspondence method Two: # Source/etc/profile
5. Check if the path is joined to path:
#echo $PATH
There is a/usr/local/arm/bin in the display, indicating that the path of the cross compiler has been added to it. At this point, the cross-compilation environment is installed.
6. Test whether the installation is successful
# arm-linux-gcc-v
The above command displays ARM-LINUX-GCC information and version, which is the information I display:
Reading Specs From/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/specs
Configured With:/work/crosstool-0.27/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure--target= Arm-linux--host=i686-host_pc-linux-gnu
--prefix=/usr/local/arm/3.4.1--with-headers=/usr/local/arm/3.4.1/arm
-linux/include--with-local-prefix=/usr/local/arm/3.4.1/arm-linux--disable
-nls--enable-threads=posix--enable-symvers=gnu--enable-__cxa_atexit--enable-languages=c,c++--enable-shared-- Enable-c99--enable-long-long
Thread Model:posix
GCC version 3.4.1
7. Compile the Hello World program and test the cross tool chain
Write down the following Hello World program, Save as Hello.c
#include
int main ()
{
printf ("Hello world!\n");
return 0;
}
Execute the following command:
# Arm-linux-gcc-o Hello hello.c
The source program has the wrong words will be prompted, without any hint, it is through, you can download to the arm target board to run!
You can then enter the Filehello command to see the type of the generated hello file, noting that the resulting executable file can only be run under the arm system and not on its X86 pc.
Ubuntu under cross-compilation Environment Build (ARM-LINUX-GCC-3.4.1.TAR.BZ2) "Go"