1. Download the ARM-LINUX-GCC compiler.
2. Copy the downloaded compiler files to Linux, and be careful not to unzip them in Windows, as the RAR decompression tool extracts the files compressed by the GZIP compression tool may cause problems.
Try to put the compiler's compressed files into the root directory (in fact, not necessarily the root directory, but I use the process found that there is a manufacturer provided by the compiler is not installed in the specified location, the compiler prompts the library can not find), the purpose is to minimize the trouble. After copying well, use in the terminal:
# tar Xvzf arm-linux-gcc-4.4.3.tar.gz
Unzip the compiler.
3. Once the decompression is done, there is only one step left to modify the environment variables. Because although in the 2nd step we have already extracted the compiler, which means that some of the compiler's tools are already on our Linux, but the system does not know that the compiler already exists, and we use the compile command when the system does not know where to look for these compilation tools.
Modify the environment variable to modify 3 files:
(1) First in the terminal input
# CD
Go to the home directory of the current user and enter it in the terminal
# VI. BASHRC
Then add it at the end of the file: Export path= $PATH:/opt/toolschain/4.4.3/bin (where the path is the compiler's installation path), and then save after the modification.
In Terminal input:
# source. BASHRC//Let the modified environment variable take effect
# arm-linux-gcc-v//test output compiler version, if installed successfully, will output compiler version correctly
Note: the. bashrc-the individual Per-interactive-shell startup file. This document mainly stores personal personalization settings, such as command aliases, paths, and so on. That is, on the same server, it is only relevant to the personalization settings of a user. Linux is a multi-user operating system, each user's environment variables may be different (there is a public part, also has its own private part), modify this file, will only affect the current user's environment variables.
(2) Modify/etc/profile
# sudo vi/etc/profile
Then add it at the end of the file: Export path= $PATH:/opt/toolschain/4.4.3/bin, and save after modifying it.
# Source/etc/profile
# arm-linux-gcc-v
Note: The profile file under the ETC directory is the file that the operating system executes first when each user logs on, and then gives control to the. profile file in the user's home directory, and the user can start their own work once the system has given the main prompt ($PS 1). The entire process is transparent to the user.
(3) Modify/ETC/BASH.BASHRC
# sudo VI/ETC/BASH.BASHRC
Add the compiler path and save it.
# SOURCE/ETC/BASH.BASHRC
# arm-linux-gcc-v
Note: This file is also set to take effect globally.
Summary: In fact, I test to modify the current user's home directory under the. profile file can also be used to modify the environment variables. Because the/etc/profile file is scoped to all users, non-generic settings should be placed in the user's own. profile file. The original. Profile file is automatically generated for the user when the system administrator creates the user using the Sysadmsh command or the Mkdev User command, and the user can use VI to edit the file for their own use. The utility of the profile file does not disappear until the user exits the system. And when the user logs back in, it starts to work.