eCos安装

eCos是可配置嵌入式操作系统,比Linux稍小,又很好地支持Linux的系统调用接口。其源代码大多是用C++编写。


安装与配置

进入到eCos的官网下载页面:http://ecos.sourceware.org/getstart.html

新建一个目录并进入。


$ mkdir -p Workspace/ecos
$ cd Workspace/ecos

安网页上的指引,执行wget命令


$ wget --passive-ftp ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl

运行 sh ecos-install.tcl 


$ sh ecos-install.tcl 
eCos installer v2.0.1 starting...
Written and maintained by Jonathan Larmour <jifl@eCosCentric.com>
 
Retrieving installer metadata information...
Connected... 
Downloading ecos-install.db... 
File size 6572 bytes
[**************************************************]
---------------------------------------------------------
Available distribution sites:
 
[1]    ftp://mirrors.kernel.org/sources.redhat.com/ecos
[2]    http://mirrors.kernel.org/sources.redhat.com/ecos
[3]    ftp://mirror.aarnet.edu.au/pub/sourceware/ecos
[4]    http://mirror.aarnet.edu.au/pub/sourceware/ecos
[5]    ftp://ftp.mirrorservice.org/sites/sources.redhat.com/pub/ecos
[6]    http://www.mirrorservice.org/sites/sources.redhat.com/pub/ecos
[7]    ftp://gd.tuwien.ac.at/opsys/ecos
[8]    http://gd.tuwien.ac.at/opsys/ecos
[9]    ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/ecos
[10]    ftp://ftp.gwdg.de/pub/misc/sources.redhat.com/ecos
[11]    http://ftp.gwdg.de/pub/misc/sources.redhat.com/ecos
[12]    ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/sources.redhat.com/ecos
[13]    http://ftp-stud.fht-esslingen.de/pub/Mirrors/sources.redhat.com/ecos
[14]    ftp://bo.mirror.garr.it/mirrors/sourceware.org/ecos
[15]    http://bo.mirror.garr.it/mirrors/sourceware.org/ecos
[16]    ftp://ftp.u-aizu.ac.jp/pub/gnu/cygnus/ecos
[17]    ftp://ftp.sun.ac.za/pub/mirrorsites/sourceware.org/pub/ecos
[18]    http://ftp.sun.ac.za/ftp/pub/mirrorsites/sourceware.org/pub/ecos
[19]    ftp://ftp.twaren.net/Unix/sourceware.org/ecos
[20]    http://ftp.twaren.net/Unix/sourceware.org/ecos
[21]    http://mirror.facebook.net/sourceware/ecos
[22]    ftp://ecos.sourceware.org/pub/ecos
 
Please select a distribution site: 20

列举了22个下载源,让我们选一个。我选的是20,选有些源下载不了,要设置代理才行。


---------------------------------------------------------
 
Please select a directory for installation
[Default /home/hevake_lcj/ecos]:

然后就是让我们指定安排路径,默认就是相前目录。


---------------------------------------------------------
Available prebuilt GNU tools:
 
[1]    arm-eabi
[2]    arm-elf (old)
[3]    i386-elf
[4]    m68k-elf
[5]    mipsisa32-elf
[6]    powerpc-eabi
[7]    sh-elf
[q]    Finish selecting GNU tools
 
("*" indicates tools already selected)
 
Please select GNU tools to download and install: 1

这是让我们选择哪种平台。我选的是1,arm-eabi。还可以多选几个,选q结束选择。

然后就开始下载了:


Entering /home/hevake_lcj/ecos
Retrieving GNU tools for arm-eabi
Connected... 
Downloading ecos-gnutools-arm-eabi-20120623.i386linux.tar.bz2... 
File size 27341525 bytes
[*******                                           ]

这个过程时间比较长,慢慢等。


小窍门:

如果你嫌下载时间太长,可以手动下载,这会快很多。它要下载的两个文件,分别是:

ecos-gnutools-arm-eabi-20120623.i386linux.tar.bz2

ecos-3.0.i386linux.tar.bz2

我们可先下载到本地,$HOME/ecos/ 目录下。再运行 sh ecos-install.tcl,这样安装会直接跳过下载过程。


最终:


Entering /home/hevake_lcj/ecos
Retrieving GNU tools for arm-eabi
Connected... 
Downloading ecos-gnutools-arm-eabi-20120623.i386linux.tar.bz2... 
File size 27341525 bytes
[**************************************************]
Retrieving eCos version 3.0
Connected... 
Downloading ecos-3.0.i386linux.tar.bz2... 
File size 17854418 bytes
[**************************************************]
Downloads complete.
If you wish to disconnect from the internet you may do so now.
Unpacking ecos-gnutools-arm-eabi-20120623.i386linux.tar.bz2...
Unpacking ecos-3.0.i386linux.tar.bz2...
Generating /home/hevake_lcj/ecos/ecosenv.sh
Generating /home/hevake_lcj/ecos/ecosenv.csh
---------------------------------------------------------
In future, to establish the correct environment for eCos,
run one of the following commands:
   . /home/hevake_lcj/ecos/ecosenv.sh         (for sh/bash users); or
   source /home/hevake_lcj/ecos/ecosenv.csh     (for csh/tcsh users)
 
It is recommended you append these commands to the end of your
shell startup files such as $HOME/.profile or $HOME/.login
---------------------------------------------------------
Installation complete!

表示安装完成。

上面提示要将 ecosenv.sh 加入到 shell 的启动配置中。本人的是CentOS,默认是bash。所以设置 .bashrc 即可。


$ echo '. $HOME/ecos/ecosenv.sh' >> .bashrc

重新开一个终端,查看一下是否设置成功


$ env | grep ECOS
ECOS_REPOSITORY=/home/hevake_lcj/ecos/ecos-3.0/packages

