当前位置: 首页 > news >正文

开源!!! htop移植到OpenHarmony

笔者最近将htop移植到OpenHar[mony,老规矩开源!!!

先上图,笔者的机器的是此芯星睿o6开发板+AMD显卡rx6600xt,OpenHarmony 5.0.0

image.png


可以看见cix p1芯片有四核大核 Cortex®-A720、四核中核 Cortex®-A720、四核小核 Cortex®-A520,一共12个核

b25ad52b7c1222ef719ff2f74018148a.png

如何集成htop到OpenHarmony

git clone https://gitee.com/OpenHarmony_rk_equipment_transplantation/ttyd_openharmony.gitcd ttyd_openharmony/lycium/
# 设置oh交叉编译环境
export OHOS_SDK=/root/OpenHarmony/cix_myself_5.0.0/prebuilts/ohos-sdk/linux/12# 编译依赖库
./build.sh ncurses
# 编译htop
./build.sh htop

1.编译好的文件在ttyd_openharmony/lycium/usr/htop,将准备好的htop文件推送到开发板

image.png

2.将htop运行需要的terminfo 数据库文件编译出来,然后推送到开发板中

  • 编译x86 linux的ncurses可以得到terminfo 数据库文件。
    # 编译x86 linux的ncurses,得到terminfo 数据库
    wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz
    tar -xvzf ncurses-6.5.tar.gz
    cd ncurses-6.5
    ./configure --prefix=/root/OpenHarmony/temp3/ncurses_install --with-termlib --with-cxx-binding --with-widec --without-ada --disable-mixed-case
    make -j $(shell nproc)
    make install
    

image.png

hdc file send "\\wsl.localhost\Ubuntu-20.04\root\OpenHarmony\temp3\ncurses_install\share\terminfo" /data# 开发板上安装验证
export TERMINFO=/data/terminfo
./htop

移植思路

先完成ncurses 6.5 交叉编译移植到OpenHarmomy,然后交叉编译htop,编译时需要链接到ncurses的编译产物,然后开启编译htop时的静态链接。

https://codeload.github.com/htop-dev/htop/tar.gz/refs/tags/3.4.1
tar -zxvf 3.4.1 
cd htop-3.4.1/
./autogen.sh
./configure --host=aarch64-linux-gnu --prefix=/root/OpenHarmony/temp3/htop_install LDFLAGS="-L/root/OpenHarmony/temp3/ncurses_install/lib" CPPFLAGS="-I/root/OpenHarmony/temp3/ncurses_install/include  -D_FORTIFY_SOURCE=2" --enable-static --enable-affinity

最后如果有读者需要将htop二进制集成到固件里面,不知道默认设置环境变量export TERMINFO=/data/terminfo的话,可以参考笔者文章OpenHarmony中默认export 添加环境变量

http://www.xdnf.cn/news/1285633.html

相关文章:

  • 【网络运维】Linux和自动化: Ansible基础实践
  • ncurses 6.5 交叉编译移植到OpenHarmomy
  • 【软考中级网络工程师】知识点之 IP QoS 技术
  • 小红书笔记信息获取_实在智能RPA源码解读
  • 【Redis优化深度剖析:如何通过读写分离提升系统性能】
  • 【限时分享:Hadoop+Spark+Vue技术栈电信客服数据分析系统完整实现方案
  • Rocky Linux 10 部署 Kafka 集群
  • Bevy渲染引擎核心技术深度解析:架构、体积雾与Meshlet渲染
  • AI-调查研究-49-大数据调研报告 发展历程:从概念诞生到多元化生态1997-2025
  • msyql中,max_connections和max_user_connections区别
  • 【DL】深层神经网络
  • 记录docker使用kong consul postgresql配置dns异常解决
  • SQL180 每类试卷得分前3名
  • 【Redis在在线表单提交防重复机制中的应用策略】
  • 移动端调用大模型详解
  • Web学习笔记5
  • [git] 重配ssh key | 解决冲突
  • 一键生成 Android 适配不同分辨率尺寸的图片
  • Wireshark专家模式定位网络故障:14种TCP异常深度解剖
  • Ceph存储池参数中pg_num和pgp_num的关系
  • 终端安全检测和防御技术
  • 华为发布AI推理新技术,降低对HBM内存依赖
  • 负载均衡详解
  • 纯CSS+JS制作抽奖大转盘
  • C#教程之NPOI读写excel文件XLS,XLSX格式
  • 【vue(二)Vuex】
  • damn the jvm again(2)
  • 《Qwen2.5-VL 》论文精读笔记
  • 【测试】Bug+设计测试用例
  • 【Bug经验分享】由jsonObject-TypeReference引发的序列化问题