From fdc10c9a02f6686aa7d66bee891023eafd94dd5c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 16 Oct 2012 17:09:30 -0500 Subject: Update roadmap/status with new toolbox analysis based on android system/core git repo. --- www/roadmap.html | 124 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 105 insertions(+), 19 deletions(-) (limited to 'www/roadmap.html') diff --git a/www/roadmap.html b/www/roadmap.html index de9e826f..25847e9c 100755 --- a/www/roadmap.html +++ b/www/roadmap.html @@ -184,37 +184,123 @@ when called under the name "bash".

Use case: Replacing Android Toolbox

-

Full toolbox command set

+

Android has a policy against GPL in userspace, so even though BusyBox +predates Android by many years, they couldn't use it. Instead they grabbed +an old version of ash and implemented their own command line utility set +called "toolbox".

+ +

Toolbox doesn't have its own repository, instead it's part of Android's +system/core +git repository (this analysis looked at commit 51ccef27cab58).

+ +

Toolbox commands:

+ +

According to core/toolbox/Android.mk the toolbox directory builds the +following commands:

-

Here is the full list of toolbox commands: -

-alarm cat chmod chown cmp cp date dd df dmesg getevent getprop hd id ifconfig -iftop insmod ioctl kill ln log ls lsmod mkdir mount mv netstat newfs_msdos notify -pidof printenv ps renice rm rmdir rmmod route schedtop sendevent setconsole -setprop sleep smd start stop sync toolbox top umount vmstat watchprops wipe +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 uptime vmstat nandread ionice touch lsof md5 r
-

The following Toolbox commands are reasonably standardized:

+

If selinux is enabled, you also get:

+
+getenforce setenforce chcon restorecon runcon getsebool setsebool load_policy +
+ +

The Android.mk file also refers to dynarray.c and toolbox.c as library +code. This leaves the following apparently unused C files in toolbox/*.c, each +of which has a command_main() function and seems to implement a standalone +command:

- -cat chmod chown cmp cp date dd df dmesg id ifconfig iftop insmod ioctl ionice -kill ln ls lsmod lsof mkdir mount mv netstat newfs_msdos notify -ps printenv reboot renice rm rmdir rmmod route -sleep start stop sync top umount uptime vmstat - +alarm exists lsusb readtty rotatefb setkey syren
-

Android-specific commands

-

Toolbox also provides the following nonstandard commands, which are unique -to Android (or at least do not appear in Ubuntu or SUSv4):

+

Command shell (ash)

+ +

The core/sh subdirectory contains a fork of ash 1.17, and sucks in +liblinenoise to provide command line history/editing.

+ +

Other Android core commands

+ +

Other than the toolbox and sh directories, the currently interesting +subdirectories in the core repository are fs_mgr, gpttool, init, +logcat, logwrapper, mkbootimg, netcfg, run-as, and sdcard.

+ + + +

Almost all of these reinvent an existing wheel with less functionality and a +different user interface. We may want to provide that interface, but +implementing the full commands (mount, fdisk, init, ifconfig with dhcp, +and sudo) come first.

+ +

Although logcat/logwrapper also reinvent a wheel, Android did so in the +kernel and these provide an interface to that.

+ +

Also, gpttool and mkbootimg are install tools, and sdcard looks like a +testing tool. These aren't a priority if android wants to use its own +bespoke code to install itself.

+ +

Analysis

+ +

For reference, combining everything listed above, we get:

+
+alarm ash cat chcon chmod chown cmp date dd df dmesg exists fs_mgr getenforce +getevent getprop getsebool gpttool hd id ifconfig iftop init insmod ioctl +ionice kill ln load_policy log logcat logwrapper ls lsmod lsof lsusb md5 +mkbootimg mkdir mount mv nandread netcfg netstat newfs_msdos notify printenv +ps r readtty reboot renice restorecon rm rmdir rmmod rotatefb route run-as +runcon schedtop sdcard sendevent setconsole setenforce setkey setprop setsebool +sleep smd start stop sync syren top touch umount uptime vmstat watchprops wipe +
+ +

We may eventually implement all of that, but for toybox 1.0 we need to +focus a bit. For our first pass, let's ignore selinux, strip out the "unlisted" +commands except lsusb, and grab just logcat and logwrapper from the "core" +commands (since the rest have some full/standard version providing that +functionality, which we can implement a shim interface for later).

+ +

This means toybox should implement:

-alarm hd getevent getprop ioctl log nandread notify -r schedtop sendevent setconsole setprop smd watchprops wipe +cat chmod chown cmp date dd df dmesg getevent getprop hd id ifconfig iftop +insmod ioctl ionice kill ln log logcat logwrapper ls lsmod lsof lsusb md5 mkdir +mount mv nandread +netstat newfs_msdos notify printenv ps r reboot renice rm rmdir rmmod route +schedtop sendevent setconsole setprop sleep smd start stop sync top touch +umount uptime vmstat watchprops wipe +
+ +

The following Toolbox commands are already covered in previous +sections of this analysis:

+ +
+cat chmod chown cmp date dd df dmesg id ifconfig insmod kill ln ls lsmod +mkdir mount mv ps renice rm rmdir rmmod route sleep sync top touch umount +
+ +

Which leaves the following commands as new from Toolbox:

+ +
+getevent getprop hd iftop ioctl ionice log lsof nandread netstat +newfs_msdos notify printenv r reboot schedtop sendevent setconsole +setprop smd start stop top uptime vmstat watchprops wipe

-- cgit v1.2.3