编译环境
ubuntu_x64
sdk: rv1126_rv1109_linux_sdk_v1.8.0_20210224
所需软件
ncurses-6.3.tar.gz
procps-ng-3.3.17.tar.xz
过程
1.ubuntu_x64平台,解压 ncurses-6.3.tar.gz,procps-ng-3.3.17.tar.xz 至目录utils(自行创建)
交叉编译工具所在路径: /xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
(/xxx 为sdk所在目录)
切换到utils目录,编辑编译脚本build.sh。CROSS_COMPILE=xxx xxx为交叉编译工具的路径
#!/bin/sh CROSS_COMPILE=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- ARCH=arm TARGET_DIR=$(cd `dirname $0`; pwd)/output build_ncurses() { cd ncurses-6.3 make clean ./configure –host=$ARCH-linux –prefix=$TARGET_DIR \ –enable-static \ –disable-shared \ CC=$CROSS_COMPILE\gcc \ CPP=$CROSS_COMPILE\g++ \ CXX=$CROSS_COMPILE\g++ \ STRIP=$CROSS_COMPILE\strip \ RANLIB=$CROSS_COMPILE\ranlib \ OBJDUMP=$CROSS_COMPILE\objdump \ NM=$CROSS_COMPILE\nm \ LD=$CROSS_COMPILE\ld \ AR=$CROSS_COMPILE\ar \ AS=$CROSS_COMPILE\as ; make -j|| exit 1 #make || exit 1 cd – } build_ncurses build_procps() { cd procps-3.3.17 make clean 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_COMPILE\gcc \ CPP=$CROSS_COMPILE\g++ \ CXX=$CROSS_COMPILE\g++ \ STRIP=$CROSS_COMPILE\strip \ RANLIB=$CROSS_COMPILE\ranlib \ OBJDUMP=$CROSS_COMPILE\objdump \ NM=$CROSS_COMPILE\nm \ LD=$CROSS_COMPILE\ld \ AR=$CROSS_COMPILE\ar \ AS=$CROSS_COMPILE\as ; make -j|| exit 1 #make || exit 1 cd – } build_procps如果编译中遇到报错,手动编辑makefile文件,修改报错makefile文件内以下变量为交叉编译工具即可
CC=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \ CPP=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ \ CXX=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ \ STRIP=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip \ RANLIB=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ranlib \ OBJDUMP=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objdump \ NM=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm \ LD=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld \ AR=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar \ AS=/xxx/rv1126_rv1109_linux_sdk_v1.8.0_20210224/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-as ;2.build_ncurses 后 生成编译库如下
build_procps后生成top可执行程序
3.rv1126板子,
将编译好的libncurses.a 移动至 板子 /usr/lib , 将编译好的top 移动至板子 /usr/bin
设置环境变量永久生效 vi /etc/profile 输入 export TERMINFO=/usr/share/terminfo
4.板子运行top
免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:rv1126 编译linux procps-ng 使用全功能top命令显示-rv1126 demo 编译 https://www.yhzz.com.cn/a/9902.html