From 1fb20807748ddfb8e41b594dd1b0594ef5b31b95 Mon Sep 17 00:00:00 2001
From: enh
The Aboriginal Linux self-bootstrapping build still uses the following busybox commands, -not yet supplied by toybox:
ash awk bunzip2 bzip2 dd diff expr fdisk ftpd ftpget ftpput gunzip @@ -220,7 +220,9 @@ commands are vi, awk, and ash.
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".
+called "toolbox". ash was later replaced by +mksh; toolbox is being +replaced by toybox.Toolbox doesn't have its own repository, instead it's part of Android's system/core @@ -228,8 +230,8 @@ git repository (this analysis looked at commit 51ccef27cab58).
Toolbox commands:
-According to core/toolbox/Android.mk the toolbox directory builds the -following commands:
+According to system/core/toolbox/Android.mk the toolbox directory builds +the following commands:
ls mount cat ps kill ln insmod rmmod lsmod ifconfig setconsole @@ -245,25 +247,11 @@ cp du grep watchdogd 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:
- --alarm exists lsusb readtty rotatefb setkey syren -- -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 +
Other than the toolbox directory, the currently interesting subdirectories in the core repository are fs_mgr, gpttool, init, -logcat, logwrapper, mkbootimg, netcfg, run-as, and sdcard.
+logcat, logwrapper, mkbootimg, netcfg, reboot, and run-as.
- fs_mgr - subset of mount
@@ -273,8 +261,8 @@ logcat, logwrapper, mkbootimg, netcfg, run-as, and sdcard.- logwrapper - redirect stdio to android log
- mkbootimg - create signed boot image
- netcfg - network configuration (sucks in libnetutils)
+- reboot - Android's reboot(1)
- run-as - subset of sudo
-- sdcard - FUSE wrapper to squash UID/GID/permissions to what FAT supports.
Almost all of these reinvent an existing wheel with less functionality and a @@ -285,8 +273,8 @@ 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 +
Also, gpttool and mkbootimg are install tools. +These aren't a priority if android wants to use its own bespoke code to install itself.
Analysis
@@ -294,20 +282,20 @@ bespoke code to install itself.For reference, combining everything listed above, we get:
-alarm ash cat chcon chmod chown cmp cp date dd df dmesg du exists fs_mgr +cat chcon chmod chown cmp cp date dd df dmesg du fs_mgr getenforce getevent getprop getsebool gpttool grep hd id ifconfig iftop init insmod ioctl -ionice kill ln load_policy log logcat logwrapper ls lsmod lsof lsusb md5 +ionice kill ln load_policy log logcat logwrapper ls lsmod lsof 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 watchdogd +ps r reboot renice restorecon rm rmdir rmmod route run-as +runcon schedtop sendevent setconsole setenforce setprop setsebool +sleep smd start stop sync top touch umount uptime vmstat watchdogd watchprops wipeWe 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" +focus a bit. For our first pass, let's ignore selinux, +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).
-- cgit v1.2.3