[置顶] ubuntu server 12.04上的skyeye1.3.5安装和使用(打造最精确的安装步骤和注意事项)

1、环境介绍

ubuntu版本:12.04 (cat /etc/issue 或lsb_release -a查看)

root@xumin:~# lsb_release -a

No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:    precise

skyeye版本:1.3.5

下载地址:

http://sourceforge.net/projects/skyeye/files/skyey e/skyeye-1.3.5/

安装前准备工作

1、apt-get install apt-get install 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

2、python下载源码python2.7.6安装(记得要下载python 2.7版本的),下载地址:

http://www.python.org/download/

安装步骤为(python 2.7的安装对是否能成功安装skyeye有决定性作用):

1、解压python,并进入解压后的目录

2、./configure --prefix=/usr/local/python2.7  --enable-shared --enable-unicode=ucs4

注意:没有这个两个编译选项,你会发现有无穷无尽的错误在等着你解决,不过我仍然相信你乐于去解决。

3、make && make install 

   然后你需要将python的lib库导出,下面是方法:

   vim /etc/ld.so.conf 加上include /usr/local/python2.7/lib 保存退出

   然后/sbin/ldconfig

  说明:python的内部是使用unicode来处理的,但是unicode的使用需要考虑的是它的编码格式有两种,一是UCS-2,它一共有65536个码位,另一种是UCS-4,它有2147483648g个码位。在编译时通过--enable-unicode=ucs2或--enable-unicode=ucs4来指定的。那么我们自己默认安装的python用的什么编码怎么来确定呢?进入python安装后的目录,找到执行python,然后./python

import math,sys
print("math.pi=={0.pi} sys.maxunicode=={1.maxunicode}".format(math, sys))
   quit()
   如果sys.maxunicode==65535,那么就是UCS-2,如果输出是sys.maxunicode==1114111,就是UCS-4编码。

3、skyeye的安装

1、读安装步骤的INSTALL,不要擅作主张自己./configure && make && make install,而应该是

./configure --prefix=/opt/skyeye && make lib && make  && make install_lib && make install 

  中间出现任何编译报错有三个原因,一个是前面要装的依赖包没有安装,一个是python2.7没有安装ok ,还一个可能是系统缺少某些库,或者本身不缺,但库路径没有导出。

2、skyeye的使用

安装成功后,进入/opt/skyeye/testsuite/arm_hello,输入

skyeye -e 可执行文件名 -c skeeye.conf

会出现:

root@xumin:/opt/skyeye/testsuite/arm_hello# skyeye  -e arm_hello -c skyeye.conf SkyEye 1.3.5
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should not remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
 (skyeye) start
In create_uart_console
mmap DRAM, size=0x400000, return 0x1000000
1 core is initialized.
(skyeye) run
(running)stop

不要按照网上的某些人不合理的步骤如:

skyeye

start

run

如果你这样输入,会出现下面的错误。

[SkyEye Crashed]. Please report the following output to [email protected].
In bus_read, Bus read error, can not find corresponding bank for addr 0x908,pc=0x910

如果你比较认真,你可能会进入/opt/skyeye/testsuite/sparc_hello 目录测试sparc_hello

  你会出现:

(skyeye) *** Unknown command: EOF
*** Get commands with 'help' cmd

那是因为代码的测试程序的skyeye.conf中uart:mod=stdio导致的,改成uart:mod=term后再看看吧,你肯定会心情愉悦的。

网上有一段很详细的使用方法(http://www.iteedu.com/embed/embedarticles/skyeyeLinx.php):

  在/opt/skyeye/testsuite/目录下有一个测试程序”arm_hello“。

  1).进入/opt/skyeye/testsuite/;

  2).输入sudo skyeye -e arm_hello命令,进入skyeye命令行界面;

  3).然后运行"start"命令加载配置和初始化目标机,同时在主机上会显示一个xterm的窗口,窗口标题 为"uart_instance";

  4).然后我们可以输入"run” 命令来启动helloworld的测试用例;

  5).我们输入"stop" 命令来停止目标板;

  6).输入 "info regitsters" 查看当前的寄存器的数值;

  7).输入 "disassemble" 命令进行反汇编0x100004c,例如:"disassemble 0x100004c";

  7.skyeye的终端是用term(Ubuntu是xterm),显示特别难看,我们修改一下xterm的显示特性就可以了。

  修改~/.Xresources就可以了(没有就自己创建一个)

  范例代码:

  xterm*locale: true

  xterm.utf8: true

  xterm*utf8Title: true

  xterm*faceName: Monaco:pixelsize=14

  xterm*faceNameDoublesize: WenQuanYi Zen Hei:pixelsize=15

  然后用命令

  xrdb -load ~/.Xresources

  重启或导入设置就可以了

