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等系統常用命令。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM