Chinaunix首页 | 论坛 | 博客
  • 博客访问: 608983
  • 博文数量: 138
  • 博客积分: 3067
  • 博客等级: 中校
  • 技术积分: 1565
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-21 12:44
文章分类

全部博文(138)

文章存档

2016年(5)

2014年(4)

2012年(1)

2011年(2)

2010年(10)

2009年(19)

2008年(97)

我的朋友

分类:

2010-06-06 02:48:59

 
busy box. config
 
Busybox Settings -> Build Options ->
[*] Build BusyBox as a static binary (no shared libs)
//这个是静态编译的选项,这样编译出来的可执行文件才不依赖系统的动态链接库
(/home/yunt/works/cross-arm/bin/arm-none-linux-gnueabi-) Cross Compiler prefex
//这是交叉编译器的”路径+前缀”,这里要根据实际安装位置填,在我的机器上安装位置为/home/yunt/works/cross-arm
 
Busybox Settings -> Installation Options->
[*] Don’t use /usr
//这样子编译出来的busybox才不会安装到你主机的/usr目录下。一定要选上。
 
 
command for andriod + busybox
adb push busybox /sdcard/ #将busybox push进SD卡
adb shell #进入终端
su #取得root权限
mount -o remount,rw /dev/block/mtdblock6 /system #重新mount使/system可写
mv busybox /system/bin/ #移动busybox
chmod 777 /system/bin/buxybox #设为可执行
mount -o remount,ro /dev/block/mtdblock6 /system #恢复/system为只读
busybox #执行busybox
BusyBox v1.15.2 (2009-12-02 21:29:32 EST) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
#有类似以上内容输出表示成功
 
 
 

启动Android模拟器,用如下命令将文件push到Android模拟器上:

adb shell mkdir /dev/sample
adb push hello /dev/sample/hello

adb shell chmod 777 /dev/sample/hello

先创建 /dev/sample目录,再将编译好的hello上传上去,最后将hello改成可执行的。

再进入命令行模式,进入Android的shell环境:

adb shell

#cd /dev/sample

#./hello

进入 /dev/sample目录,执行hello,运行结果如下图:

阅读(4123) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~