高中学校网站模板,如何创办一个公众号,北京网站seo优化排名公司,网站备案资料下载原创作品#xff0c;允许转载#xff0c;转载时请务必以超链接形式标明文章、作者信息和本声明#xff0c;否则将追究法律责任。 最近一直在完善基于Busybox做的ARM Linux的根文件系统#xff0c;由于busybox是一个精简的指令集组成的简单文件系统#xff0c;其优点就是极…原创作品允许转载转载时请务必以超链接形式标明文章、作者信息和本声明否则将追究法律责任。 最近一直在完善基于Busybox做的ARM Linux的根文件系统由于busybox是一个精简的指令集组成的简单文件系统其优点就是极精简满足了Linux基本的启动需求由于它几乎没有什么后台服务对于追求极度裁剪的系统开发者而言是一个非常好的体验不过也正是由于其精简很多我们在开发测试中使用的工具或者库也可能都没有这对于开发者而言也增加了一定的移植工作量笔者最近正被各种移植工具软件和库文件深深折磨着今天主要说一下一个比较实用的工具HTOP的移植过程。 htop是什么 htop——一个可以让用户与之交互的进程查看器。作为文本模式的应用程序主要用于控制台或X终端中。当前具有按树状方式来查看进程支持颜色主题可以定制等特性。 与top相比htop有以下优点 1、可以横向或纵向滚动浏览进程列表以便看到所有的进程和完整的命令行。 2、在启动上比 top 更快。 3、杀进程时不需要输入进程号。 4、htop 支持鼠标操作。 5、top 已经很老了。 htop移植 1、编译环境 Host机ubuntu-16.10(64bit) Target: arm 交叉工具链arm-linux-gnueabi-gcc 工具包 ncurses-5.9.7: https://yunpan.cn/cMkkk9pDiuu7G 提取码2488 htop-1.0.2: https://yunpan.cn/cMkknBsW6T5kp 提取码b16f 2、编译前准备 下载两个压缩包放在/home/liangwode/test目录下解压缩两个压缩文件夹并创建编译安装目录。 tar xvzf ncurses.tar.gz
tart xvzf htop-1.0.2.tar.gz
mkdir install_ncurses
mkdir install_htop 3、编译ncurses 由于htop依赖于ncurses库因此需要先编译ncurses进入ncurses目录并配置交叉编译 cd ncurses-5.9
./configure --prefix/home/test/install_ncurses --hostarm-linux-gnueabi --without-cxx --without-cxx-binding --without-ada --without-manpages --without-progs --without-tests --with-shared编译并安装ncurses库 make make install这样在/home/test/install_ncurses目录下就生成了ncurses的库和头文件等文件 bin include lib share4、编译htop 进入htop目录并配置htop交叉编译选项注意需通过LDFLAGS指定ncurses库所在的目录并通过CPPFLAGS指定ncurses头文件所在的目录 cd htop-1.0.2
./configure --prefix/home/liangwode/test/install_htop --disable-unicode --hostarm-linux-gnueabi LDFLAGS-L/home/liangwode/test/install_ncurses/lib CPPFLAGS-I/home/liangwode/test/install_ncurses/include/ncurses编译并安装htop make make install完可成后可以在在/home/liangwode/test/install_htop目录下生成安装完文件。 5、移植到目标机文件系统 将ncurses编译生成的文件及htop的可执行文件移植到目标系统对应的文件夹笔者根文件系统在sd卡已经挂载到了/mnt/sysroot目录下 cd /home/liangwode/test/install_ncurses
cp -frP lib/* /mnt/sysroot/usr/lib/
cp -frP share/* /mnt/sysroot/usr/share/
cd /home/liangwode/test/install_htop
cp -P bin/htop /mnt/sysroot/usr/sbin/ OK,将sd卡插入目标机重启目标机系统进入系统后htop可用 htop1 [## 1.3%] Tasks: 13, 0 thr; 1 running2 [#****** 6.4%] Load average: 0.15 0.11 0.10 3 [###****** 8.8%] Uptime: 03:41:004 [* 0.6%]Mem[|||||||||||||||||#* 167/997MB]Swp[ 0/0MB]PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME Command
10619 root 20 0 2964 1920 1540 R 6.9 0.2 0:01.43 htop 1514 root 20 0 2828 1772 1516 S 6.3 0.2 12:41.46 htop241 root 20 0 2592 1368 1284 S 0.6 0.1 1:00.63 /bin/sh /etc/init.d/led_run
10583 root 20 0 2512 1668 1316 S 0.0 0.2 0:00.26 /usr/sbin/dropbear 1 root 20 0 2592 1380 1292 S 0.0 0.1 0:02.97 init252 root 20 0 2104 1276 1180 S 0.0 0.1 0:00.01 /usr/sbin/dropbear259 root 20 0 2592 1112 1032 S 0.0 0.1 0:00.00 /usr/sbin/telnetd264 root 20 0 2592 1284 1204 S 0.0 0.1 0:00.00 /usr/sbin/inetd268 root 20 0 2596 1460 1348 S 0.0 0.1 0:00.17 -sh294 root 20 0 4508 3484 3128 S 0.0 0.3 0:00.52 wpa_supplicant -iwlan0 -Dnl80211 -c/etc/wpa_supplicant.conf -qq367 root 20 0 2592 748 656 S 0.0 0.1 0:00.00 udhcpc -i wlan0 -S
10605 root 20 0 2596 1528 1432 S 0.0 0.1 0:00.03 -sh后记 在编译的过程中笔者测试了htop-2.0.0,htop-2.0.2版本可能是和ncurses版本不匹配的原因按照同样的方法编译总是失败错误要么是找不到ncurses的库要么找不到ncurses的头文件最后只能放弃选择了htop-1.0.2版本后成功编译。 备注 如果编译ncurse报错 gcc -DHAVE_CONFIG_H -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 --param max-inline-insns-single1200 -c ../ncurses/lib_gen.c -o ../objects/lib_gen.oIn file included from ./curses.priv.h:325:0, from ../ncurses/lib_gen.c:19:_18018.c:843:15: error: expected ‘)’ before ‘int’../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’ #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) ^Makefile:967: recipe for target ../objects/lib_gen.o failedmake[1]: *** [../objects/lib_gen.o] Error 1make[1]: Leaving directory /home/abuu/project/ncurses-6.0/ncursesMakefile:113: recipe for target all failedmake: *** [all] Error 2 请删除 删除include/curses.h中mouse_trafo所在行的注释/*generated*/重新make顺利编译通过转载于:https://www.cnblogs.com/liangwode/p/5817594.html