3、如果你觉得在嵌入式虚拟机skyeye上玩得很过瘾,但无人指路,你首先肯定会想到书了,是的。有这样一本书:

一步一步写嵌入式操作系统--ARM编程的方法与实践.pdf

下载地址:http://ishare.iask.sina.com.cn/f/20935970.html?from=like

 它肯定是为你量身订做的,开始你的神奇之旅吧。

4、主要参考博客或网址

http://hanlengsanyue.blog.163.com/blog/static/120878732201321065554665/

http://blog.csdn.net/htttw/article/details/7231851

http://www.solidot.org/story?sid=32270

5、因为ubuntu所装系统的包或库因人而已,所以不可能将所有安装中错误都一一列出,同学们可以在度娘/Google上搜索关键语句,查找解决方法(当然我主要先分析出错原因)。一般出现问题要么是缺少了某些库(静态或动态的),要么是存在这个库,系统库路径没有包含存有该库的路径。另外解决问题时,一定要做好备份和记录,这是一个好的前提。

下面是本人定位记录,相信能帮助到大家:

说明:本人系统有ubuntu默认安装的python2.7.3,然后有本人前面提到的python2.7.6,这是本人编译安装的。第1个问题和第2个问题类似,所以只解释第1个问题。 根据错误提示 ImportError: /usr/local/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: _PyInt_AsInt。说明_ctypes.so引用的_PyInt_AsInt符号,在依赖的库中没有定义,前面提到skyeye的问题,以我的经验,一般是由python引起的,所以我们首先ldd看一下/usr/local/lib/python2.7/lib-dynload/_ctypes.so对python的依赖库,发现libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0xb75a6000),然后通过readelf查看/usr/lib/libpython2.7.so.1.0是否存在符号_PyInt_AsInt的定义,readelf -a /usr/lib/libpython2.7.so.1.0 |grep _PyInt_AsInt ,很显然没有(有的话我们不必讨论该问题,不是么?),就表示/usr/lib/ 下的这个libpython2.7.so.1.0 库,没有定义该符号,我们可以在/usr 目录下全局搜索,看libpython2.7.so.1.0 是否在其他目录存在,特别是我们自定义安装python2.7.6的相关lib路径下,显然我们在/usr/local/python2.7/lib/ 目录下找到了定义_PyInt_AsInt符号的libpython2.7.so.1.0 库。具体细节见下面的定位记录。这样我们只需把我们自定义安装python2.7.6的相应动态库拷贝过来即可,当然拷贝覆盖之前要做好备份! 第3个问题是运行skyeye OK后,在通过gdb调试程序时出现了错误AttributeError: 'module' object has no attribute 'pydebug,/usr/lib/python2.7/下是系统安装python2.7.3生成的(通过dpkg -L python或者whereis python 可以知道系统默认的python2.7.3安装路径),所以我打算先将/usr/lib/python2.7/备份,没想到我输入gdb后竟然成功,通过strace分析发现gdb运行的是/usr/local/python2.7/lib/python2.7/ 目录下的sysconfig.py,当然也可以将/usr/local/python2.7/lib/python2.7/ 拷贝到/usr/lib/。


问题记录1:

root@xumin:/usr/local/lib# skyeye
SkyEye 1.3.5
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should not remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/bin/skyeye_cli.py", line 4, in <module>
    from skyeye_common_module import *
  File "/usr/local/bin/skyeye_common_module.py", line 3, in <module>
    from ctypes import *
  File "/usr/local/lib/python2.7/ctypes/__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /usr/local/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: _PyInt_AsInt
