Android busybox用法,android开发--- 为android添加 busybox

手机上的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 

要不会出现如下错误:

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值