1. 下载 busybox-1.27.0 并解压;
2. export PATH=$PATH:/home/<user>/<android_prj>/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8/bin
3. cd busybox-1.27.0
4. vim configs/android2_defconfig
#修改下面一行
CONFIG_CROSS_COMPILER_PREFIX="aarch64-linux-android-"
#添加下面一行
CONFIG_SYSROOT="/home/<user>/<android_prj>/prebuilts/ndk/9/platforms/android-19/arch-arm64"
保存退出
5. make android2_defconfig
6. make menuconfig
为了避免编译错误,做如下修改:
Busybox settings -> [ ] Don't use user
Core Utils -> [ ] touch
[ ] timeout
Login/Password Management Utils -> [x] Use internal password and group functions rather than system functions
[x] Use internal crypt functions
[x] Enable SHA256/512 crypt functions
[x] cryptpw
Linux System Utils -> [ ] swap on
[ ] swap off
Miscellaneous Utils -> [ ] flash erase all
[ ] flash lock
[ ] flash unlock
[ ] flash cp
[ ] i2cget / i2cset / i2cdump / i2cdetect
[ ] nand write
[ ] nand dump
[ ] ubirename
[ ] time
Network Utils -> [ ] iproute
[ ] ip route
[ ] ip neighbor
[ ] route
7. make
xxxx
xxx
xxx
LINK busybox_unstripped Trying libraries: m Library m is needed, can't exclude it (yet) Final link with: m DOC busybox.pod DOC BusyBox.txt DOC busybox.1 DOC BusyBox.html
REF: https://www.hiroom2.com/2016/09/23/ubuntu-16-04-build-busybox/
based this article, should close swap on & off.
after make && make install, there'll be a _install dir under busybox.
adb remount
adb push bin/ /system/bin
adb push sbin/ /system/sbin