该文章参考雪松的相关文章改编(http://blog.csdn.net/coolbacon/article/details/6090961)。
1.从该网站(http://www.rtems.com/ftp/pub/rtems/linux/)下载对应版本对应linux版本的工具链rpm文件(这里使用的rtems版本为4.9.4);各工具链文件如下所示:
2.使用rpm -i *.rpm安装上面的工具链即可(注意:上面文件之间有依赖关系,注意安装顺序),安装过程中有警告,忽略即可,若上面文件的依赖文件没有在这些文件中,用yum install *安装即可;
3.这些工具链会被安装在/opt/rtems-4.9/目录中,如下图所示:
4.声明工具链环境变量的位置,使用vi /etc/bashrc或者vi ~/.bashrc打开相应的文件,在文件的末尾加上下面命令保存即可:
export PATH=$PATH:/opt/rtems-4.9/bin
5.从该网站(http://www.rtems.com/ftp/pub/rtems/4.9.4/)下载rtems4.9.4的源码rtems-4.9.4.tar.bz2(这里默认下载到/home/RTEMS/下载/目录中);
6.将rtems源码复制到自己存放的位置,并解压:
cp /home/RTEMS/下载/rtems-4.9.4.tar.bz2 /home/rtems
tar jxvf rtems-4.9.4.tar.bz2
7.进入rtems源码目录并进行相关编译,以2410为例:
mkdir BuildRTEMS-2410
cd BuildRTEMS-2410
../rtems-4.9.4/configure --target=arm-rtems4.9 --disable-posix --enable-networking --enable-cxx --enable-rtemsbsp=smdk2410 --prefix=/opt/rtems-4.9
如果上面命令执行完成后出现以下错误:
../rtems-4.9.4/configure --target=arm-rtems4.9 --disable-posix --enable-networking --enable-cxx --enable-rtemsbsp=smdk2410 --prefix=/opt/rtems-4.9
checking for gmake... gmake
checking for RTEMS Version... 4.9.4
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... arm-unknown-rtems4.9
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether gmake sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
configure: configuring in ./tools/build
configure: running /bin/sh '../../../tools/build/configure' '--prefix=/opt/rtems-4.9' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--disable-posix' '--enable-networking' '--enable-cxx' '--enable-rtemsbsp=smdk2410' '--target=arm-rtems4.9' '--cache-file=/dev/null' '--srcdir=../../../tools/build'
checking for gmake... gmake
checking for RTEMS Version... 4.9.4
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether gmake sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for i686-pc-linux-gnu-gcc... no
checking for gcc... no
checking for i686-pc-linux-gnu-cc... no
checking for cc... no
checking for i686-pc-linux-gnu-cl.exe... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure: error: /bin/sh '../../../tools/build/configure' failed for tools/build
则可以通过安装gcc解决:yum install gcc
最后执行make all install
若没有错误出现,则说明工具链安装成功!