Part I: Create your own version of the cross compiler for 2440

Source: Internet
Author: User
Tags emit

The first section installs the cross-compilation tool chain

Using the crosstool-0.43 to make cross-compilation toolchain, with the GCC version of the increase, the correct production is not likely, after the crosstool-0.43 system is no longer updated, so this is the use of nt-ng tools to create a cross-compilation tool chain.

1 , Nt-ng the installation

Crostool for many years is not maintenance, below try to use Crosstool Next generation Crosstool-ng specific instructions for use see:

Http://www.crifan.com/files/doc/docbook/crosstool_ng/release/html/crosstool_ng.html

The following is the process of compiling my compilation:

First download the source package: http://crosstool-ng.org/download/crosstool-ng/

Here I can be in the latest version: CROSSTOOL-NG-1.20.0.TAR.BZ2

Here is a bit different from the Crosstool, Crosstool-ng need to install first and then select the cross-compilation chain in the configuration.

First unzip the TAR–XVF crosstool-ng-1.20.0.tar.bz2

Enter its directory: CD crosstool-ng-1.20.0 create built folder which is the last cross-compilation chain of the output directory

Mkdir-p/work/tools/crosstool-ng-built

Run Config:

./configure--prefix=/work/tools/crosstool-ng-1.20.0

Appear:

Checking forabsolute path to readelf .../usr/bin/readelf

Checking forgperf ... no

Configure:error:missing Required Tool:gperf

Installation:sudo apt-get install gperf

But my Ubuntu system tips (some versions may not have this problem):

[Email protected]:~/mywork/files/crosstool-ng-1.20.0$sudo apt-get Install Gperf

Reading packagelists ... Done

Buildingdependency Tree

Reading stateinformation ... Done

The followingnew packages would be installed:

Gperf

0 upgraded, 1 newlyinstalled, 0 to remove and 1374 not upgraded.

E:could not Getlock/var/cache/apt/archives/lock-open (11:resource temporarily unavailable)

e:unable tolock the download directory

Fix it in the following way: http://blog.csdn.net/dengroj2009/article/details/4636456

sudo rm/var/cache/apt/archives/lock
sudo rm/var/lib/dpkg/lock

and continue configure.

Then you are prompted with an error:

Configure:error:missing Required Tool:bison

The solution is the same as the first time.

sudo apt-get install Bison

Then continue configure with prompt error:

Configure:error:missing Required Tool:flex

The solution is the same as the last, which tool is installed.

sudo apt-get install Flex

Then continue configure with prompt error:

Configure:error:missing Required Tool:makeinfo

The solution is the same as the last, which tool is installed.

sudo apt-get install Texinfo

Then continue configure with a hint error

Configure:error:could not find GNU awk

The solution is the same as the last, which tool is installed.

sudo apt-get install gawk

Then continue configure with a hint error

Checking for GNU libtool >= 1.5.26...no

Configure:error:could not find Gnulibtool >= 1.5.26

The solution is the same as the last, which tool is installed.

sudo apt-get install Libtool

Then continue configure with a hint error

Checking for GNU automake >= 1.10 ... No

Configure:error:could not find Gnuautomake >= 1.10

The solution is the same as the last, which tool is installed.

sudo apt-get installautomake

Then continue configure with a hint error

Configure:error:could not find curses headers, required for Thekconfig frontends

The solution is the same as the last, which tool is installed.

sudo apt-getinstall libncurses5-dev

Then continue with config:./configure–prefix=/work/tools/crosstool-ng-1.20.0

If you are still prompted for a similar problem, install the tool directly

Final Build Makefile Tool

Then: make and then: MakeInstall

2 , cross-compilation tool chain installation

Then refer to the blog: http://www.cnblogs.com/leaven/archive/2010/10/12/1848439.html

Finally, the bin/in the installation directory will be generated Ct-ng

Then set the environment variable/work/tools/crosstool-ng-1.20.0 or soft connection:

sudo ln-s/work/tools/crosstool-ng-1.20.0/bin/ct-ng/usr/local/bin/ct-ng

Then Ct-ng help can see the version information.

Then Ct-ng list samples to see the basic information.

