交叉编译htop工具到基于mips芯片的openwrt系统

1 交叉编译htop工具到基于mips芯片的openwrt系统

1.1 背景

在一些嵌入式系统上,很多工具都没有,像top,想看个内存使用,进程,cpu使用率,htop有源码,所以想着把htop交叉编译到这个嵌入式设备上。

1.2 下载htop源码

http://hisham.hm/htop/index.php?page=downloads
打开以下链接,git clone到本地即可。
git clone https://github.com/hishamhm/htop

1.3 git clone到本地之后、chmod 777 htop/* -R

在这里插入图片描述

1.4 进入htop目录,执行./autogen.sh

1.5 htop依赖的共享库目录

因为是openwrt平台,htop交叉编译所需要的库都在以下目录下,根据个人编译openwrt而定,所以在configure的时候,直接加上以下链接库的目录就可以了
htop依赖的共享库所在目录
/home/zze/hdl/openwrt/staging_dir/target-mipsel_24kc_musl/usr/lib
在这里插入图片描述

1.6 configure

下面指定libncurses库及头文件的路径,还有编译器
CFLAGS="-I/home/zze/hdl/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include" LIBS="-L/home/zze/hdl/openwrt/staging_dir/target-mipsel_24kc_musl/usr/lib
-lncursesw -lncurses" ./configure --host=mipsel-openwrt-linux-musl CC=mipsel-openwrt-linux-musl-gcc --prefix=/home/zze/hdl/lib/htop

1.7 make && make install

编译的可执行程序在/home/zze/hdl/lib/htop目录 下
file查看,可知是一个动态链接库。
在这里插入图片描述
通过scp或者winscp工具,拷贝至openwrt平台下

把htop需要的动态库也一拷贝于/lib下
在这里插入图片描述

1.8 运行

完美完成任务
在这里插入图片描述

1.9 参考

https://www.cnblogs.com/txsf/p/3713991.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值