手机上的shell太难用了,实在受不了!
1. 准备
a. 下载交叉编译工具链 arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?@template=lite
b. 下载busybox 1.20.2
http://busybox.net/downloads/busybox-1.20.2.tar.bz2
解压到/work/busybox/目录下(任意目录都可以)
2. 编译busybox
a. 修改一下源码
sun@ubuntu:/work/busybox/busybox-1.20.2$ vi include/libbb.h
添加一行 #include <sys/resource.h>
- 要不会出现如下错误:
- loginutils/passwd.c: In function ‘passwd_main’:
- loginutils/passwd.c:104:16: error: storage size of ‘rlimit_fsize’ isn’t known
- loginutils/passwd.c:188:2: warning: implicit declaration of function ‘setrlimit’ [-Wimplicit-function-declaration]
- loginutils/passwd.c:188:12: error: ‘RLIMIT_FSIZE’ undeclared (first use in this function)
- loginutils/passwd.c:188:12: note: each undeclared identifier is reported only once for each function it appears in
- loginutils/passwd.c:104:16: warning: unused variable ‘rlimit_fsize’ [-Wunused-variable]
b.配置busybox
sun@ubuntu:/work/busybox/busybox-1.20.2$ make menuconfig
Busybox Setting -> Build Options
[*]Build BusyBox as a static binary(no shared libs) //一定要选上这个,这样busybox才不依赖于其它的东东,独立运行的
Build Options --->
(/work/busybox/arm-2012.09/bin/arm-none-linux-gnueabi-) Cross Compiler prefix //配置工具链
c. make //只make,不用 make install
这会在当前目录下生成 busybox
3.导入到手机
sun@ubuntu:/work/busybox/busybox-1.20.2$ adb push ./busybox /data/
手机的/bin/目录可能没有权限,所以放在/data/目录下
(wangcong02345) |