Then go to the lib/samples/of the installation directory

Cd/work/tools/crosstool-ng-1.20.0/lib/ct-ng.1.20.0/samples

See:


Arm-unknown-eabi is based on bare-board running, that is, no operating system

Arm-unknown-linux-gnueabi is a Linux-based

Arm-unknown-linux-uclibcgnueabi this should be able to see, is for the uclinux use.

Arm-cortex_a8-linux-gnueabi is used for cortex-a8 from the name. and m3,a10, and so on.

Choose Arm-unknown-linux-gnueabi Here

Copy the Arm-unknown-linux-gnueabi to/work/tools/crosstool-ng-built below (no new one can be created)

mkdir /work/tools/crosstool-ng-built/

CP arm-unknown-linux-gnueabi/*/work/tools/crosstool-ng-built/

if it is A8 need to copy Arm-cortex_a8-linux-gnueabi

And then you'll get Crosstool.config reported.by in/work/tools/crosstool-ng-built/.

Now change crosstool.config to. config

cd/work/tools/crosstool-ng-built/

mv Crosstool.config. config note. config is a hidden file if viewing requires Ls–a

Then execute it under the/work/tools/crosstool-ng-built/directory

ct-ng menuconfig(must be executed in this directory)

Then in:

Paths and Miscoptions--->
(${HOME}/DEVELOPMENT/CROSSTOOL-NG/SRC) Local tarballs directory Save Source package path
(${home}/development/x-tools/${ct_target}) prefixdirectory cross-Compiler installation path
These two should be modified according to your actual situation, or you can use the default without modification . Here we modify the installation path

Set here:


Target options This is where the focus is to be modified. (The following configuration is based on the configuration that was copied.)

Target Architecture (ARM) This is not a tube, is already arm.

Default instruction Set mode (ARM) This also does not matter, also already is arm.

(Refer to http://blog.chinaunix.net/u1/34474/showart_2198589.html)

Target Options---> can be seen from BLOCK DIAGRAM in datasheet

(armv4t) Architecture level

(ARM9TDMI) Emit Assembly FORCPU

(arm920t) Tune for CPU

(The new version may not be the same, you may only need to fill out the (arm920t) Tune for CPU.)

Here is an explanation of the above three nouns:

(armv4t) : Architecture level () this to change ~ ~

By looking up the data, this should be the instruction set of the schema, for s3c2410/s3c2440, is the core of arm920t, the architecture directive is armv4t, so if you want to compile 2410/2440, choose ARMV4T

And so on

(ARM9TDMI) : The S3c6410arm1176jzf-s core uses the ARMV6 architecture, just choose ARMV6

So, which architectures do you support specifically? You can use man gcc to query, search arm, and then search-march= to find the list of processor cores supported by this GCC:

          -march=name
            This specifies thename of the target ARM architecture.  GCC uses
  & nbsp;        This name todetermine what kind of instructions it can emit when
  ;          generatingassembly code.  This option can is used in Conjunction
           with or instead ofthe-mcpu= option.   Permissible names is:
           armv2, Armv2a,armv3, ARMV3M, Armv4, armv4t, ARMV5, armv5t, armv5e,
           ARMv5TE, armv6,armv6j, Armv6t2, armv6z, Armv6zk, Armv6-m, armv7,
            armv7-a, Armv7-r,armv7-m, Iwmmxt, Iwmmxt2, ep9312.

Here are some problems, such as the s3c2416 processor, using the Arm926ej-s core, through the manual, Arm926ej-s core is Armv5tej, but the above list does not have such a core. So, here's a selection of the closest core ARMv5TE

Emitassembly for CPU () this should be changed ~ ~ This corresponds to the core type of CPU.

(arm920t) : again, as with the options above, a GCC option is appropriate. This is described in GCC

-mcpu=name
This specifies thename of the target ARM processor. GCC uses this
Name to Determinewhat kind of instructions it can emit when
generatingassembly code. Permissible names Are:arm2, arm250,
ARM3, ARM6, arm60,arm600, arm610, arm620, ARM7, arm7m, arm7d,
ARM7DM, Arm7di,arm7dmi, Arm70, arm700, arm700i, arm710, arm710c,
arm7100, arm720,arm7500, Arm7500fe, Arm7tdmi, Arm7tdmi-s, arm710t,
arm720t, Arm740t,strongarm, strongarm110, strongarm1100,
STRONGARM1110,ARM8, arm810, ARM9, arm9e, arm920, arm920t, arm922t,
Arm946e-s,arm966e-s, Arm968e-s, Arm926ej-s, arm940t, ARM9TDMI,
arm10tdmi,arm1020t, Arm1026ej-s, arm10e, arm1020e, arm1022e,
Arm1136j-s,arm1136jf-s, MPCore, MPCORENOVFP, Arm1156t2-s,
Arm1176jz-s,arm1176jzf-s, Cortex-a8, cortex-a9, CORTEX-R4,
CORTEX-R4F,CORTEX-M3, CORTEX-M1, XScale, Iwmmxt, Iwmmxt2, ep9312.

This is easier to see if it is s3c2410/s3c2440 to choose arm920t if it is s3c6410 to choose Arm1176jzf-s if it is s3c2416, choose Arm926ej-s

The next step is:

floating point () float-related options s3c2410/s3c2440 have no hardware floating point, so here's the software FPU

s3c6410 has hardware VFP, so the hardware FPU is chosen here.

In order to increase the number of parallel processes at compile time, to increase the efficiency and speed up the compilation.
Paths and Misc Options--->
Build Behavior * * *
(8) number of parallel jobs //Multi-threaded compilation saves time by twice times the CPU core.
This value should not be too large, should be twice times the number of CPUs. Since my CPU is 4 cores, I have filled in 8.

Some personalized changes (can not be modified)
Toolchain Options--->
Tuple Completion and aliasing * * *
(Jason) Tuple ' s vendorstring
The resulting compiler prefix is: arm-jason-linux-gnueabi-

(arm-linux) Tuple ' s alias //Here is an individual name for the generated cross-compiler tool, set an alias, which will create a soft link for each tool, such as:

ARM-LINUX-GCC Link to ARM-UNKNOWN-LINUX-GNUEABI-GCC

This eliminates the steps behind creating a soft connection.

Here are the versions that select several libraries, with the kernel version for linxu3.14:

in the Operation System à

in the Linux kernel version Select 4.14.xx

in the C Compiler à

GCC version

GCC The version selected corresponds to the 4.9.xx

You will also need to select the appropriate version of the operating system--> in the. (can also be modified manually in. config)
Configure to save later. The kernel version I chose here is 3.14.28GLIBC, which is 2.18.

GLIBC is 2.18 http://ftp.gnu.org/gnu/glibc/

Binutils is 2.22 http://ftp.gnu.org/gnu/binutils/

gcc4.9.1 HTTP://FTP.GNU.ORG/GNU/GCC/GCC-4.9.1/

gdb7.8 http://ftp.gnu.org/gnu/gdb/

mpc1.0.2 http://ftp.gnu.org/gnu/mpc/

gmp5.1.3 http://ftp.gnu.org/gnu/gmp/

mpfr3.1.2 http://ftp.gnu.org/gnu/mpfr/

dmalloc5.5.2 http://fossies.org/linux/misc/dmalloc-5.5.2.tgz/

Strace http://sourceforge.net/projects/strace/files/strace/if it is. xz format first extracted into. Tar

As for which packages you need to see. config the rest is willing to download download not willing to download let him download it himself

Then in the/work/tools/crosstool-ng-built/. config see the basic configuration inside, such as the selection of the kernel and so on.

Note: When executing the ct-ng. Config content will change.

Last ct-ng build

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 And then there's a long wait

An error occurred:

[ERROR] Missing: ' i686-pc-linux-gnu-g++ ' or ' i686-pc-linux-gnu-g++ ' or ' g++ ': either needed!

[ERROR]

[ERROR] >>

[ERROR] >> Build failed in step ' (top-level) '

[ERROR] >>

[ERROR] >> error happened in:ct_abort[scripts/[email protected]

[ERROR] >> called From:ct_testandabort[scripts/[email protected]

[ERROR] >> called From:main[scripts/[email protected]

[ERROR] >>

[ERROR] >> for more info on this ERROR, look at the file: ' Build.log '

[ERROR] >> There is a list of known issues, some with workarounds, in:

[ERROR] >> '/work/tools/ct-ng/share/doc/crosstool-ng/ct-ng.1.20.0/b-Knownissues.txt '

[ERROR]

[ERROR] (elapsed:0:03.31)

[00:05]/make:*** [build] Error 1

This is due to the fact that Ubuntu GCC is not loaded with g++, just install g++ here:

sudo apt-get install g++

[INFO] =================================================================

[INFO] Installing pass-1 core C Compiler

[EXTRA] Configuring GCC

[EXTRA] Building GCC

[ERROR] make[1]: * * [CONFIGURE-GCC] ERROR 1

[ERROR]

[ERROR] >>

[ERROR] >> Build failed in step ' installing pass-1 core C compiler '

[ERROR] >> called in step ' (top-level) '

[ERROR] >>

[ERROR] >> error happened in:ct_doexeclog[scripts/[email protected]

[ERROR] >> called From:do_cc_core_backend[scripts/build/cc/[email protected]

[ERROR] >> called From:do_cc_core_pass_1[scripts/build/cc/[email protected]

[ERROR] >> called From:main[scripts/[email protected]

[ERROR] >>

[ERROR] >> for more info on this ERROR, look at the file: ' Build.log '

[ERROR] >> There is a list of known issues, some with workarounds, in:

[ERROR] >> '/work/tools/crosstool-ng-1.20.0/share/doc/crosstool-ng/ct-ng.1.20.0/b-known issues.txt '

[ERROR]

[ERROR] (elapsed:28:53.93)

[28:56]/make:*** [build] Error 2 reason: Seems to be the cloog aspect of the previous GCC bug

Workaround:

Finally, you can avoid this problem by using GCC 4.6.0, which compiles properly.

Download gcc4.6.0 http://ftp.gnu.org/gnu/gcc/gcc-4.6.0/

[INFO] =================================================================

[INFO] Installing CROSS-GDB

[EXTRA] Configuring CROSS-GDB

[EXTRA] Building Cross-gdb

[ERROR] Configure:error:expat is missing orunusable

[ERROR] make[2]: * * [CONFIGURE-GDB] ERROR 1

[ERROR] make[1]: * * [ALL] ERROR 2

[ERROR]

[ERROR] >>

[ERROR] >> Build failed in step ' installing Cross-gdb '

[ERROR] >> called in step ' (top-level) '

[ERROR] >>

[ERROR] >> error happened in:ct_doexeclog[scripts/[email protected]

[ERROR] >> called From:do_debug_gdb_build[scripts/build/debug/[email protected]

[ERROR] >> called From:do_debug[scripts/build/[email protected]

[ERROR] >> called From:main[scripts/[email protected]

[ERROR] >>

[ERROR] >> for more info on this ERROR, look at the file: ' Build.log '

[ERROR] >> There is a list of known issues, some with workarounds, in:

[ERROR] >> '/work/tools/crosstool-ng-1.20.0/share/doc/crosstool-ng/ct-ng.1.20.0/b-known issues.txt '

[ERROR]

[ERROR] (elapsed:95:29.57)

[95:30]/make:*** [Build] Error 2

Install sudo apt-get install Libexpat1-dev here

About one hours. Finally, you can use the tree to view its directory structure.

Here is a description, just at the beginning I use the virtual machine compiled but once installed to a program is a virtual machine will be wrong, not Ubuntu error, is a vmware error. Finally the Ubuntu system installed on the non-virtual machine was successful.

All the tools are in the/work/tools/ct-ng-2440/bin directory. Next, set the environment variable

Export path= $PATH:/work/tools/ct-ng-2440/bin

To prevent each restart of the system from being set, modify the value of path in sudo vi/etc/environment

Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/work/tools /crosstool/bin "

Then run the ./etc/environment to make the environment variable active (there is a space behind the dot)

Part I: Create your own version of the cross compiler for 2440

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.