[Android Pro] Android下toolbox简介

toolbox是Android 自带的提供shell命令的软件。有点类似于busybox,但功能上好像弱很多。
其源码可以从Android source code 中system/core/toolbox目录下找到。

Android source code编译完成后,toolbox被添加入rootfs中类似:/system/bin目录下,用来提供必要的shell命令。但使用下来,觉得toolbox实在是功能非常有限。tools.h中通常只有以下一些命令:

(ls)(mount)(cat)(ps)(kill)(ln)(insmod)(rmmod)(lsmod)(ifconfig)(setconsole)(rm)(mkdir)(rmdir)(reboot)(getevent)(sendevent)(date)(wipe)(sync)(umount)(start)(stop)(notify)(cmp)(dmesg)(route)(hd)(dd)(df)(getprop)(setprop)(watchprops)(log)(sleep)(renice)(printenv)(smd)(chmod)(chown)(newfs_msdos)(netstat)(ioctl)(mv)(schedtop)(top)(iftop)(id)(vmstat)(nandread)(ionice)
且Android自带的shell 也没有tab补齐,按上键找之前的命令的功能。用起来实在不爽。
shell@hammerhead:/ $ ls -al /system/bin | grep toolbox                         
lrwxr-xr-x root     shell             2014-06-13 07:38 cat -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 chcon -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 chmod -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 chown -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 clear -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 cmp -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 cp -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 date -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 dd -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 df -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 dmesg -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 du -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 getenforce -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 getevent -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 getprop -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 getsebool -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 grep -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 hd -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 id -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ifconfig -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 iftop -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 insmod -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ioctl -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ionice -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 kill -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ln -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 load_policy -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 log -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ls -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 lsmod -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 lsof -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 md5 -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 mkdir -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 mkswap -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 mount -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 mv -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 nandread -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 netstat -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 newfs_msdos -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 notify -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 printenv -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 ps -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 readlink -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 renice -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 restorecon -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 rm -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 rmdir -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 rmmod -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 route -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 runcon -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 schedtop -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 sendevent -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 setconsole -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 setenforce -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 setprop -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 setsebool -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 sleep -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 smd -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 start -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 stop -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 swapoff -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 swapon -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 sync -> toolbox
-rwxr-xr-x root     shell      139040 2014-06-13 07:06 toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 top -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 touch -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 umount -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 uptime -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 vmstat -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 watchprops -> toolbox
lrwxr-xr-x root     shell             2014-06-13 07:38 wipe -> toolbox
但我们可以添加busybox于其中。解决以上所有问题。
posted @ 2016-04-04 15:42  demoblog  阅读(1471)  评论(0编辑  收藏  举报