uclinux交叉编译、调试工具

转载 2007年09月30日 20:19:00

Toolchain

From wikiPodLinux

To build binaries for the iPod you will need a special version of the GNU toolchain, where the compiler is configured as a cross compiler. This is used to generate binaries on your development machine which are executable on another platform, in this case the iPod. Since the iPod is an ARM based platform we need an ARM cross compiler. Fortunately there are pre-built versions of the cross compiler available for Linux, OS X, and Windows (via Cygwin). If you need to customize the toolchain, you'll have to build it yourself.

Table of contents [hide]

Installing a pre-built toolchain

There are two versions of the toolchain: 2.95 and 3.4.3. They contain different versions of the compiler (gcc). While the kernel needs to be built with 2.95, many other apps need to be built with the newer version.

Note about installing both toolchains

These two toolchains can coexist on the same system, but you may need to remove the compatibility symlinks from the newer toolchain once you have installed it (Note: this applies only to Linux systems - for Mac OS X see the note further down):

rm -f /usr/local/arm-uclinux-tools2/bin/arm-elf-*

If you do this, be sure you set the HOST appropriately for each toolchain you want to use: arm-elf for 2.95, and arm-uclinux-elf for 3.4.3.

For the kernel (2.95 toolchain)

The arm-elf 2.95 toolchain is not for applications. This toolchain has several problems, namely:

  • C++ support is passable at best.
  • No i18n support.
  • Cannot handle constructs like anonymous structures.

The new version, arm-uclinux-elf 3.4.3, fixes all these issues (and is much more modern). Unfortunately, the Linux 2.4 kernel source doesn't quite agree with 3.4.3 so you need to apply this patch (http://www.so2.sys-techs.com/ipod/linux/iPL_2.4.32-ipod2_arm-uclinux-elf.patch) to the kernel source before you compile the kernel for the iPod.

If you are using a pre-compiled kernel (e.g. from a nightly build), you can skip this section.

Linux on x86

Download:

http://www.uclinux.org/pub/uClinux/arm-elf-tools/arm-elf-tools-20030314.sh

Install the toolchain as root user:

sudo ./arm-elf-tools-20030314.sh

If you get the error message 'tail: cannot open `+43' for reading: No such file or directory' when installing, change line 39 from:

tail +${SKIP} ${SCRIPT} | gunzip | tar xvf -

to:

tail -n+${SKIP} ${SCRIPT} | gunzip | tar xvf -

Mac OS X on PPC

(Note: works only on PowerPC Macs, not on Intel Macs)

Download and run the installer:

http://prdownloads.sourceforge.net/ipodlinux/arm_elf_stl.pkg.tar?download

Note: If you should later install the 3.4.3 toolchain as well, the "arm-elf"-files in /usr/local/bin will get replaced with the new toolchain commands, meaning that you then cannot build the kernel with the 2.95 toolchain any more. While the 2.95 installer also creates its own private directory /usr/local/arm-elf/bin, it does miss out on placing a few needed files into that dir (e.g. objcopy is missing there). So I suggest you issue this command in Terminal after having used the above installer in order to preserve all tools of the 2.95 toolchain (this will then later allow you to refer to these copies to build the kernel):

cp /usr/local/bin/arm-elf-* /usr/local/arm-elf/bin

Cygwin on Windows on x86

Download the zip file:

http://prdownloads.sourceforge.net/ipodlinux/arm-elf-gcc.zip?download

It contains the entire folder hierarchy (/usr/local/...), so you need to extract this to your Cygwin root directory, making sure you do not replace the contents of existing directories but add the new files into them. Be advised that some people have reported instability in this toolchain.

See also: Using Cygwin

Other Systems

You must build the toolchain from source. See below for instructions.

For applications (3.4.3 toolchain)

For applications, you can use the more modern 3.4.3 arm-uclinux-elf toolchain; its advantages are above. If you are running a Linux or OS X system on x86 or PowerPC, then you can just download the toolchain in binary form. The x86 toolchain also works on AMD64 systems provided you have IA-32 compatibility libraries installed; this is the default on most AMD64 Linux distributions (on Gentoo, emerge emul-linux-x86-baselibs).

Note: you only need the first of the three files for a standard installation. The others are for development purposes.

The files you need are:

The toolchain is hardcoded to live in /usr/local/. You can extract it there by executing all three files as root:

# sh ./arm-uclinux-elf-tools-base-gcc3.4.3-20050722.sh
# sh ./arm-uclinux-elf-tools-c++-gcc3.4.3-20050722.sh
# sh ./arm-uclinux-elf-tools-gdb-20050722.sh

