Configure cross-compilation and configure Compilation
Today, I made a mistake during cross-compilation and struggled for a long time. In the past, the prefixes of cross-compiler were basically arm-linux -, this time I changed the new environment to arm-none-linux-gnueabi-, so I set the host parameter in configure to -- host arm-linux, so I made some mistakes. Change it to -- host arm-none-linux-gnueabi. For details, see:
Http://blog.chinaunix.net/uid-24148050-id-2213969.html
"Generally, we only need to specify -- host.
Remember: -- The host specifies the prefix of the Cross-compilation toolchain"
Configure parameter settings in cross-Compilation
Use arc-elf-gcc-v
How to create a cross-compiling environment for arm-linux
The main reason for cross-compilation is that most embedded target systems cannot provide sufficient resources for the compilation process, so they have to transfer the compilation project to a high-performance host.
The cross-compiling environment in linux includes the following parts:
1. gcc compiler for the target system
2. binutils, a binary tool for the target system
3. Standard c library glibc of the target system
4. Linux kernel header file of the target system
Steps for creating a cross-compilation environment
1. Download source code including binutils, gcc, glibc, and Linux kernel source code (note that the glibc and kernel source code versions must be consistent with the actual version used on the target machine ), set the shell variable PREFIX to specify the installation path of the executable program.
2. Compile binutils to run the configure file, use the -- prefix = $ PREFIX parameter to specify the installation path, use the -- target = arm-linux parameter to specify the target machine type, and then execute make install.
3. Configure the Linux kernel header file
First, execute make mrproper to clean up, and then execute make config ARCH = arm (or make menuconfig/xconfig ARCH = arm) for configuration (note, you must use ARCH = arm to specify the cpu architecture in the command line, because the default architecture is the cpu architecture of the host). This step requires detailed configuration based on the actual situation of the target machine, in the experiment, the target machine is HP's ipaq-hp3630 PDA, so the system type is set to SA11X0, SA11X0 Implementations select Compaq iPAQ H3600/H3700.
After the configuration is complete, copy the kernel header file to the installation directory: cp-dR include/asm-arm $ PREFIX/arm-linux/include/asm cp-dR include/linux $ PREFIX/arm-linux/include/linux
4. The first gcc Compilation
Run the configure file, use the -- prefix = $ PREFIX parameter to specify the installation path, and use the -- target = arm-linux parameter to specify the target machine type, run the -- disable-threads, -- disable-shared, and -- enable-versions = c parameters, and then run make install. This step will generate the simplest gcc. Since compiling the entire gcc requires the glibc library of the target machine, it does not exist yet. Therefore, you must first generate the simplest gcc, it only needs to be able to compile the glibc library of the target machine.
5. Cross-compile glibc
The code generated in this step is for the cpu of the target machine, so it is a cross-compilation process. The linux kernel header file is used in this process. The default path is $ PREFIX/arm-linux/sys-linux. Therefore, you need to create a soft connection named sys-linux in $ PREFIX/arm-linux, make the include directory where the kernel header file is located. Alternatively, you can use the -- with-headers parameter in the configure command to specify the actual path of the Linux kernel header file.
The running parameters of configure are set as follows (for cross-compilation, set the compiler variable CC to arm-linux-gcc): CC = arm-linux-gcc. /configure -- prefix = $ PREFIX/arm-linux -- host = arm-linux -- enable-add-ons. Finally, execute configure and make... according to the preceding configuration ...... remaining full text>