在不经意间,本人在网上看到了,一个评论,说如果没有实物开发板,可以利用一些工具模拟硬件平台,来学习Linux移植开发等。由于本人正是那种没有多少可流动现金,所以选择了Skyeye。
Skyeye本来是由清华一学生创始的,后来加入了很多同伴与其一起开发。孤身一人开发确实不容易,但很多情况下都得独自开发,像我这种普通高校学生,很难会做出一下令人有兴趣的,而且还会让人加入的事情。所以只能自己努力坚持,才能达到自己的理想目标,即使艰难也得继续,技术路确实不好走啊。这里就不再废话了。
平台描述:
Skyeye是基于Linux开发的,你可以使用Linux来安装,也可以在Windows下使用Cygwin来安装,由于个人认为,Linux是开发必需的平台,所以我将在下文认Linux安装作为实例教程。
我的电脑安装的是Fedora14(关于Linux的一些学习经常,本人的信息方向论坛有讲述一些,可以作为入门参考 http://blog.csdn.net/bakasen/category/787512.aspx) 。可能在网上很多人都听说过Red Hat、Ubuntu等 ,但是Fedora却是很少听见,其实Fedora的前身就是Red Hat,由于Red Hat 公司将Red Hat Linux的开发放到了开源社区(其自身保留Red Hat的企业版),因此改名为Fedora。由于自己没有玩过Red Hat所以也不知道Red Hat与Fedora的差别有多少。所以我只能以我自己在Fedora14上的安装经验告诉大家(不过不同的Linux上安装,差别并不是太大)。
Skyeye安装:
目前最新的Skyeye版本是1.3.2,你可以到 http://www.skyeye.org 下载最新版的Skyeye。
1、安装前准备:
以前的Skyeye是不支持LCD的,但是现在新出的版本都支持LCD,由于Skyeye的LCD是以GTK为基础的,所以安装Skyeye前一定要安装GTK,但是在不同的发行版中,一般都会自带GTK,所以GTK的安装与否就取决于Skyeye的要求了。
2、用yum命令安装一些软件包
#yum install ncurses ncurses-devel glibc glibc-devel libXpm libXpm-devel texinfo xterm xorg-x11-fonts-misc
3、上面软件包安装完成后:
#su
#fc-cache -fv
4、手动创建一些文件头.用vi创建复制进去保存即可
4.1、创建/usr/include/sys/stropts.h 文件:
4.1.1、拷贝下面文件
/* Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _STROPTS_H
#define _STROPTS_H 1
#include <features.h>
#include <bits/types.h>
#include <bits/xtitypes.h>
#ifndef __gid_t_defined
typedef __gid_t gid_t;
# define __gid_t_defined
#endif
#ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
#endif
typedef __t_uscalar_t t_uscalar_t;
/* Get system specific contants. */
#include <bits/stropts.h>
__BEGIN_DECLS
/* Test whether FILDES is associated with a STREAM-based file. */
extern int isastream (int __fildes) __THROW;
/* Receive next message from a STREAMS file.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int getmsg (int __fildes, struct strbuf *__restrict __ctlptr,
struct strbuf *__restrict __dataptr,
int *__restrict __flagsp);
/* Receive next message from a STREAMS file, with *FLAGSP allowing to
control which message.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int getpmsg (int __fildes, struct strbuf *__restrict __ctlptr,
struct strbuf *__restrict __dataptr,
int *__restrict __bandp, int *__restrict __flagsp);
/* Perform the I/O control operation specified by REQUEST on FD.
One argument may follow; its presence and type depend on REQUEST.
Return value depends on REQUEST. Usually -1 indicates error. */
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
/* Send a message on a STREAM.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int putmsg (int __fildes, __const struct strbuf *__ctlptr,
__const struct strbuf *__dataptr, int __flags);
/* Send a message on a STREAM to the BAND.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int putpmsg (int __fildes, __const struct strbuf *__ctlptr,
__const struct strbuf *__dataptr, int __band, int __flags);
/* Attach a STREAMS-based file descriptor FILDES to a file PATH in the
file system name space. */
extern int fattach (int __fildes, __const char *__path) __THROW;
/* Detach a name PATH from a STREAMS-based file descriptor. */
extern int fdetach (__const char *__path) __THROW;
__END_DECLS
#endif /* stropts.h */
4.1.2、输入命令行,进入后,按i进入文字编辑,粘贴上面文件后,按Ecs,再输入:wq,保存并退出vi。
#vi /usr/include/sys/stropts.h
4.2、创建/usr/include/bits/stropts.h
4.2.1、 拷贝下面文件
/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _STROPTS_H
# error "Never include <bits/stropts.h> directly; use <stropts.h> instead."
#endif
#ifndef _BITS_STROPTS_H
#define _BITS_STROPTS_H 1
#include <bits/types.h>
/* Macros used as `request' argument to `ioctl'. */
#define __SID ('S' << 8)
#define I_NREAD (__SID | 1) /* Counts the number of data bytes in the data
block in the first message. */
#define I_PUSH (__SID | 2) /* Push STREAMS module onto top of the current
STREAM, just below the STREAM head. */
#define I_POP (__SID | 3) /* Remove STREAMS module from just below the
STREAM head. */
#define I_LOOK (__SID | 4) /* Retrieve the name of the module just below
the STREAM head and place it in a character
string. */
#define I_FLUSH (__SID | 5) /* Flush all input and/or output. */
#define I_SRDOPT (__SID | 6) /* Sets the read mode. */
#define I_GRDOPT (__SID | 7) /* Returns the current read mode setting. */
#define I_STR (__SID | 8) /* Construct an internal STREAMS `ioctl'
message and send that message downstream. */
#define I_SETSIG (__SID | 9) /* Inform the STREAM head that the process
wants the SIGPOLL signal issued. */
#define I_GETSIG (__SID |10) /* Return the events for which the calling
process is currently registered to be sent
a SIGPOLL signal. */
#define I_FIND (__SID |11) /* Compares the names of all modules currently
present in the STREAM to the name pointed to
by `arg'. */
#define I_LINK (__SID |12) /* Connect two STREAMs. */
#define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */
#define I_PEEK (__SID |15) /* Allows a process to retrieve the information
in the first message on the STREAM head read
queue without taking the message off the
queue. */
#define I_FDINSERT (__SID |16) /* Create a message from the specified
buffer(s), adds information about another
STREAM, and send the message downstream. */
#define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes'
to send a message, containing a file
pointer, to the STREAM head at the other end
of a STREAMS pipe. */
#define I_RECVFD (__SID |14) /* Non-EFT definition. */
#define I_SWROPT (__SID |19) /* Set the write mode. */
#define I_GWROPT (__SID |20) /* Return the current write mode setting. */
#define I_LIST (__SID |21) /* List all the module names on the STREAM, up
to and including the topmost driver name. */
#define I_PLINK (__SID |22) /* Connect two STREAMs with a persistent
link. */
#define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were
connected with a persistent link. */
#define I_FLUSHBAND (__SID |28) /* Flush only band specified. */
#define I_CKBAND (__SID |29) /* Check if the message of a given priority
band exists on the STREAM head read
queue. */
#define I_GETBAND (__SID |30) /* Return the priority band of the first
message on the STREAM head read queue. */
#define I_ATMARK (__SID |31) /* See if the current message on the STREAM
head read queue is "marked" by some module
downstream. */
#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
a STREAM is closing and there is data on
the write queues. */
#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */
#define I_CANPUT (__SID |34) /* Check if a certain band is writable. */
/* Used in `I_LOOK' request. */
#define FMNAMESZ 8 /* compatibility w/UnixWare/Solaris. */
/* Flush options. */
#define FLUSHR 0x01 /* Flush read queues. */
#define FLUSHW 0x02 /* Flush write queues. */
#define FLUSHRW 0x03 /* Flush read and write queues. */
#ifdef __USE_GNU
# define FLUSHBAND 0x04 /* Flush only specified band. */
#endif
/* Possible arguments for `I_SETSIG'. */
#define S_INPUT 0x0001 /* A message, other than a high-priority
message, has arrived. */
#define S_HIPRI 0x0002 /* A high-priority message is present. */
#define S_OUTPUT 0x0004 /* The write queue for normal data is no longer
full. */
#define S_MSG 0x0008 /* A STREAMS signal message that contains the
SIGPOLL signal reaches the front of the
STREAM head read queue. */
#define S_ERROR 0x0010 /* Notification of an error condition. */
#define S_HANGUP 0x0020 /* Notification of a hangup. */
#define S_RDNORM 0x0040 /* A normal message has arrived. */
#define S_WRNORM S_OUTPUT
#define S_RDBAND 0x0080 /* A message with a non-zero priority has
arrived. */
#define S_WRBAND 0x0100 /* The write queue for a non-zero priority
band is no longer full. */
#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
SIGURG is generated instead of SIGPOLL when
a priority message reaches the front of the
STREAM head read queue. */
/* Option for `I_PEEK'. */
#define RS_HIPRI 0x01 /* Only look for high-priority messages. */
/* Options for `I_SRDOPT'. */
#define RNORM 0x0000 /* Byte-STREAM mode, the default. */
#define RMSGD 0x0001 /* Message-discard mode. */
#define RMSGN 0x0002 /* Message-nondiscard mode. */
#define RPROTDAT 0x0004 /* Deliver the control part of a message as
data. */
#define RPROTDIS 0x0008 /* Discard the control part of a message,
delivering any data part. */
#define RPROTNORM 0x0010 /* Fail `read' with EBADMSG if a message
containing a control part is at the front
of the STREAM head read queue. */
#ifdef __USE_GNU
# define RPROTMASK 0x001C /* The RPROT bits */
#endif
/* Possible mode for `I_SWROPT'. */
#define SNDZERO 0x001 /* Send a zero-length message downstream when a
`write' of 0 bytes occurs. */
#ifdef __USE_GNU
# define SNDPIPE 0x002 /* Send SIGPIPE on write and putmsg if
sd_werror is set. */
#endif
/* Arguments for `I_ATMARK'. */
#define ANYMARK 0x01 /* Check if the message is marked. */
#define LASTMARK 0x02 /* Check if the message is the last one marked
on the queue. */
/* Argument for `I_UNLINK'. */
#ifdef __USE_GNU
# define MUXID_ALL (-1) /* Unlink all STREAMs linked to the STREAM
associated with `fildes'. */
#endif
/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
#define MSG_HIPRI 0x01 /* Send/receive high priority message. */
#define MSG_ANY 0x02 /* Receive any message. */
#define MSG_BAND 0x04 /* Receive message from specified band. */
/* Values returned by getmsg and getpmsg */
#define MORECTL 1 /* More control information is left in
message. */
#define MOREDATA 2 /* More data is left in message. */
/* Structure used for the I_FLUSHBAND ioctl on streams. */
struct bandinfo
{
unsigned char bi_pri;
int bi_flag;
};
struct strbuf
{
int maxlen; /* Maximum buffer length. */
int len; /* Length of data. */
char *buf; /* Pointer to buffer. */
};
struct strpeek
{
struct strbuf ctlbuf;
struct strbuf databuf;
t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
};
struct strfdinsert
{
struct strbuf ctlbuf;
struct strbuf databuf;
t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
int fildes;
int offset;
};
struct strioctl
{
int ic_cmd;
int ic_timout;
int ic_len;
char *ic_dp;
};
struct strrecvfd
{
int fd;
uid_t uid;
gid_t gid;
char __fill[8]; /* UnixWare/Solaris compatibility */
};
struct str_mlist
{
char l_name[FMNAMESZ + 1];
};
struct str_list
{
int sl_nmods;
struct str_mlist *sl_modlist;
};
#endif /* bits/stropts.h */
4.2.2、输入命令行,进入后,按i进入文字编辑,粘贴上面文件后,按Ecs,再输入:wq,保存并退出vi。
#vi /usr/include/bits/stropts.h
4.3、创建/usr/include/bits/xtitypes.h
4.3.1、 拷贝下面文件
/* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. Generic.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _STROPTS_H
# error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead."
#endif
#ifndef _BITS_XTITYPES_H
#define _BITS_XTITYPES_H 1
#include <bits/types.h>
/* This type is used by some structs in <bits/stropts.h>. */
typedef __SLONGWORD_TYPE __t_scalar_t;
typedef __ULONGWORD_TYPE __t_uscalar_t;
#endif /* bits/xtitypes.h */
4.3.2、输入命令行,进入后,按i进入文字编辑,粘贴上面文件后,按Ecs,再输入:wq,保存并退出vi。
#vi /usr/include/bits/xtitypes.h
5、下载Skyeye,并解压
由于时间关系,我已经下载好skyeye-1.3.2_rc1.tar.gz了,如果还没有下载,请到 http://www.skyeye.org下载。
使用cd命令,把当前路径转到存放 skyeye-1.3.2_rc1.tar.gz的地方,输入如下命令。
#tar zxvf skyeye-1.3.2_rc1.tar.gz
6、开始安装Skyeye
先进入刚才解压的文件路径。
#./configure
#make lib
#make
#make install_lib
#make install
我安装时是按照这一流程操作的,如果上面操作步骤有问题,可以在出错信息中查找原因。
7、环境配置
由于Skyeye默认是安装在/opt/skyeye/中,如果想打开Skyeye需要输入/opt/skyeye/bin/skyeye 才能打开,所以配置一个全局变量,只要在打开终端时,就可以直接输入skyeye才运行Skyeye了。
我是对/etc/profile进入修改的,但是网上写,推荐修改/etc/bashrc。
#vi /etc/bashrc
进入后,按i,到文件末尾加上,具体如下(请完整复制下面代码,因为这种代码格式,有点不一样,少了个空格都可能会出错,加上if是为了防止skyeye被删后,还在PATH中加入其路径):
if [ -d /opt/skyeye ]
then
PATH=/opt/skyeye/bin/:$PATH
fi
然后按Esc,输入:wq,保存并退出,再输入
#source /etc/bashrc
好了,试试直接输入skyeye,会不会有什么反应吧,如果没有,请注销或者重启一下。
8、运行测试用例
默认情况下,Skyeye是安装在/opt/skyeye中,里面有一个名为testsuite的文件夹,这个文件夹中,放的就是一个arm_hello的测试例子。
#cd /opt/skyeye/testsuite/arm_hello/
#skyeye -e arm_hello
以Skyeye打开arm_hello,进入下面画面。
输入start ,回车,进入下面画面。
输入run,回车,例子开始运行(不知道是我的问题还是什么 ,输入start是会回显出来,但是输入run时,有时没有回显出来,应该是start后,所以输入有时会没有回显),如下。
好了,这里Skyeye已经安装好了。
其实Fedora14系统本身自带了GTK,由于当初不清楚,所以自己还是安装了GTK,过程还是挺曲折的,由于篇幅问题,这里就不再讲述了。