If you get an error like, tail: cannot open `+43' for reading: No such file or directory, you need to change the line from

tail +${SKIP} ${SCRIPT} | bunzip2 | tar xvf -

to

tail -n+${SKIP} ${SCRIPT} | bunzip2 | tar xvf -

With a command like

# nano --nonewlines --noconvert arm-uclinux-elf-tools-base-gcc3.4.3-20050722.sh

Or, you may corrupt the file.

For the Cygwin one, you should do

# tar -C / -xvjf arm-uclinux-tools-cygwin-20060116.tar.bz2

If you are getting file not found errors from the cygwain tar then try appending another .tar to the end of above. For example:

# tar -C / -xvjf arm-uclinux-tools-cygwin-20060116.tar.bz2.tar

Building your own toolchain

This is not recommended. It is far too easy to royally screw things up. Unless you have a really good reason not to, please stick with the prebuilt toolchains.
Also, these instructions are out of date - they're for 2.95.

Go to [1] (http://sourceforge.net/project/shownotes.php?release_id=226054). Go get the file build-uclinux-tools.sh (http://uclinux.org/pub/uClinux/arm-elf-tools/tools-20030314/build-uclinux-tools.sh)". This is a shell script which will do the build for you later, but it also contains notes about the prerequisites. Get all the files you need. You also need to get and configure the uClinux sources - see how to do that in Kernel Building. Follow all steps until the 'make' step, instead, do only a 'make dep'. You're done here.

When you have everything in place, edit build-uclinux-tools.sh (the 'edit' section). Put in the correct name for the uClinux source dir. If you want to install the toolchain in a different directory (e.g. /opt/arm-elf), put in a line like

PREFIX=/opt/arm-elf
PATH="${PREFIX}/bin:$PATH"; export PATH

Now you can run build-uclinux-tools.sh.

If the script complains that it can't write to $PREFIX, create $PREFIX manually.

mkdir /opt/arm-elf

If you get an error from patch saying some file is locked in Perforce, you should set an environ var 'POSIXLY_CORRECT' to work around that, or unset your P4PORT env.

export POSIXLY_CORRECT=1
OR
export P4PORT=

If you get an error from patch saying that it can't find the file gcc-uclinux-elf.mak, add a line

touch STLport-4.5.3/src/gcc-uclinux-elf.mak

before

${PATCH} -p0 < STLport-4.5.3.patch

Setup your build environment

Normally your cross compiler will be installed in /usr/local/arm-uclinux-tools2/bin so you need to include that in your PATH. (The OS X version installs in /usr/local/arm-uclinux-tools/bin, modify appropriately)

% export PATH=/usr/local/arm-uclinux-tools/bin:$PATH 

The Cygwin toolchain installs in /usr/local/arm-uclinux-elf-tools/bin instead, so your PATH-supplementing line should be something like

% export PATH=/usr/local/arm-uclinux-elf-tools/bin:$PATH 

Debian / Ubuntu issues

On Ubuntu Linux (and possibly other Debian-based systems), attempting to run these tools under sudo (for example, in 'make install' steps) will fail with 'command not found', even when the above directory is in your path. This is because Debian's sudo package is compiled with the --with-secure-path option, which causes it to use a hard-coded path instead of your actual one.

The only known 'proper' fix is to recompile your own copy of sudo. As a workaround, you can add symlinks to the arm-uclinux tools to /usr/local/bin with this command:

sudo ln -s /usr/local/arm-uclinux-tools2/bin/arm-uclinux-elf-* /usr/local/bin/

UcLinux 添加 自定义 应用程序 详细过程

  • 2010年08月11日 15:29
  • 14KB
  • 下载

uClinux的一些点

uClinux内核简介 uCLinux 是Linux 2.0核心的分支,是针对没有MMU管理单元的微控制器 继承了Linux的大多数特性 多数的Linux下应用程序和驱动程序都可以在...
  • shaoshaoh
  • shaoshaoh
  • 2008年01月23日 15:16
  • 1742

libmodbus的移植

libmodbus的移植的过程中,要注意几点: 第一,在交叉编译器是最好加上--prefix参数,叫相关的库直接集中起来,方便拷贝到开发板相应的目录中去; 嵌入式开发板:./configure --b...
  • sonbai
  • sonbai
  • 2014年07月10日 17:27
  • 8036

交叉编译详解 一 概念篇

本文总结了什么是交叉编译链,并介绍了交叉编译链的各个组成部分
  • pengfei240
  • pengfei240
  • 2016年10月25日 01:00
  • 10222

交叉编译知识解析(一) —— 交叉编译和交叉工具链

一、交叉编译简介 1、什么是交叉编译 1.1 本地编译         解释什么是交叉编译之前,先要明白一个概念:本地编译        我们之前常见的软件开发,都是属于本地编译:在当前的PC下,x8...
  • zqixiao_09
  • zqixiao_09
  • 2016年07月04日 19:22
  • 3305

uclinux交叉编译环境的建立

  • 2008年03月01日 21:56
  • 2.59MB
  • 下载

建立uClinux交叉编译环境 - [Blackfin]

原文地址::http://www.analogcn.com/Article/wz3/201003/20100325000101.html 我的说明:我是再  ubuntu 11.10 下安装...
  • jinn3
  • jinn3
  • 2012年04月01日 21:04
  • 1197

arm-linux-gnueabi-4.5.1.tar.bz2交叉编译工具

  • 2017年09月29日 21:10
  • 47B
  • 下载

交叉编译工具

  • 2012年09月23日 15:21
  • 1.75MB
  • 下载

嵌入式交叉编译工具链

  • 2010年08月09日 17:42
  • 45KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:uclinux交叉编译、调试工具
举报原因:
原因补充:

(最多只允许输入30个字)