Build omap3530 development environment under Fedora13-Cross Compiler

Source: Internet
Author: User
Preparation: assuming that the working directory is under the $ HOME/devel directory, the crosstool-ng under it is used to extract and compile crosstool-ng, And the cortex-a8 is used to generate the target toolchain. The generated tool chain is stored in the $ HOME/x-tools directory. In Fedora11/12, it is relatively easy to use crosstool-ng to establish a tool chain, but it is a lot of trouble to use fedora13. First, when downloading the tool curl to download files

Preparations:

Assume that the working directory is under the $ HOME/devel directory, and

Crosstool-ng is used to extract and compile crosstool-ng,

The cortex-a8 is used to generate the target toolchain.

The generated tool chain is stored in the $ HOME/x-tools directory.

In Fedora 11/12, it is relatively easy to use crosstool-ng to establish a tool chain, but it is a lot of trouble to use fedora13. First of all, when downloading the tool curl to download the file, it is always unknown that the download is complete, we recommend that you first download the components required by crosstool-ng and put them in the target/tarbils directory of the target directory before compiling.

1. download the latest generation tool from the official crosstool-ng website. The latest version is 1.7.1.

Http://ymorin.is-a-geek.org/projects/crosstool

Decompress the package to the specified directory.

$ Cd $ HOME/devel

$ Tar-jvxf crosstool-ng-1.7.1.tar.bz2

$ Crosstool-ng-1.7.1 cd

$./Configure-local

$ Make

Create a directory cortex-a8 to generate the target system.

$ Cd $ HOME/devel

$ Mkdir cortex-a8

$ Cortex-a8 cd

$ Cp ../crosstool-ng-1.7.1/samples/arm-cortex_a8-linux-gnueabi/crosstool. config. config

$ ../Crosstool-ng-1.7.1/ct-ng menuconfig

Select "C-library/extra target CFLAGS" and enter-U_FORTIFY_SOURCE.

Note: If you do not define this macro, you can use the tool chain compilation function. www.linuxidc.com can also use the tool chain to compile u-boot and Linux kernel, but the printf in glibc is faulty, as a result, the application that uses the printf series functions produces a segment error, that is, busybox is abnormal and cannot even access the command line.

Remove the Native GDB option at the same time. Native GDB is a Native GDB running on the target board, that is, debugging programs directly on the target board, but it is not available now. Remove this option to avoid compilation errors.

Start Compilation

$ ../Crosstool-ng-1.7.1/ct-ng build.2

Build.2 indicates that two parallel compilation tasks run simultaneously. Generally, several tasks are determined based on the number of CPU cores.

The following error occurs when compiling to ClooG/ppl:

[ALL]/usr/bin/ld:/home/xhs/devel/crosstool-ng/cortex-a8/targets/arm-cortex_a8-linux-gnueabi/build/static/lib/libppl. a (MIP_Problem.o): undefined reference to symbol 'sqrt @ GLIBC_2.0'

[ALL]/usr/bin/ld: note: 'sqrt @ GLIBC_2.0 'is defined in DSO/lib/libm. so.6 so try adding it to the linker command line

[ALL]/lib/libm. so.6: cocould not read symbols: Invalid operation

[ALL] collect2: ld returned 1 exit status

This problem does not occur during Fedora12. It is obvious that the error message is due to the lack of the sqrt symbol during the link. It is known that this function is in the math library, therefore, you must specify the-lm parameter during the link. You can solve this problem in two ways,

1. Modify Makefile. am Of The cloog-ppl project to add AM_LDFLAGS =-lm, and regenerate the project file through autoreconf. It is troublesome.

2, the simpler way is to modify the crosstool-ng compilation script, find the crosstool-ng-1.7.1/scripts/build/companion_libs/cloog. sh locate the row cloog_LDFLAGS = '-lstdc ++' and change it to cloog_LDFLAGS = '-lstdc ++-lm'

Recompile, cloog-ppl compiled through, but encountered the same problem when compiling gcc-core and gcc-final, find crosstool-ng-1.7.1/scripts/build/cc/gcc. sh, find core_LDFLAGS = '-lstdc ++' and final_LDFLAGS = '-lstdc ++', and add the-lm parameter.

Recompile and pass. If the generated toolchain does not change the path, it should be stored in the $ HOME/x-tools directory and packaged into a compressed file to back up the labor results

$ Cd

$ Tar-jvcf arm-cortex_a8-gcc.tar.bz2 x-tools/

Attached crosstool-ng-1.7.1 patch:

  1. Diff-uNr crosstool-ng-1.7.1/scripts/build/cc/gcc. sh crosstool-ng-1.7.1.modified/scripts/build/cc/gcc. sh
  2. --- Crosstool-ng-1.7.1/scripts/build/cc/gcc. sh 2010-06-28 00:38:14. 000000000 + 0800
  3. ++ Crosstool-ng-1.7.1.modified/scripts/build/cc/gcc. sh 2010-07-13 00:07:32. 299329759 + 0800
  4. @-155, 7 + 155, 7 @@ 
  5. # The libstdc ++ is not pulled automatically, although it 
  6. # Is needed. Shoe-horn it in our LDFLAGS
  7. If["$ {CT_COMPLIBS_SHARED }"! ="Y"]; Then
  8. -Core_LDFLAGS ='-Lstdc ++'
  9. + Core_LDFLAGS ='-Lstdc ++-lm'
  10. Fi
  11. If["$ {CT_CC_GCC_USE_GMP_MPFR }"="Y"]; Then
  12. Extra_config + = ("-- With-gmp =$ {CT_COMPLIBS_DIR }")
  13. @-330,7 + 330,7 @@ 
  14. # The libstdc ++ is not pulled automatically, although it 
  15. # Is needed. Shoe-horn it in our LDFLAGS
  16. If["$ {CT_COMPLIBS_SHARED }"! ="Y"]; Then
  17. -Final_LDFLAGS ='-Lstdc ++'
  18. + Final_LDFLAGS ='-Lstdc ++-lm'
  19. Fi
  20. If["$ {CT_CC_GCC_USE_GMP_MPFR }"="Y"]; Then
  21. Extra_config + = ("-- With-gmp =$ {CT_COMPLIBS_DIR }")
  22. Diff-uNr crosstool-ng-1.7.1/scripts/build/companion_libs/cloog. sh crosstool-ng-1.7.1.modified/scripts/build/companion_libs/cloog. sh
  23. --- Crosstool-ng-1.7.1/scripts/build/companion_libs/cloog. sh 2010-06-28 00:38:14. 000000000 + 0800
  24. ++ Crosstool-ng-1.7.1.modified/scripts/build/companion_libs/cloog. sh 2010-07-12 23:41:20. 722454427 + 0800
  25. -56,7 + 56,7 @@
  26. Cloog_opts + = (-- enable-shared -- disable-Static)
  27. Else
  28. Cloog_opts + = (-- disable-shared -- enable-Static)
  29. -Cloog_LDFLAGS ='-Lstdc ++'
  30. + Cloog_LDFLAGS ='-Lstdc ++-lm'
  31. Fi
  32. CFLAGS ="$ {CT_CFLAGS_FOR_HOST }"

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.