如果返回上述结果表示成功。


编译

进入ecos安装的目录并查看:


$ cd ~/ecos/
$ ls
ecosenv.csh  gnutools/    ecos-3.0/    ecosenv.sh

主要有两个目录,一个是gnutools/,另一个是ecos-3.0。本人估计,第一个是一系列的与平台相关的开发工具,ecos-3.0才是源码。

于是进入ecos-3.0,查看:


$ cd ecos-3.0/
$ ls
acinclude.m4  buildid.txt  configure     doc          Makefile.in  README.txt
aclocal.m4    ChangeLog    configure.in  examples     packages     tools
acsupport     config.log   COPYING       Makefile.am  README.host

configure

看到了 configure,我就想到要先执行这个脚本。结果报错,说应该在顶层目录才能执行。


configure: error: This configure script should not be run inside the source tree. Instead please use a separate build tree

于是,回到了上一层。再执行


$ cd ..
$ ./ecos-3.0/configure

这次没有上面的错误了,是新的错误:


configure: looking for tkConfig.sh in  /usr/local/lib /usr/lib
configure: error: unable to locate Tk config file tkConfig.sh
configure: error: ../../.././ecos-3.0/tools/src/libcdl/configure failed for libcdl
configure: error: ../.././ecos-3.0/tools/src/configure failed for tools/src

貌视是说,没有安装Tk相关的组件?

用yum search查一下:


$ yum search tk-devel
tk-devel.i686 : Tk graphical toolkit development files

应该就是这货,安装吧。

再来!这回OK了。


make

通常都是这样,configure完了就make。


$ make

报错:


make[1]: Entering directory `/home/hevake_lcj/ecos/packages/hal/synth/arch/v3_0/host'
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -I. -I../../../../../.././ecos-3.0/packages/hal/synth/arch/v3_0/host -I/usr/local/include    -pipe -Wall -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -O2 -DECOSYNTH_VERSION=\"0.1\" -DECOS_REPOSITORY=\"/home/hevake_lcj/ecos/ecos-3.0/packages\" -DLIBEXECDIR=\"/usr/local/libexec\" -DPKG_DIR=\"hal/synth/arch\" -DPKG_VERSION=\"v3_0\" -DPKG_INSTALL=\"hal/synth/arch/v3_0\"  -MT ecosynth.o -MD -MP -MF .deps/ecosynth.Tpo -c -o ecosynth.o ../../../../../.././ecos-3.0/packages/hal/synth/arch/v3_0/host/ecosynth.c
In file included from ../../../../../.././ecos-3.0/packages/hal/synth/arch/v3_0/host/ecosynth.c:60:
/usr/include/tk.h:23:3: error: #error Tk 8.5 must be compiled with tcl.h from Tcl 8.5
make[1]: *** [ecosynth.o] Error 1
make[1]: Leaving directory `/home/hevake_lcj/ecos/packages/hal/synth/arch/v3_0/host'
make: *** [all-recursive] Error 1

是在说什么?TK 8.5 必须与 Tcl 8.5 中 tcl.h 一起编译。

打开 /usr/include/tk.h 文件,找到第22行:

123346_ixI2_243525.png

再打开 /usr/include/tcl.h 文件,找到 TCL_MAJOR_VERSION 定义处:

123841_hFzH_243525.png

问题来了,为什么这里明明 TCL_MAJOR_VERSION=8,TCL_MAJOR_VERSION=5,而在tk.h里就不成立了呢?

是不是找错文件了?找成别的 tcl.h 文件去了。于是我用 locate 命令查看是否还有其它同名的文件,也是在 path 中。


[hevake_lcj@localhost:/usr/include]$ locate -r /tcl\.h$
/home/hevake_lcj/Install/some-libs/tcl8.6.1/generic/tcl.h
/home/hevake_lcj/Install/some-libs/tcl8.6.1/unix/tclsh
/usr/bin/tclsh
/usr/local/include/tcl.h

发现还有一个 /usr/local/include/tcl.h 文件,打开看看:

125252_P0Dd_243525.png

想必就是这个文件导致的。这个头文件在 /usr/local/ 目录,想必是之前自己下载的安装包安的吧。

解决办法:(1)把自己源码安装的卸了。(2)更新环境变量,使 /usr/include/ 优先于 /usr/local/include。

我选择了第一种。

好了,我们再make。

What?就这两下就编完了?我还以为要想编译Linux那边等上一两个小时呢。

然后安装:


$ sudo make install

完成了。



裁减

在ecos-3.0/tools/bin/ 目录下有如下的几个工具:


$ cd ecos-3.0/tools/bin/
$ ls
configtool  ecosconfig  platforms.tar  ser_filter

除了platforms.tar外,其它都是可执行文件。而这个路径就在PATH中,如下:


$ echo $PATH
/home/hevake_lcj/ecos/gnutools/arm-eabi/bin:/home/hevake_lcj/ecos/ecos-3.0/tools/bin

那就让我们运行一下。


$ configtool

弹出如下配置界面:

170118_Jiiw_243525.png

eCos的高度可配置性可能就是体现在这个地方。用户可以很方便地勾选与设置自己想要的选项。这点很棒!

配置完了,点工具菜单栏 File --> Save,保存配置。我这里命名为"my-first-try.ecc"

170619_CUr1_243525.png

由于我也是新手,就不乱点了。保存了就直接关闭了吧。

观察当前目录:


[hevake_lcj@localhost:~/ecos]$ ls
ecos-3.0     ecosenv.sh  my-first-try_build/ my-first-try_install/
ecosenv.csh  gnutools    my-first-try.ecc

我们会发现多出了三个 my-first-try 相关的文件。


今天就暂时研究到这里吧~


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值