2

编译 Android 版 htop

 2 years ago
source link: https://blog.lilydjwg.me/2014/3/8/htop-for-android-compiled.43364.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

编译 Android 版 htop

本文来自依云's Blog,转载请注明。

编译完 lsof,却发现 htop 还是不能用……另开一个终端 strace 之,才知它竟然在调用 /bin/sh 而不是 /system/bin/sh。检查之,原来这个 htop 来自 Terminal IDE,是一个静态链接的版本,大概是使用 glibc 的吧,所以才会去标准位置寻找命令解释器。

编译过程:

path+=/opt/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin
mkdir android-build && cd android-build
CFLAGS='-I/ldata/media/temp/android/installed_binaries/include/ncurses -I/ldata/media/temp/android/installed_binaries/include' LDFLAGS=-L/ldata/media/temp/android/installed_binaries/lib CC='arm-linux-androideabi-gcc --sysroot=/opt/android-ndk/platforms/android-18/arch-arm' ../configure --host=arm-linux-gnu --prefix=/system --bindir=/system/xbin --disable-unicode
rm ../config.h

然后修改当前目录中的 config.h 文件,注释掉 HAVE_NATIVE_AFFINITY 行,添加两个 syscall 的定义,即:

// #define HAVE_NATIVE_AFFINITY 1
#define SYS_ioprio_get __NR_ioprio_get
#define SYS_ioprio_set __NR_ioprio_set

继续 make 即可。

编译好的 htop 可由此下载

发送到 Kindle


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK