Ubuntu 16.04上安装SkyEye及测试

说明一下,在Ubuntu 16.04上安装SkyEye方法不是原创,是来自互联网,仅供学习参考。

一、检查支持软件包

gcc,
make,
vim(optional),
ssh,
subversion
binutils-dev (bfd)
atk-dev (libatk1.0-dev)
gtk+-2.0-dev (libgtk2.0-dev)
pkg-config
pango-dev (libpango1.0-dev)
freetype2-dev (libfreetype6-dev)
glib-dev (libglib2.0-dev)
x11-dev (libx11-dev)

建议您在终端里输入sudo apt-get install 软件包 来逐个检查,例如sudo apt-get install libx11-dev用来检x11-dev是否安装。我用Ubuntu16.04系统直接运行sudo apt-get install skyeye可以安装成功,安装的过程中如果系统提示缺少包,再按提示安装即可。

二、安装skyeye

1、建议在终端里输入sudo apt-get install skyeye来安装,这种方式安装默认安装的版本为1.2.5,。

2、也可以下载源码包进行编译安装,源码安装方法如下:

--------------------------------------------------------------------------------------------------------------------------

源码安装参考了:http://blog.csdn.net/xumin330774233/article/details/18703391

(1)、下载源码包skyeye-1.3.5_rc1.tar.bz2

(2)、解压源码包:

tar -jxvf skyeye-1.3.5_rc1.tar.bz2

(3)、安装一系列依赖库:

libgtk2.0-dev

pkg-config

libatk1.0-dev

libpango1.0-dev

libfreetype6-dev

libglib2.0-dev

libx11-dev

binutils-dev

libncurses5-dev

libxpm-dev

autoconf

automake

libtool

python-dev

根据不同的系统可能还需要其他一些依赖库,根据实际情况安装。

Ubuntu16.04默认安装了python2.7.11版本,所以我没有重新编译python源码和重新安装。

(4)、输入命令:

./configure --prefix=/opt/skyeye

make lib

make

make install_lib

make install

这几个步骤中可能会出现错误:

a、make lib的时候:libopcodes In function 'SUBWORDSISF': third-party/opcodes/cgen-ops.h:323: multiple definition

这个解决方法参考了:http://blog.csdn.net/u012140133/article/details/51943605

问题在于重复定义。具体而言,extern 变量或函数被包含时,可能被多个文件包含。因为 gcc 是对每个文件单独编译然后在对所有文件一起链接的,所以,在不声明全局变量的前提下,编译时不会报告错误而链接时会发生重复定义。

解决方法有两个:
1. 对于单个文件多次包含,可在被包含文件首末加上 #ifndef **  #define **  #endif
2. 对于多个文件多次包含,只能将被包含内容声明为 static 

我们按提示找到 third-party/opcodes/cgen-ops.h 第 323 行,发现是一个 SEMOPS_INLINE 类型的宏函数,就是它被重复定义了。所以现在将其声明为 static 。其他类似的函数也要这么声明。

    ---28: #define SEMOPS_INLINE extern inline  
    +++28: #define SEMOPS_INLINE static inline  
      
    ---299: QI SUBWORDSIQI (SI, int);  
    ---300: HI SUBWORDSIHI (SI, int);  
    ---301: SI SUBWORDSFSI (SF);  
    ---302: SF SUBWORDSISF (SI);  
    ---303: DI SUBWORDDFDI (DF);  
    ---304: DF SUBWORDDIDF (DI);  
    ---305: QI SUBWORDDIQI (DI, int);  
    ---306: HI SUBWORDDIHI (DI, int);  
    ---307: SI SUBWORDDISI (DI, int);  
    ---308: SI SUBWORDDFSI (DF, int);  
    ---309: SI SUBWORDXFSI (XF, int);  
    ---310: SI SUBWORDTFSI (TF, int);  
      
    +++299: SEMOPS_INLINE QI SUBWORDSIQI (SI, int);  
    +++300: SEMOPS_INLINE HI SUBWORDSIHI (SI, int);  
    +++301: SEMOPS_INLINE SI SUBWORDSFSI (SF);  
    +++302: SEMOPS_INLINE SF SUBWORDSISF (SI);  
    +++303: SEMOPS_INLINE DI SUBWORDDFDI (DF);  
    +++304: SEMOPS_INLINE DF SUBWORDDIDF (DI);  
    +++305: SEMOPS_INLINE QI SUBWORDDIQI (DI, int);  
    +++306: SEMOPS_INLINE HI SUBWORDDIHI (DI, int);  
    +++307: SEMOPS_INLINE SI SUBWORDDISI (DI, int);  
    +++308: SEMOPS_INLINE SI SUBWORDDFSI (DF, int);  
    +++309: SEMOPS_INLINE SI SUBWORDXFSI (XF, int);  
    +++310: SEMOPS_INLINE SI SUBWORDTFSI (TF, int);  
      
    ---312: UQI SUBWORDSIUQI (SI, int);  
    ---313: UQI SUBWORDDIUQI (DI, int);  
    +++312: SEMOPS_INLINE UQI SUBWORDSIUQI (SI, int);  
    +++313: SEMOPS_INLINE UQI SUBWORDDIUQI (DI, int);  

