rtems官网上最新发布的代码是6.1-rc4,相对于老版本,做了较大的改动, 文件目录组织方式,尤其是编译系统,移除了autoconf/automake,使用waf python脚本编译,当前使用python脚本配置编译,已称为主流,例如yacto、openbmc等,都是基于python开发的编译配置系统
rtems-6.1-rc4编译工具链编译方式与老版本类似,rtems-source-builder下载编译相关工具链等
解压到如下目录中,
/root/rtems-source-builder-6.1-rc4
新建patches sources目录,结构如下
├── bare
│ └── config
├── CODEOWNERS
├── LICENSE.md
├── README.md
├── rtems
│ ├── build
│ ├── config
│ ├── patches
│ └── sources
├── source-builder
└── VERSION
将Index of /pub/rtems/releases/6/rc/6.1-rc4/sources下载的.diff patch等文件复制到patches目录,其他 .tar.gz .tar.xz等放到sources目录下
运行如下命令,编译生成386平台的工具链
../source-builder/sb-set-builder --prefix=$HOME/development/rtems/6.1-rc4 6/rtems-i386 --no-download --rtems-bsp --keep-going
注意,上文中我们已经下载了编译需要的相关文件,所以这个地方选择不下载参数,如果有报错也继续编译
过程中遇到如下报错
config.status: linking mpn/x86_64/k8/gmp-mparam.h to gmp-mparam.h
config.status: executing libtool commands
configure: summary of build options:
Version: GNU MP 6.3.0
Host type: x86_64-pc-linux-gnu
ABI: 64
Install prefix: /root/rtems-source-builder-6.1-rc4/rtems/build/tmp/sb-0-internal
Compiler: gcc -O2 -g -pipe -I/root/rtems-source-builder-6.1-rc4/rtems/build/tmp/sb-0/devel/gmp-internal/root/development/rtems/6.1-rc4/include -I/root/rtems-source-builder-6.1-rc4/rtems/build/tmp/sb-0-internal/include -std=gnu99
Static libraries: yes
Shared libraries: no
gcc -O2 -g -pipe -I/root/rtems-source-builder-6.1-rc4/rtems/build/tmp/sb-0/devel/gmp-internal/root/development/rtems/6.1-rc4/include -I/root/rtems-source-builder-6.1-rc4/rtems/build/tmp/sb-0-internal/include `test -f 'gen-psqr.c' || echo './'`gen-psqr.c -o gen-psqr -lm
gen-sieve.c: In function 'setmask':
gen-sieve.c:99:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (unsigned i = 0; i < 2 * a * b; ++i)
^
gen-sieve.c:99:3: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [gen-sieve] Error 1
make: *** Waiting for unfinished jobs....
shell cmd failed: /bin/sh -ex /root/rtems-source-builder-6.1-rc4/rtems