本文目标:
1.在VMware内的Fedoar13系统上搭建RTEMS交叉编译环境。版本为4.9.4,Target为i386
2.编译Hello world
3.使用GRUB将Hello world制作成启动光盘
4.在VMware内运行Hello world
正文:
1.从下面这个地址下载rpm包
http://www.rtems.org/ftp/pub/rtems/linux/4.9/fedora/13/i386/rtems-4.9-yum-conf-0.21-1.el5.noarch.rpm
2.安装
rpm -ivh --nodeps rtems-4.9-yum-conf-0.21-1.el5.noarch.rpm
3.下载 http://www.rtems.org/ftp/pub/rtems/linux/gpg-pubkey-69ce4a83-44cc2b30
4. rpm --import gpg-pubkey-69ce4a83-44cc2b30
5. yum search rtems
6. yum install rtems-4.9-auto*
yum install rtems-4.9-i386-*
7.如果一切顺利,将建立 /opt/rtems4.9 目录,rtems交叉编译工具链均在该目录下
8.下载 rtems4.9.4源码及例子
http://www.rtems.org/ftp/pub/rtems/4.9.4/rtemsdocs-4.9.4.tar.bz2
http://www.rtems.org/ftp/pub/rtems/4.9.4/examples-4.9.4.tar.bz2
9. export PATH=/c/opt/rtems-4.9/bin:${PATH}
10. 编译RTEMS
cd /usr/local/src/rtems
tar -xvjf ../rtems-4.9.0.tar.bz2
mkdir i386_install
mkdir i386_build
cd i386_build
../rtems-4.9.4/configure --target=i386-rtems4.9 --enable-rtemsbsp=pc686 --enable-cxx --enable-rdbg --prefix=/usr/local/src/rtems/i386_install
make all install
11.编译RTEMS例子
tar -xvjf examples-4.9.4.tar.bz2
mkdir -p hello cdrom
cp examples-4.9.4/hello_world_c/test.c examples-4.9.4/hello_world_c/Makefile hello
exports RTEMS_MAKEFILE_PATH= /usr/local /src/ rtems/i386_install/i386-rtems4.9/pc686
cd hello
make
12.制作 hello world启动光盘
mkdir cdrom/opt
mkdir -p cdrom/boot/grup
cp hello/o-optimize/hello.exe cdrom/opt
编辑 grub.cfg 内容如下
# RTEMS Grubs Configuration for the Sample Tests
set default=12
menuentry "RTEMS - Hello" {
multiboot /opt/hello.exe
}
cp grup.cfg cdrom/boot/grub
yum -install grub2
ln -s grub2-mkisofs /usr/bin/grub-mkisofs
ln -s grub2-mkimage /usr/bin/grub-mkimage
grub2-mkrescue cdrom --output=hello.iso
13.使用VMware新建虚拟机,operation system为other,version为other
14.使用hello.iso启动新建的虚拟机,可得到如下运行结果
hello world运行结果