ps命令交叉编译 运行top时,会报unknown terminal type错误

  • 2020 年 2 月 13 日
  • 筆記

busybox中的ps命令是针对于嵌入式的,其中一些选项并不完整。因此需要将源码下载下来,进行交叉编译

官方下载地址

github下载地址

含有configure,我在此使用的是这个源码包,官方的包在公司编译服务器上执行autogen.sh出错

编译脚本-不带ncurses:

#!/bin/sh    CROSS_COMPILE=arm-hisiv100nptl-linux-  ARCH=arm  TARGET_DIR=$(cd `dirname $0`; pwd)/output    build_procps() {      cd procps-ng-3.3.10-master      echo "ac_cv_func_realloc_0_nonnull=yes" > arm-linux.cache      echo "ac_cv_func_malloc_0_nonnull=yes" >> arm-linux.cache      ./configure --host=$ARCH-linux --prefix=$TARGET_DIR           --enable-static           --disable-shared           --without-ncurses           --cache-file=arm-linux.cache           CC=$CROSS_COMPILEgcc           STRIP=$CROSS_COMPILEstrip           RANLIB=$CROSS_COMPILEranlib           OBJDUMP=$CROSS_COMPILEobjdump           NM=$CROSS_COMPILEnm           LD=$CROSS_COMPILEld           AR=$CROSS_COMPILEar           AS=$CROSS_COMPILEas ;        make ; make install || exit 1      #make || exit 1      cd -  }    build_procps

ncurses下载地址

编译脚本-带ncurses:

#!/bin/sh    CROSS_COMPILE=arm-hisiv100nptl-linux-  ARCH=arm  TARGET_DIR=$(cd `dirname $0`; pwd)/output    build_ncurses() {      cd ncurses-5.9      ./configure --host=$ARCH-linux --prefix=$TARGET_DIR           --enable-static           --disable-shared           CC=$CROSS_COMPILEgcc           STRIP=$CROSS_COMPILEstrip           RANLIB=$CROSS_COMPILEranlib           OBJDUMP=$CROSS_COMPILEobjdump           NM=$CROSS_COMPILEnm           LD=$CROSS_COMPILEld           AR=$CROSS_COMPILEar           AS=$CROSS_COMPILEas ;        make ; make install || exit 1      #make || exit 1      cd -  }      build_procps() {      cd procps-ng-3.3.10-master      echo "ac_cv_func_realloc_0_nonnull=yes" > arm-linux.cache      echo "ac_cv_func_malloc_0_nonnull=yes" >> arm-linux.cache      CFLAGS="-I$TARGET_DIR/include -I$TARGET_DIR/include/ncurses" NCURSES_CFLAGS="-I$TARGET_DIR/include -I$TARGET_DIR/include/ncurses" NCURSES_LIBS="-L$TARGET_DIR/lib -lncurses" ./configure --host=$ARCH-linux --prefix=$TARGET_DIR           --enable-static           --disable-shared           --with-ncurses           --cache-file=arm-linux.cache           CC=$CROSS_COMPILEgcc           STRIP=$CROSS_COMPILEstrip           RANLIB=$CROSS_COMPILEranlib           OBJDUMP=$CROSS_COMPILEobjdump           NM=$CROSS_COMPILEnm           LD=$CROSS_COMPILEld           AR=$CROSS_COMPILEar           AS=$CROSS_COMPILEas ;        make ; make install || exit 1      #make || exit 1      cd -  }

相关问题:

运行top时,会报unknown terminal type错误

export TERMINFO=/mnt/nfs/procps/terminfo

这样处理后,可以显示,但显示不完全

参考博文:

交叉编译Procps-ng-3.3.11

linux ps命令,查看进程cpu和内存占用率排序

ps命令实例讲解 查看线程信息

ps显示线程名称

ps -eLf c

PS命令参数详解(较详细)