^C

root@xumin:/usr/lib# ldd  /usr/local/lib/python2.7/lib-dynload/_ctypes.so  

    linux-gate.so.1 =>  (0xb778f000)
    libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0xb75a6000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb758b000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb73e0000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73db000)
    libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0xb73d7000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb73ab000)
    /lib/ld-linux.so.2 (0xb7790000)

root@xumin:/usr/lib# readelf -a /usr/lib/libpython2.7.so.1.0 |grep _PyInt_AsInt

root@xumin:/usr/lib#


root@xumin:/usr/lib# find /usr -name "libpython2.7.so.1.0*"
/usr/lib/libpython2.7.so.1.0
/usr/local/lib/libpython2.7.so.1.0_bak1
/usr/local/python2.7/lib/libpython2.7.so.1.0


root@xumin:/usr/lib# readelf -a /usr/local/python2.7/lib/libpython2.7.so.1.0 |grep _PyInt_AsInt
00178f70  00029207 R_386_JUMP_SLOT   0005a920   _PyInt_AsInt
   658: 0005a920    75 FUNC    GLOBAL DEFAULT   11 _PyInt_AsInt
  6313: 0005a920    75 FUNC    GLOBAL DEFAULT   11 _PyInt_AsInt

root@xumin:/usr/lib# mv libpython2.7.so.1.0 libpython2.7.so.1.0_bak1


root@xumin:/usr/lib# cp /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib/


root@xumin:/usr/lib# skyeye
SkyEye 1.3.5
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should not remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
 (skyeye)


问题记录2:

root@xumin:/usr/local/lib/python2.7/lib-dynload# skyeye
SkyEye 1.3.5
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should not remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
 Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/bin/skyeye_cli.py", line 4, in <module>
    from skyeye_common_module import *
  File "/usr/local/bin/skyeye_common_module.py", line 3, in <module>
    from ctypes import *
  File "/usr/local/lib/python2.7/ctypes/__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /usr/local/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromUnicode
^C
   root@xumin:/usr/local/lib/python2.7/lib-dynload#  ldd /usr/local/lib/python2.7/lib-dynload/_ctypes.so
    linux-gate.so.1 =>  (0xb76fb000)
    libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0xb7512000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb74f7000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb734c000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7347000)
    libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0xb7343000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7317000)
    /lib/ld-linux.so.2 (0xb76fc000)

root@xumin:/usr/local/lib/python2.7/lib-dynload# readelf -a /usr/local/lib/python2.7/lib-dynload/_ctypes.so |grep FromUnicode
    47: 00000000     0 FUNC    GLOBAL DEFAULT  UND PyUnicodeUCS2_FromUnicode
   436: 00000000     0 FUNC    GLOBAL DEFAULT  UND PyUnicodeUCS2_FromUnicode

root@xumin:/usr/local/lib/python2.7/lib-dynload# readelf -a /usr/lib/libpython2.7.so.1.0 |grep FromUnicode
00178048  00047607 R_386_JUMP_SLOT   00068520   PyLong_FromUnicode
001781cc  00054c07 R_386_JUMP_SLOT   0005af00   PyInt_FromUnicode
  1142: 00068520   156 FUNC    GLOBAL DEFAULT   11 PyLong_FromUnicode
  1170: 0009e0d0   292 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS4_FromUnicode
  1356: 0005af00   180 FUNC    GLOBAL DEFAULT   11 PyInt_FromUnicode
  4979: 00068520   156 FUNC    GLOBAL DEFAULT   11 PyLong_FromUnicode
  5088: 0009e0d0   292 FUNC    GLOBAL DEFAULT   11 PyUnicodeUCS4_FromUnicode
  5112: 0005af00   180 FUNC    GLOBAL DEFAULT   11 PyInt_FromUnicode

root@xumin:/usr/local/lib/python2.7/lib-dynload# find /usr -name "_ctypes.so"
/usr/lib/python2.7_bak1/lib-dynload/_ctypes.so
/usr/local/lib/python2.7/lib-dynload/_ctypes.so
/usr/local/python2.7/lib/python2.7/lib-dynload/_ctypes.so


