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


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



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 -


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:


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:


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 -


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

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 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


${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/


编译成功大约1个多小时就OK了,但之前也是做了大量的工作来为交叉编译做基础奠定。嗯,开始真的是没有头绪,不知道如何下手了。但经过慢慢来看,来理解之后做起来就方便不上。废话不说~上茶。 准备文件:...
  • bytxl
  • bytxl
  • 2014年10月10日 10:24
  • 858


环境:ubuntu10.10 版本:opencapwap0.93.3 下载源码后直接make报错 gcc: ./static/libssl.a: 没有那个文件或目录 gcc: ./static/lib...
  • laifu_ma
  • laifu_ma
  • 2013年04月19日 13:47
  • 2270


 Use gdbserver and gdb - remote debugging   target端要build gdbserver,host端要有cross version 的gdb,我用a...
  • terence427
  • terence427
  • 2007年09月30日 20:37
  • 1993


 在http://www.uclinux.org/pub/uClinux/arm-elf-tools/ 下载arm-elf-tools-20030314.sh在http://www.uclinux.o...
  • aaaaatiger
  • aaaaatiger
  • 2007年05月10日 23:46
  • 1561

ubuntu 步步为营之uclinux编译和移植(完整版)

本节主要包括(ubuntu10.04) 一,linux下的常用压缩解压缩命令 二,环境建立 三,内核编译 四,移植 一,linux下的常用压缩解压缩命令 在linux下常见...
  • liang890319
  • liang890319
  • 2011年10月05日 10:45
  • 5641

交叉编译: --host --build --target到底什么意思?

老是在做交叉编译,其实有时候对这三个东西的理解并不是那么清楚   从交叉工具链的情况来看,可以总结如下 --build= 谁在这里编译? 意思说你目前的编译动作在哪里跑的 ? 如果是...
  • bytxl
  • bytxl
  • 2015年01月23日 18:20
  • 687


  • elijah5748
  • elijah5748
  • 2008年03月18日 20:35
  • 778


  • hitlerisyou
  • hitlerisyou
  • 2007年12月20日 18:12
  • 3299


2007-12-25 09:43:01 摘要: 结合开发基于Motorola M68VZ328 微处理器的嵌入式系统的实际经验,较为详细地探讨了uCLinux 的特点及通过一个实例...
  • mybirdsky
  • mybirdsky
  • 2008年01月21日 16:39
  • 298


(太原理工大学 计算机与软件学院 中国 太原030024)摘要:建立在uClinux-2.4.x及兼容三星SNDS100实验板基础之上,对嵌入式操作系统的源代码文件的作用及目录构成进行了分析,并深入分...
  • TrueLie
  • TrueLie
  • 2007年01月20日 13:33
  • 3563