b、make过程中可能出现的错误:

1、/usr/bin/ld: cannot find -lltdl,解决办法:可能是libtool未安装正确,重新输入命令sudo apt-get install libtool即可。

2、/usr/bin/ld: cannot find -liconv,解决办法:由于系统源中没有libiconv的库,所以要下载源码:ftp://gnu.mirror.iweb.com/libiconv/,下载源码后解压:

tar -zxvf libiconv-1.14.tar.gz

./configure --prefix=/usr/local
make
make install

make的时候出现:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
修改libiconv-1.14/srclib/stdio.h文件,把上句中的gets改为fgets,重新make。

3、fatal error: gtk/gtk.h: No such file or directory  fatal error: glibconfig.h: No such file or directory等,解决办法:
首先查看系统中是否有该头文件存在,可以在/usr/include和/usr/lib下查找,查找命令为:find /usr/include | grep "gtk.h",如果系统中不存在该头文件那么是相应的依赖库没有安装,先安装依赖库;如果系统中存在头文件那么是包含路径没有包含。如果因为包含路径没有包含,可以在Makefile文件中增加包含路径,例如在skyeye-1.3.5_rc1/device/touchscreen_s3c6410/touchscreen_s3c6410.c源文件中找不到头文件,可以在skyeye-1.3.5_rc1/device路径下的Makefile中增加头文件包含路径:

am__append_25 = -I/usr/include/gtk-2.0/ \
                -I/usr/include/pango-1.0/ \
                      -I/usr/include/glib-2.0/ \
                                -I/usr/lib/i386-linux-gnu/glib-2.0/include/ \
                                -I/usr/lib/i386-linux-gnu/gtk-2.0/include/ \
                                -I/usr/include/cairo/        \
                                -I/usr/include/gdk-pixbuf-2.0/    \
                                -I/usr/include/atk-1.0/

 以上步骤完成后可以进入到/opt/skyeye/bin目录下,输入命令./skyeye查看软件版本信息,这个时候可能会出现以下错误:

ImportError: /usr/lib/python2.7/lib-dynload/_ctypes.i386-linux-gnu.so: undefined symbol: PyFloat_Type

首先查看一下_ctypes.i386-linux-gnu.so对python的依赖库:

ldd /usr/lib/python2.7/lib-dynload/_ctypes.i386-linux-gnu.so

 linux-gate.so.1 =>  (0xb77a9000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb774b000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7595000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb758b000)
    /lib/ld-linux.so.2 (0x800a2000)
发现_ctypes.i386-linux-gnu.so并没有依赖python库,在/usr/lib/i386-linux-gnu/libpython2.7.so.1.0库中通过命令查看是否有PyFloat_Type的定义:

readelf -a /usr/lib/i386-linux-gnu/libpython2.7.so.1.0 | grep PyFloat_Type
00328c44  00016406 R_386_GLOB_DAT    00361ce0   PyFloat_Type
356: 00361ce0   196 OBJECT  GLOBAL DEFAULT   24 PyFloat_Type
可以看到libpython2.7.so.1.0中定义了PyFloat_Type,但是没找到解决方法 。偶然看到一个帖子上说可以通过加"-n"参数尝试不使用命令行启动,python主要是负责命令行的解析和显示的。

这样测试/opt/skyeye/testsuite/arm_hello程序就通过了,输入以下命令可以看到窗口一直打印helloworld:

/opt/skyeye/bin/skyeye -n -e arm_hello

 出现上述问题时还有一种方法就是重新编译安装python2.7:

下载python2.7源码:https://www.python.org/downloads/release/python-2712/

加压源码:tar -zxvf Python-2.7.12.tgz

进入源码根目录并配置:./configure --enable-shared --enable-unicode=ucs4

sudo make

sudo make install

安装完毕后再次运行skyeye已经不会出现上述问题。

 --------------------------------------------------------------------------------------------------------------------------------------------------------

三、检查skyeye安装是否正确

在终端中输入skyeye并回车,如果出现下面信息,说明安装正确。

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in nf.
***********************************************************************

Your elf file is little endian.
Failed to open skyeye config file nf in the same directory
error: No such file or directory
SkyEye 1.2.5
Bug report: skyeye-developer@list
Usage: skyeye [options] -e program [program args]
Default mode is STANDALONE mode
------------------------------------------------------------------
Options:
-e exec-file        the (ELF executable format)kernel file name.
-l load_address,load_address_mask
                    Load ELF file to another address, not its entry.
-b                  specify the data type is big endian when non "-e" option.
-d                  in GDB Server mode (can be connected by GDB).
-c config-file      the skyeye configure file name.
-h                  The SkyEye command options, and ARCHs and CPUs simulated.
------------------------------------------------------------------
----------- Architectures and CPUs simulated by SkyEye-------------
-------- ARM architectures ---------
at91
lpc
s3c4510b
s3c44b0x
s3c44b0
s3c3410x
ep7312
lh79520
ep9312
cs89712
sa1100
pxa_lubbock
pxa_mainstone
at91rm92
s3c2410x
s3c2440
sharp_lh7a400
ns9750
-------- BlackFin architectures ----
bf533
bf537

如果没有出现上面信息,而是出现:

skyeye: error while loading shared libraries: libbfd-2.19.90.20090909.so: cannot open shared object file: No such file or directory

解决方法:在Ubuntu 16.04中libbfd版本是libbfd-2.20.1-system.20100303.so,而需要的是libbfd- 2.19.90.20090909.so,手动创建符号链接即可,在终端中输入如下命令:sudo ln -s /usr/lib/libbfd-2.20.1-system.20100303.so /usr/lib/libbfd-2.19.90.20090909.so并回车,OK!在在终端中执行skyeye命令,会打印出正确信息。

4.测试

下载skyeye-testsuite-1.2.5,用tar jxvf解压,在终端中进入skyeye-testsuite-1.2.5/uClinux/at91/uclinux_cs8900a,执行以下命 令:sudo skyeye -e linux,会打印出如下信息:

Your elf file is little endian.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x80605a0
ethmod num=1, mac addr=0:0:0:0:0:0, hostip=10.0.0.1
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM   ./romfs.img
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x01000000 size = 0x0000a000.
load section .text: addr = 0x0100a000 size = 0x000e1cd0.
load section .data: addr = 0x010ec000 size = 0x0000a434.
not load section .bss: addr = 0x010f6440 size = 0x000222c0 .
call ARMul_InitSymTable,kernel filename is linux.
start addr is set to 0x01000000 by exec file.
Linux version 2.4.27-uc1 (skyeyeuser@debian) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from )(uClinux XIP and shared lib patches from )) #3 Tue Aug 9 18:57:29 CST 2005
Processor: Atmel AT91M40xxx revision 0
Architecture: EB01
On node 0 totalpages: 1024
zone(0): 0 pages.
zone(1): 1024 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 15.82 BogoMIPS
Memory: 4MB = 4MB total
Memory: 2916KB available (903K code, 178K data, 40K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 1400000-1512BFF [VIRTUAL 1400000-1512BFF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Cirrus Logic CS8900A driver for Linux (V0.02)
eth0: CS8900A rev D detected
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 512)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
mount: /etc/mtab: Read-only file system
Command: mount -t ext2 /dev/ram0 /var
mount: /etc/mtab: Read-only file system
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: cat /etc/motd
Welcome to

      ____ _ _
     / __| ||_|                
    _   _| | | | _ ____ _   _ _ _
   | | | | | | || | _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   | ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

GDB/ARMulator support by <>
For further information check:

Command: /bin/ifconfig eth0 up 10.0.0.2
Execution Finished, Exiting

Sash command shell (version 1.1.1)


而后可以输入一些命令进行测试,例如ls、cd等系统常用命令。

原文地址:https://www.cnblogs.com/softhal/p/5697500.html