root@xumin:/usr/local/lib/python2.7/lib-dynload# readelf -a /usr/local/python2.7/lib/python2.7/lib-dynload/_ctypes.so |grep FromUnicode
    14: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyUnicodeUCS4_FromUnicode
   393: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PyUnicodeUCS4_FromUnicode


root@xumin:/usr/local/lib/python2.7/lib-dynload# mv /usr/local/lib/python2.7/lib-dynload/_ctypes.so /usr/local/lib/python2.7/lib-dynload/_ctypes.so_bak1


root@xumin:/usr/local/lib/python2.7/lib-dynload# cp /usr/local/python2.7/lib/python2.7/lib-dynload/_ctypes.so /usr/local/lib/python2.7/lib-dynload/

root@xumin:/usr/local/lib/python2.7/lib-dynload# find /usr -name "_ctypes.so*"
/usr/lib/python2.7_bak1/lib-dynload/_ctypes.so (python2.7.3的/usr/lib/python2.7目录的备份,UCS4编码,见问题记录3的解决方法2)
/usr/local/lib/python2.7/lib-dynload/_ctypes.so(从/usr/local/python2.7/lib/python2.7/lib-dynload/_ctypes.so拷贝到这里的)
/usr/local/lib/python2.7/lib-dynload/_ctypes.so_bak1(以前安装python2.7.6,--enable-unicode=ucs2编译,UCS2编码)
/usr/local/python2.7/lib/python2.7/lib-dynload/_ctypes.s(python2.7.6,UCS4编码)


root@xumin:/usr/local/lib/python2.7/lib-dynload# skyeye
SkyEye 1.3.5
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should not remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
 (skyeye)

问题记录3:

root@xumin:/usr/lib# gdb
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix
    makefile = _get_makefile_filename()
  File "/usr/lib/python2.7/sysconfig.py", line 331, in _get_makefile_filename
    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'


root@xumin:/usr/lib# find /usr -name "sysconfig.py"
/usr/lib/python2.7/sysconfig.py
/usr/lib/python2.7/distutils/sysconfig.py
/usr/lib/python3.2/sysconfig.py
/usr/lib/python3.2/distutils/sysconfig.py
/usr/local/lib/python2.7/sysconfig.py
/usr/local/lib/python2.7/distutils/sysconfig.py
/usr/local/python2.7/lib/python2.7/sysconfig.py
/usr/local/python2.7/lib/python2.7/distutils/sysconfig.py


root@xumin:/usr/lib# mv python2.7 python2.7_bak1


root@xumin:/usr/lib# gdb
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
(gdb) q


root@xumin:/usr/lib# strace -o 1.txt /usr/bin/gdb
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
(gdb) q

root@xumin:/usr/lib# cat 1.txt |grep sysconfig.py

open("/usr/local/python2.7/lib/python2.7/sysconfig.py", O_RDONLY|O_LARGEFILE) = 4
open("/usr/local/python2.7/lib/python2.7/sysconfig.pyc", O_RDONLY|O_LARGEFILE) = 5

注意:strace的输出为标准错误输出,因此也可以像下面这样将显示内容输出到标准输出上,通过管道再传给grep、less等(可以参考http://blog.csdn.net/delphiwcdj/article/details/7387325关于strace的介绍细节)。

root@xumin:/usr/lib# strace /usr/bin/gdb 2>&1 | grep sysconfig.py
open("/usr/local/python2.7/lib/python2.7/sysconfig.py", O_RDONLY|O_LARGEFILE) = 4
open("/usr/local/python2.7/lib/python2.7/sysconfig.pyc", O_RDONLY|O_LARGEFILE) = 5


另外问题3解决方法还有一个,就是先/usr/lib/python2.7备份,然后将/usr/local/python2.7/lib/python2.7  copy到/usr/lib/python2.7,这种方法较第一种方法为好。

你可能感兴趣的:([置顶] ubuntu server 12.04上的skyeye1.3.5安装和使用(打造最精确的安装步骤和注意事项))