移植top命令到hi3531嵌入式平台

1. 下载软件包
ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.7.tar.gz

http://procps.sourceforge.net/procps-3.2.8.tar.gz

2. 编译ncurses-5.7
./configure CC=arm-hisiv200-linux-gcc –host arm-linux –target=arm-linux –enable-widec –with-shared –prefix=/home/hzb/disk2/ncurses-install

make
make install

3.编译procps
export DESTDIR=/home/hzb/disk2/top-install/
export CC=arm-hisiv200-linux-gcc
export TERMINFO=/usr/share/terminfo
export TERM=vt102
修改Makefile文件,保证依赖的ncurses库的头文件目录和lib目录与您的ncurses安装目录一致:
我的ncurses安装目录为/home/hzb/disk2/ncurses-install
行:CURSES := -lncurses
更改为CURSES := -L/home/hzb/disk2/ncurses-install/lib -lncursesw
行:CPPFLAGS := -I/usr/include/ncurses
更改为:CPPFLAGS := -I/home/hzb/disk2/ncurses-install/include/ncursesw -I/home/hzb/disk2/ncurses-install/include/

执行编译
make
make install
如果发现安装的最后一步执行tic -x命令过不了,没关系,终止即可。

4.收集需要的库到同一目录下
文件列表如下
libncursesw.so.5
libproc-3.2.8.so
termcap #此文件来自linux 系统的/etc/termcap文件
terminfo #此目录来自linux系统的/usr/share/terminfo目录
top

5.拷贝文件到目标板, 对so文件建立软连接
我的目录在目标板的路径为/home/hzb/disk2/media/top/
/etc/termcap ->/home/hzb/disk2/media/top/termcap
/usr/share/terminfo->/home/hzb/disk2/media/top/terminfo

6.设置好环境变量,执行top
export TERMINFO=/usr/share/terminfo
export TERM=vt102
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
./top -H -p 1901

回复

你的邮件地址不会被公开(Your email address will not be published.) Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>