1. Create a new folder under/usr/local: Arm
[[email protected] local] $sudo mkdir arm
2. Copy the cross-compilation tool to the Arm folder
[[email protected] arm] $sudo MV ~/downloads/arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2.
[[email protected] arm]$ ls
arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
3. Unzip
[email protected] arm]$ sudo tar-xjvf arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
[[email protected] arm]$ ls
arm-2011.03 arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
4. Add to PATH environment variable
[email protected] arm]$ sudo gedit ~/.BASHRC
At the end of the file, write the following:
Path= $PATH:/usr/local/arm/arm-2011.03/bin
5. Run the. bashrc file so that the settings take effect.
Go to the user home directory:
[[Email protected] arm]$ CD
Run:
[Email protected] ~]$. . BASHRC
6. Verify that the cross compiler is installed correctly
enter [[email protected] ~]$ arm-none-linux-gnueabi-, press 2 Tab key, if you can see many
arm-none-linux-gnueabi-the prefix command, you can basically determine the installation success.
Arm-none-linux-gnueabi-addr2line Arm-none-linux-gnueabi-gdbtui
Arm-none-linux-gnueabi-ar arm-none-linux-gnueabi-gprof
Arm-none-linux-gnueabi-as Arm-none-linux-gnueabi-ld
Arm-none-linux-gnueabi-c++ arm-none-linux-gnueabi-nm
Arm-none-linux-gnueabi-c++filt arm-none-linux-gnueabi-objcopy
Arm-none-linux-gnueabi-cpp Arm-none-linux-gnueabi-objdump
Arm-none-linux-gnueabi-elfedit Arm-none-linux-gnueabi-ranlib
arm-none-linux-gnueabi-g++ arm-none-linux-gnueabi-readelf
ARM-NONE-LINUX-GNUEABI-GCC arm-none-linux-gnueabi-size
arm-none-linux-gnueabi-gcc-4.5.2 Arm-none-linux-gnueabi-sprite
Arm-none-linux-gnueabi-gcov arm-none-linux-gnueabi-strings
Arm-none-linux-gnueabi-gdb Arm-none-linux-gnueabi-strip
7. Allow the 64-bit system to run and compile 32-bit programs.
[Email protected] ~]$ arm-none-linux-gnueabi-gcc-v
If this is not successful, you may need to install the 32-bit runtime.
http://blog.csdn.net/qq_15345805/article/details/70864136
Https://wiki.archlinux.org/index.php/Multilib
To edit the/etc/pacman.conf, uncomment the following:
[Multilib]
Include =/etc/pacman.d/mirrorlist
[email protected] ~]$ sudo nano/etc/pacman.conf
[sudo] password for Guo:
[Email protected] ~]$
Update the package list and upgrade the system
[email protected] ~]$ sudo pacman-syu
If it doesn't work, follow the 32-bit runtime with a command
[email protected] ~]$ sudo pacman-s lib32-glibc
8. Test tool Chain
To write the program file hello.c, enter the following:
#include <stdio.h>
int main ()
{
printf ("Hello world!\n");
return 0;
}
[Email protected] ~]$ cd/tmp
[Email protected] tmp]$ Nano hello.c
[email protected] tmp]$ cat hello.c
#include <stdio.h>
int main ()
{
printf ("Hello world!\n");
return 0;
}
[Email protected] tmp]$
compile with the following command, compile the executable file named Hello, and use the file command to view the types of files.
When the following information is displayed, the cross-tool chain is properly installed, and the executable file of the arm system is generated by compiling.
Note that executable files compiled from this cross-compilation chain can only be executed under the arm system and not on X86-based ordinary PCs.
[Email protected] tmp]$ ARM-NONE-LINUX-GNUEABI-GCC hello.c-o Hello
[[email protected] tmp]$ ls
fcitx-socket-:0 hello.c Sogou-qimpanel-cellguo
Hello Serverauth.xla5px22fa sogou-qimpanel:0.pid
[[Email protected] tmp]$ file Hello
Hello:elf 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter/lib/ld-linux.so.3, for GNU /linux 2.6.16, not stripped
For more detailed information, refer to the following blog:
Cross-compilation Toolchain (GCC) Build-write very good (two write very similar)
Http://blog.chinaunix.net/uid-7762106-id-146774.html
Http://blog.chinaunix.net/uid-8107907-id-2034159.html
Cross-compiling toolchain-mainly about
http://blog.csdn.net/qfnu08zzr/article/details/48264331
Cross-compiling
Https://www.crifan.com/files/doc/docbook/cross_compile/release/html/cross_compile.html
ArchLinux Installing the cross-compilation tool chain