toybox/www/roadmap.html
<<
>>
Prefs
   1<html><head><title>toybox roadmap</title>
   2<!--#include file="header.html" -->
   3<title>Toybox Roadmap</title>
   4
   5<h2>Roadmap sections</h2>
   6
   7<ul>
   8<li><a href=#goals>Introduction</a></li>
   9<li><a href=#susv5>POSIX-2024/SUSv5</a></li>
  10<li><a href=#sigh>Linux "Standard" Base</a></li>
  11<li><a href=#rfc>IETF RFCs and Man Pages</a></li>
  12<li><a href=#dev_env>Development Environment</a></li>
  13<li><a href=#android>Android Toolbox</a></li>
  14<li><a href=#aosp>Building AOSP</a></li>
  15<li><a href=#tizen>Tizen Core</a></li>
  16<li><a href=#yocto>Yocto</a></li>
  17<li><a href=#fhs>Filesystem Hierachy Standard</a></li>
  18<li><a href=#buildroot>buildroot</a></li>
  19<li>Miscelaneous: <a href=#klibc>klibc</a>, <a href=#glibc>glibc</a>,
  20<a href=#sash>sash</a>, <a href=#sbase>sbase</a>,
  21<a href=#uclinux>uclinux</a>...</li>
  22<li><a href=#packages>Other Packages</a></li>
  23<li><a href=#todo>TODO list</a></li>
  24</ul>
  25
  26<a name="goals" />
  27<h2>Introduction (Goals and use cases)</h2>
  28
  29<p>We have several potential use cases for a new set of command line
  30utilities, and are using those to determine which commands to implement
  31for Toybox's 1.0 release. Most of these have their own section in the
  32<a href=status.html>status page</a>, showing current progress towards
  33commplation.</p>
  34
  35<p>The most interesting publicly available command line standards are:</p>
  36<ol>
  37<li>POSIX-2024 (also known as SUSv5)</li>
  38<li>the Linux Standard Base version 4.1 (frozen, becoming obsolete)</li>
  39<li>the official <a href=https://www.kernel.org/doc/man-pages/>Linux man pages</a></li>
  40</ol>
  41But each of those include commands we've decided not implement and/or exclude
  42commands or features we have, nor do they always entirely match reality.</p>
  43
  44<p>The most thorough real world test (other than a large interactive
  45userbase) is using toybox as the command line in a
  46<a href=https://landley.net/aboriginal/about.html>build system</a> container
  47where it can rebuild itself from source code, then using the result
  48to <a href=https://github.com/landley/control-images>build Linux From Scratch</a>.
  49The current "minimal native development system" goal is to use
  50<a href=faq.html#mkroot>mkroot</a>
  51plus <a href=faq.html#cross>musl-cross-make</a> to hermetically build
  52<a href=https://source.android.com>AOSP</a>.</p>
  53
  54<p>Over the years we've also checked what commands were provided by similar
  55projects (klibc, sash, sbase, embutils, nash, beastiebox...), looked at various
  56vendor configurations of busybox, and collected end user requests.</p>
  57
  58<p>Finally, we'd like to provide a good replacement for the Bash shell,
  59which was the first program Linux ever ran (leading up to the 0.0.1 release
  60in 1991) and remains the standard shell of Linux (no matter what Ubuntu says).
  61This doesn't necessarily mean including every last Bash 5.x feature, but
  62does involve {various,features} &lt;(beyond) posix.</p>
  63
  64<p>See the <a href=status.html>status page</a> for the current categorized
  65command list and progress towards implementing it.</p>
  66
  67<hr />
  68<a name="standards">
  69<h2>Use case: standards compliance.</h2>
  70
  71<h3><a name=susv4 /><a name=susv5 /><a href="#susv5">POSIX-2024/SUSv5</a></h3>
  72<p>The best standards describe reality rather than attempting to impose a
  73new one. I.E. "A good standard should document, not legislate."
  74Standards which document existing reality tend to be approved by
  75more than one standards body, such as ANSI and ISO both approving <a href=https://landley.net/c99-draft.html>C99</a>. That's why IEEE 1003.1-2024,
  76the Single Unix Specification version 5, and the Open Group Base Specification
  77Issue 8 are all the same standard from three sources, which most people just
  78call "posix" (short for "portable operating system that works like unix").
  79It's available <a href=https://pubs.opengroup.org/onlinepubs/9799919799/>online
  80in full</a>
  81https://pubs.opengroup.org/onlinepubs/9699919799>online in full</a>, and may
  82be <a href=https://pubs.opengroup.org/onlinepubs/9799919799/download>downloaded</a>
  83as a tarball. Previous versions
  84(<a href=https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/>SUSv4</a>,
  85<a href=https://pubs.opengroup.org/onlinepubs/009695399/>SUSv3</a> and
  86<a href=https://pubs.opengroup.org/onlinepubs/7990989775/>SUSv2</a>)
  87are also available.</p>
  88
  89<p>The original Posix was a collection of different standards (POSIX.1
  90from 1988, POSIX.1b from 1993, and POSIX.1c from 1995). The unified
  91SUSv2 came out in 1997 and SUSv3 came out in 2001. SUSv4 came out in 2008
  92and remained the current version for 16 years (although it was
  93re-released in 2013, 2016, and 2018 with basically typo fixes, but was
  94still SUSv4 and Issue 7), until the current SUSv5 (Issue 8) finally came out
  95in 2024.</p>
  96
  97<h3>Why not just use posix for everything?</h3>
  98
  99<p>Unfortunately, Posix describes an incomplete subset of reality, because
 100it was designed to. Those first few pre-SUSv2 Posix standards that remain
 101unavailable on the Open Group's wesite were produced during a period known as
 102"<a href=https://en.wikipedia.org/wiki/Unix_wars>the unix wars</a>" when
 103AT&amp;T's prioprietary control over the original UNIX(tm) intellectual property
 104sucked the old UNIX(tm) ecosystem dry until Linux and FreeBSD swept away
 105the irrelevant debris. That's why the standards process started with proprietary
 106unix vendors collaborating to describe what little functionality their
 107fragmented APIs could agree on, which was then incorporated into
 108<a href=https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub151-2-1993.pdf>US federal procurement standards</a>
 109as a <a href=https://www.youtube.com/watch?v=nwrTTXOg-KI>compliance requirement</a>
 110for things like navy contracts, giving large corporations
 111like IBM and Microsoft millions of dollars of incentive
 112to punch holes in the standard big enough to drive
 113<a href=https://en.wikipedia.org/wiki/Microsoft_POSIX_subsystem>Windows NT</a> and
 114<a href=http://www.naspa.net/magazine/1996/May/T9605006.PDF>OS/360</a> through.
 115When open source projects like Linux started developing on the internet
 116(enabled by the 1993 <a href=https://en.wikipedia.org/wiki/Eternal_September>relaxation</a> of the National Science Foundation's
 117"Acceptable Use Policy" allowing everyone to connect to the internet,
 118previously restricted to approved government/military/university organizations
 119until the budget funding its backbone links passed from DARPA to NSF),
 120Posix <a href=http://www.opengroup.org/testing/fips/policy_info.html>ignored
 121the upstarts</a> and Linux eventually
 122<a href=https://www.linuxjournal.com/article/3417>returned the favor</a>,
 123leaving Posix behind.</p>
 124
 125<p>The result is a "standard" that lacks any mention of commands like
 126"init" or "mount" required to actually boot a system.
 127It describes logname but not login. It provides ipcrm
 128and ipcs, but not ipcmk, so you can use System V IPC resources but not create
 129them. And widely used real-world commands such as tar and cpio (the basis
 130of initramfs and RPM) which were present in earlier
 131versions of the standard have been removed, while obsolete commands like
 132cksum, compress, sccs and uucp remain with no mention of modern counterparts
 133like crc32/sha1sum, gzip/xz, svn/git or scp/rsync. Meanwhile posix' description
 134of the commands
 135themselves are missing dozens of features, and specify silly things like ebcdic
 136support in dd or that wc should use %d (not %lld) for byte counts. So
 137we have to extensively filter posix to get a useful set of recommendations.</p>
 138
 139<h3>Analysis</h3>
 140
 141<p>Starting with the
 142<a href="http://pubs.opengroup.org/onlinepubs/9699919799.2008edition/idx/utilities.html">full "utilities" list</a>,
 143we first remove generally obsolete
 144commands (compress ed ex pr uncompress uccp uustat uux), commands for the
 145pre-CVS "SCCS" source control system (admin delta get prs rmdel sact sccs unget
 146val what), fortran support (asa fort77), and batch processing support (batch
 147qalter qdel qhold qmove qmsg qrerun qrls qselect qsig qstat qsub).</p>
 148
 149<p>Some commands are for a compiler toolchain (ar c99 cflow ctags cxref gencat
 150iconv lex m4 make nm strings strip yacc) which is out of scope for
 151toybox and should be supplied externally. (Some of these might be
 152revisited later, but not for toybox 1.0.)</p>
 153
 154<p>Some commands are part of a command shell, and can't be implemented as
 155separate executables (alias bg cd command fc fg getopts hash jobs kill read
 156type ulimit umask unalias wait). These may be implemented as part of the
 157built-in toybox shell, but are not exported into $PATH via symlinks and
 158thus are not part of toybox's main command list. (If you fork a
 159child process and have it "cd" then exit, you've accomplished nothing.)
 160Again, what posix lists as "commands" is incomplete: a shell also needs exit, if, while,
 161for, case, export, set, unset, trap, exec... (And for bash compatibility
 162function, source, declare...)</p>
 163
 164<p>A few other commands are judgement calls, providing command-line
 165internationalization support (iconv locale localedef), System V inter-process
 166communication (ipcrm ipcs), and cross-tty communication from the minicomputer
 167days (talk mesg write). The "pax" utility <a href=https://slashdot.org/story/06/09/04/1335226/debian-kicks-jrg-schilling>failed</a> to replace tar,
 168"mailx" is
 169a command line email client, and "lp" submits files for printing to... what
 170exactly? (cups?) The standard defines crontab but not crond. What is
 171pathchk supposed to be portable _to_? (Linux accepts 255 byte path components
 172with any char except NUL or / and no max length on the total path, and
 173<a href=https://yarchive.net/comp/linux/utf8.html>EXPLICITLY</a>
 174doesn't care if it's an invalid utf8 sequence.)</p>
 175
 176<p>Removing all of that leaves the following commands, which toybox should
 177implement:</p>
 178
 179<blockquote><b>
 180<span id=posix>
 181at awk basename bc cal cat chgrp chmod chown cksum cmp comm cp
 182csplit cut date dd df diff dirname du echo env expand expr false file find
 183fold fuser getconf grep head id join kill link ln logger logname ls man
 184mkdir mkfifo more mv newgrp nice nl nohup od paste patch printf ps
 185pwd renice rm rmdir sed sh sleep sort split stty tabs tail tee test time
 186touch tput tr true tsort tty uname unexpand uniq unlink uudecode uuencode vi wc
 187who xargs zcat
 188</span>
 189</b></blockquote>
 190
 191<h3><a name=sigh /><a href="#sigh">Linux Standard Base</a></h3>
 192
 193<p>One attempt to supplement POSIX towards an actual usable system was the
 194Linux Standard Base. Unfortunately, the quality of this "standard" is
 195fairly low, largely due to the Free Standards Group that maintained it
 196being consumed by <a href=https://landley.net/notes-2010.html#18-07-2010>the Linux Foundation</a> in 2007.</p>
 197
 198<p>Where POSIX allowed its standards process to be compromised
 199by leaving things out (but what
 200they DID standardize tends to be respected, if sometimes obsolete),
 201the Linux Standard Base's failure mode was different. They responded to
 202pressure by including anything their members paid them enough to promote,
 203such as allowing Red Hat to push
 204RPM into the standard even though all sorts of distros (Debian, Slackware, Arch,
 205Gentoo, Android, Alpine...) don't use it and never will. This means anything in the LSB is
 206at best a suggestion: arbitrary portions of this standard are widely
 207ignored.</p>
 208
 209<p>The <a href=https://mjg59.dreamwidth.org/39546.html>community perception</a>
 210seems to be that the Linux Standard Base is
 211the best standard money can buy: the Linux Foundation is supported by
 212financial donations from large companies and the LSB
 213<a href=https://www.softwarefreedom.org/blog/2016/apr/11/lf/>represents the interests
 214of those donors</a> regardless of technical merit. (The Linux Foundation, which
 215maintains the LSB, is NOT a 501c3. It's a 501c6, the
 216same kind of legal entity as the Tobacco Institute and
 217<a href=https://lwn.net/Articles/706585/>Microsoft's</a>
 218old "<a href=https://en.wikipedia.org/wiki/Don%27t_Copy_That_Floppy>Don't Copy That Floppy</a>" campaign.) Debian officially
 219<a href=http://lwn.net/Articles/658809>washed its hands of LSB</a> by
 220refusing to adopt release 5.0 in 2015, and no longer even pretends to support
 221it (which affects Debian derivatives like Ubuntu and Knoppix). Toybox has
 222stayed on 4.1 for similar reasons.</p>
 223
 224<p>That said, Posix by itself isn't enough, and this is the next most
 225comprehensive standards effort for Linux so far, so we salvage what we can.
 226A lot of historical effort went into producing the standard before the
 227Linux Foundation took over.</p>
 228
 229<h3>Analysis</h3>
 230
 231<p>LSB 4.1 specifies a <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html>list of command line
 232utilities</a>:</p>
 233
 234<blockquote><b>
 235ar at awk batch bc chfn chsh col cpio crontab df dmesg du echo egrep 
 236fgrep file fuser gettext grep groupadd groupdel groupmod groups 
 237gunzip gzip hostname install install_initd ipcrm ipcs killall lpr ls 
 238lsb_release m4 md5sum mknod mktemp more mount msgfmt newgrp od passwd 
 239patch pidof remove_initd renice sed sendmail seq sh shutdown su sync 
 240tar umount useradd userdel usermod xargs zcat
 241</b></blockquote>
 242
 243<p>Where posix specifies one of those commands, LSB's deltas tended to be
 244accomodations for broken tool versions which ween't up to date with the
 245standard yet. (See <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/more.html>more</a> and <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/xargs.html>xargs</a>
 246for examples.)</p>
 247
 248<p>Since we've already committed to using our own judgement to skip bits of
 249POSIX, and LSB's "judgement" in this regard is purely bug workarounds to declare
 250various legacy tool implementations "compliant", this means we're mostly
 251interested in the set of LSB tools that aren't mentioned in posix.</p>
 252
 253<p>Of these, gettext and msgfmt are internationalization, install_initd and
 254remove_initd weren't present even in Ubuntu 10.04, lpr is out of scope,
 255lsb_release just reports information in /etc/os-release, and sendmail's
 256turned into a pile of cryptographic verification and DNS shenanigans due
 257to spammers.</p>
 258
 259<p>This leaves:</p>
 260
 261<blockquote><b>
 262<span id=lsb>
 263chfn chsh dmesg egrep fgrep groupadd groupdel groupmod groups
 264gunzip gzip hostname install killall md5sum
 265mknod mktemp mount passwd pidof seq shutdown
 266su sync tar umount useradd userdel usermod zcat
 267</span>
 268</b></blockquote>
 269
 270<h3><a name=rfc /><a href="#rfc">IETF RFCs and Man Pages</a></h3>
 271
 272<p>They're very nice, but there's thousands of them. The signal to noise
 273ratio here is terrible.</p>
 274
 275<p>Discussion of standards wouldn't be complete without the Internet
 276Engineering Task Force's "<a href=https://www.rfc-editor.org/in-notes/rfc-index.txt>Request For Comments</a>" collection and Michael Kerrisk's
 277<a href=https://www.kernel.org/doc/man-pages/>Linux man-pages project</a>...
 278except these aren't standards, they're collections of documentation with
 279low barriers to inclusion. They're not saying "you should support
 280X", they're saying "if you do, here's how".
 281Thus neither really helps us select which commands to include.</p>
 282
 283<p>The man pages website includes the commands in git, yum, perf, postgres,
 284flatpack... Great for examining the features of a command you've
 285already decided to include, useless for deciding _what_ to include.</p>
 286
 287<p>The RFCs are more about protocols than commands. The noise level is
 288extremely high: there's thousands of RFCs, many describing a proposed idea
 289that never took off, and less than 1% of the resulting documents are
 290currently relevant to toybox. The documents are numbered based on the
 291order they were received, with no real attempt at coherently indexing
 292the result. As with man pages they can be <a href=https://www.ietf.org/rfc/rfc0610.txt>long and complicated</a> or
 293<a href=https://www.ietf.org/rfc/rfc1951.txt>terse and impenetrable</a>,
 294have developed a certain amount of <a href=https://www.ietf.org/rfc/rfc8179.txt>bureaucracy</a> over the years, and often the easiest way to understand what
 295they <a href=https://www.ietf.org/rfc/rfc4330.txt>document</a> is to find an <a href=https://www.ietf.org/rfc/rfc1769.txt>earlier version</a> to read first.
 296(This is an example of the greybeard community problem, where all current
 297documentation was written by people who don't remember NOT already knowing
 298this stuff and the resources they originally learned from are long gone,
 299and <a href=https://tldp.org/HOWTO/Bootdisk-HOWTO/buildroot.html>excellent</a>
 300<a href=https://landley.net/kdocs/mirror/lki-single.html>historical</a>
 301<a href=https://linuxfromscratch.org/hints/downloads/files/OLD/bsd-init.txt>documents</a>
 302have no obvious modern alternative.)</p>
 303
 304<p>That said, RFC documents can be useful (especially for networking protocols)
 305and the four URL templates provided by the recommended starting files
 306for new commands (hello.c and skeleton.c in the toys/example directory)
 307point to example posix, lsb, man, and rfc pages online.</p>
 308
 309<hr />
 310<a name="dev_env">
 311<h2><a href="#dev_env">Use case: provide a self-hosting development environment</a></h2>
 312
 313<p>Once upon a time, the following commands were enough to build the <a href=http://landley.net/aboriginal/about.html>Aboriginal Linux</a> development
 314environment, boot it to a shell prompt, and build <a href=http://www.linuxfromscratch.org/lfs/view/6.8/>Linux From Scratch 6.8</a> under it.</p>
 315
 316<blockquote><b>
 317<span id=development>
 318bzcat cat cp dirname echo env patch rmdir sha1sum sleep sort sync
 319true uname wc which yes zcat
 320awk basename chmod chown cmp cut date dd diff
 321egrep expr fdisk find grep gzip head hostname id install ln ls
 322mkdir mktemp mv od readlink rm sed sh tail tar touch tr uniq
 323wget whoami xargs chgrp comm gunzip less logname split
 324tee test time bunzip2 chgrp chroot comm cpio dmesg
 325dnsdomainname ftpget ftpput gunzip ifconfig init
 326logname losetup mdev mount mountpoint nc pgrep pkill 
 327pwd route split stat switch_root tac umount vi
 328resize2fs tune2fs fsck.ext2 genext2fs mke2fs xzcat
 329</span>
 330</b></blockquote>
 331
 332<p>This use case includes running init scripts and other shell scripts, running
 333configure, make, and install in each package, and providing basic command line
 334facilities such as a text editor. (It does not include a compiler toolchain or
 335C library, those are outside the scope of the toybox project, although mkroot
 336has a <a href=https://landley.net/code/qcc>potential follow-up project</a>.
 337For now we use distro toolchains,
 338<a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>,
 339and the Android NDK for build testing.)
 340That build system also installed bash 2.05b as #!/bin/sh and its scripts
 341required bash extensions not present in shells such as busybox ash.
 342To replace that, toysh needs to supply several bash extensions _and_ work
 343when called under the name "bash".</p>
 344
 345<p>The above command list was collected using a command line recording wrapper
 346(mkroot/record-commands and toys/example/logpath.c) which mkroot/mkroot.sh
 347also uses to populate root/build/log/*-commands.txt. Try
 348<b>awk '{print $1}' root/build/log/*-commands.txt | sort -u | grep -v musl | xargs</b>
 349after building a mkroot target to see the list of commands called out
 350of the $PATH during that build.</p>
 351
 352<h3>Stages and moving targets</h3>
 353
 354<p>The development environment use case has two stages, achieving:
 3551) a bootable system that can rebuild itself from source, and 2)
 356a build environment capable
 357of bootstrapping up to arbitrary complexity (by building
 358Linux From Scratch and Beyond Linux From Scratch under the resulting
 359system, or the Android Open Source Project). To accomplish just the first
 360goal (a minimal system that can rebuild _itself_ from source), the old
 361build still needs the following busybox commands for which toybox does
 362not yet supply adequate replacements:</p>
 363
 364<blockquote><b>
 365awk diff expr fdisk gzip less route sh tr unxz vi xzcat
 366</b></blockquote>
 367
 368<p>All of those except awk and less have partial implementations
 369in "pending".</p>
 370
 371<p>In 2017 Aboriginal Linux development ended, replaced by a much simpler
 372project ("mkroot") designed to use an existing cross+native toolchain (such as
 373<a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>
 374or the Android NDK) instead of building its own cross and native compilers
 375from source. In 2019 the still-incomplete
 376mkroot was merged into toybox as the "make root" target (which runs
 377mkroot/mkroot.sh). This is intended
 378as a simpler way of providing essentially the same build environment, and doesn't
 379significantly affect the rest of this analysis (although the "rebuild itself
 380from source" test should now include building musl-cross-make under either
 381mkroot or toybox's "make airlock" host environment).</p>
 382
 383<p>Toybox source includes
 384a <b>scripts/mcm-buildall.sh</b> wrapper script around musl-cross-make, which
 385builds cross and native versions of gcc+musl toolchains for a dozen
 386different architectures, and a <b>mkroot/testroot.sh</b> that boots
 387all the <b>mkroot/mkroot CROSS=allnonstop LINUX=~/linux</b> systems under
 388qemu and performs basic automated smoketesting that they run, have a current
 389clock, and their network and block device support works. The "make airlock"
 390target is implemented by <b>scripts/install.sh</b> which sets the
 391$PENDING and $TOOLCHAIN variables to lists of commands to symlink out of the
 392host.</p>
 393
 394<p>Building Linux From Scratch is not the same as building the
 395<a href=https://source.android.com>Android Open Source Project</a>,
 396but after toybox 1.0 we plan to try
 397<a href=http://landley.net/aboriginal/about.html#hairball>modifying the AOSP build</a>
 398to reduce dependencies. (It's fairly likely we'll have to add at least
 399a read-only git utility so repo can download the build's source code,
 400but that's actually <a href=https://www.youtube.com/watch?v=I-lGyn3PHP4>not
 401that hard</a>. We'll probably also need our own "make" at some point after
 4021.0, which is its own moving target thanks to cmake and ninja and so on.)
 403The ongoing Android <a href=http://lists.landley.net/pipermail/toybox-landley.net/2018-January/009330.html>hermetic build</a> work is already advancing
 404this goal.</p>
 405
 406<hr />
 407<h2><a name=android /><a href="#android">Use case: Replacing Android Toolbox</a></h2>
 408
 409<p>Android has a policy against GPL in userspace, so even though BusyBox
 410predates Android by many years, they didn't use it. Instead they grabbed
 411an old version of ash (later replaced by
 412<a href="https://www.mirbsd.org/mksh.htm">mksh</a>)
 413and implemented their own command line utility set
 414called "toolbox" (which toybox has already mostly replaced).</p>
 415
 416<p>Toolbox doesn't have its own repository, instead it's part of Android's
 417<a href=https://android.googlesource.com/platform/system/core>system/core
 418git repository</a>. Android's Native Development Kit (their standalone
 419downloadable toolchain)  has its own
 420<a href=https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md>roadmap</a>, and each version has
 421<a href=https://developer.android.com/ndk/downloads/revision_history>release
 422notes</a>.</p>
 423
 424<h3>Toolbox commands:</h3>
 425
 426<p>According to <a href=https://android.googlesource.com/platform/system/core/+/master/toolbox/Android.bp>
 427system/core/toolbox/Android.bp</a> the toolbox directory builds the
 428following commands:</p>
 429
 430<blockquote><b>
 431getevent getprop modprobe setprop start
 432</b></blockquote>
 433
 434<p>getprop/setprop/start were in toybox and moved back because they're so
 435tied to non-public system interfaces. modprobe shares the implementation
 436used in init. getevent is a board bringup tool built with a python script
 437that pulls all the constants from the latest kernel headers.</p>
 438
 439<h3>Other Android /system/bin commands</h3>
 440
 441<p>Other than the toolbox links, the currently interesting
 442binaries in /system/bin are:</p>
 443
 444<ul>
 445<li><b>arping</b> - ARP REQUEST tool (iputils)</li>
 446<li><b>blkid</b> - identify block devices (e2fsprogs)</li>
 447<li><b>e2fsck</b> - fsck for ext2/ext3/ext4 (e2fsprogs)</li>
 448<li><b>fsck.f2fs</b> - fsck for f2fs (f2fs-tools)</li>
 449<li><b>fsck_msdos</b> - fsck for FAT (BSD)</li>
 450<li><b>gzip</b> - compression/decompression tool (zlib)</li>
 451<li><b>ip</b> - network routing tool (iproute2)</li>
 452<li><b>iptables/ip6tables</b> - IPv4/IPv6 NAT admin (iptables)</li>
 453<li><b>iw</b> - wireless device config tool (iw)</li>
 454<li><b>logwrapper</b> - redirect stdio to android log (Android)</li>
 455<li><b>make_ext4fs</b> - make ext4 fs (Android)</li>
 456<li><b>make_f2fs</b> - make f2fs fs (f2fs-tools)</li>
 457<li><b>ping/ping6</b> - ICMP ECHO_REQUEST tool (iputils)</li>
 458<li><b>reboot</b> - reboot (Android)</li>
 459<li><b>resize2fs</b> - resize ext2/ext3/ext4 fs (e2fsprogs)</li>
 460<li><b>sh</b> - mksh (BSD)</li>
 461<li><b>ss</b> - socket statistics (iproute2)</li>
 462<li><b>tc</b> - traffic control (iproute2)</li>
 463<li><b>tracepath/tracepath6</b> - trace network path (iputils)</li>
 464<li><b>traceroute/traceroute6</b> - trace network route (iputils)</li>
 465</ul>
 466
 467<p>The names in parentheses are the upstream source of the command.</p>
 468
 469<h3>Analysis</h3>
 470
 471<p>For reference, combining everything listed above that's still "fair game"
 472for toybox, we get:</p>
 473
 474<blockquote><b>
 475arping blkid e2fsck dd fsck.f2fs fsck_msdos gzip ip iptables
 476ip6tables iw logwrapper make_ext4fs make_f2fs modpobe newfs_msdos ping ping6
 477reboot resize2fs sh ss tc tracepath tracepath6 traceroute traceroute6
 478</b></blockquote>
 479
 480<p>We may eventually implement all of that, but for toybox 1.0 we need to
 481focus a bit. If Android has an acceptable external package, and the command
 482isn't needed for system bootstrapping, replacing the external package is
 483not a priority.</p>
 484
 485<p>However, several commands toybox plans to implement anyway could potentially
 486replace existing Android versions, so we should take into account Android's use
 487cases when doing so. This includes:</p>
 488<blockquote><b>
 489<span id=toolbox>
 490getevent gzip modprobe newfs_msdos sh
 491</span>
 492</b></blockquote>
 493
 494<p>Update: Android's <a href=https://android.googlesource.com/platform/external/toybox/+/refs/heads/main/Android.bp>external/toybox/Android.bp</a>
 495builds the following commands out of "pending", which
 496should be a priority for cleanup:</p>
 497
 498<blockquote><b>
 499diff expr tr brctl getfattr lsof modprobe more stty traceroute vi
 500</b></blockquote>
 501
 502<p>Android wishlist:</p>
 503
 504<blockquote><b>
 505mtools genvfatfs mke2fs gene2fs
 506</b></blockquote>
 507
 508<hr />
 509<h2><a name=aosp /><a href="#aosp">Use case: Building AOSP</a></h2>
 510
 511<p>The list of external tools used to build AOSP was
 512<a href="https://android.googlesource.com/platform/build/soong/+/master/ui/build/paths/config.go">here</a>,
 513but as they're switched over to toybox they disappear and reappear
 514<a href="https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/path/linux-x86/">here</a>.</p>
 515
 516<blockquote><b>
 517awk basename bash bc bzip2 cat chmod cmp comm cp cut date dd diff dirname dlv du
 518echo egrep env expr find fuser getconf getopt git grep gzip head hexdump
 519hostname id jar java javap ln ls lsof m4 make md5sum mkdir mktemp mv od openssl
 520paste patch pgrep pkill ps pstree pwd python python2.7 python3 readlink
 521realpath rm rmdir rsync sed setsid sh sha1sum sha256sum sha512sum
 522sleep sort stat tar tail tee touch tr true uname uniq unix2dos unzip
 523wc which whoami xargs xxd xz zip zipinfo
 524</b></blockquote>
 525
 526<p>The following are already in the tree and will be used directly:</p>
 527
 528<blockquote><b>
 529awk bc bzip2 jar java javap m4 make python python2.7 python3 xz
 530</b></blockquote>
 531
 532<p>Subtracting what's already in toybox (including the following toybox toys
 533that are still in pending: <code>diff expr gzip lsof tr</code>),
 534that leaves:</p>
 535
 536<blockquote><b>
 537bash fuser git hexdump openssl pstree rsync sh unzip zip zipinfo
 538</b></blockquote>
 539
 540<p>For AOSP, zip/zipinfo/unzip are likely to be libziparchive based.
 541git/openssl seem like they should just be brought in to the tree. rsync is
 542used to work around a Mac <code>cp -Rf</code> bug with broken symbolic links.
 543That leaves:</p>
 544
 545<blockquote><b>
 546bash fuser hexdump pstree
 547</b></blockquote>
 548
 549<p>(Why are fuser and pstree used during the AOSP build? They're used for
 550diagnostics if something goes wrong. So it's really just bash and hexdump
 551that are actually used to build.)</p>
 552
 553<hr />
 554<h2><a name=tizen /><a href="#tizen">Use case: Tizen Core</a></h2>
 555
 556<p>A side effect of the Linux Foundation following the money to the
 557exclusion of all else is they "support" their donors' myriad often
 558contradictory pet projects with elaborate announcements and press releases.
 559Long ago when Nokia's Maemo merged
 560with Intel's Moblin to form <a href=https://www.linuxfoundation.org/press-release/linux-foundation-to-host-meego-project/>MeeGo</a>, there were believable <a href=https://www.linuxfoundation.org/press-release/public-support-for-the-meego-project/>statements</a>
 561about unifying fragmented vendor efforts. Then MeeGo merged with
 562<a href=http://en.wikipedia.org/wiki/LiMo_Foundation>LiMo</a> to
 563<a href=notes-2012.html#16-05-2012>form Tizen</a>,
 564which became a Samsung-only project (that <a href=https://www.androidheadlines.com/2021/05/samsung-tvs-continue-use-tizen-os.html>still ships</a>
 565inside <a href=https://twitter.com/cstross/status/1453747613686288385>televisions</a>,
 566but was otherwise subsumed into <a href=https://www.theverge.com/2021/5/18/22440483/samsung-smartwatch-google-wearos-tizen-watch>Android GO</a>).</p>
 567
 568<p>Along the way, the Tizen project expressed a desire to eliminate GPLv3 software
 569from its core system, and in installing toybox as
 570<a href=https://wiki.tizen.org/wiki/Toybox>part of this process</a>.</p>
 571
 572<p>They had a fairly long list of new commands they wanted to see in toybox:</p>
 573
 574<blockquote><b>
 575<span id=tizen_cmd>
 576arch base64 users unexpand shred join csplit
 577hostid nproc runcon sha224sum sha256sum sha384sum sha512sum sha3sum mkfs.vfat fsck.vfat 
 578dosfslabel uname pinky diff3 sdiff zcmp zdiff zegrep zfgrep zless zmore
 579</span>
 580</b></blockquote>
 581
 582<p>In addition, they wanted to use several commands then in pending:</p>
 583
 584<blockquote><b>
 585<span id=tizen>
 586tar diff printf wget rsync fdisk vi less tr test stty fold expr dd
 587</span>
 588</b></blockquote>
 589
 590<p>Also, tizen uses a different Linux Security Module called SMACK, so
 591many of the SELinux options ala ls -Z needed smack alternatives in an
 592if/else setup. We added lib/lsm.h to abstract this, but haven't heard
 593from Tizen in years and have started implementing SELinux support without
 594Smack support in places like tar.c. At some point, lib/lsm.h may go away
 595due to lack of expressed interest.</p>
 596
 597<hr />
 598<h2><a name=yocto /><a href="#yocto">Use case: Yocto</a></h2>
 599
 600<p>Another project the Linux Foundation is paid to appreciate is Yocto,
 601which was designed to fix the ongoing proprietary fragmentation problem
 602(now in Linux build systems instead of vendor unix forks) by being the
 603build system equivalent of a glue trap. While proclaiming that having the
 604"minimum level of standardization" contributes to a "strong ecosystem",
 605Yocto uses a "<a href=https://www.yoctoproject.org/software-overview/layers/>layered</a>"
 606design where everybody who touches it is encouraged to add more and more layers
 607of metadata on top of what came before, until they wind up <a href=https://github.com/varigit/variscite-bsp-platform>using repo</a> just to manage
 608the layers (let alone their contents). But -- and this is the
 609important bit -- all these dispirate forks are called "yocto" and built on
 610top of giant piles of code the Linux Foundation can take credit for
 611since they filed the serial numbers off OpenEmbedded. (And THEN users
 612are encouraged to check the result into their own repository as one
 613big initial commit, discarding all layers and history.)</p>
 614
 615<p>Yocto's "core-image-minimal" target (only 3,106 build steps in the 3.3
 616release, which includes building host versions of gnome packages and
 617<a href=https://landley.net/notes-2019.html#06-02-2019>something called</a>
 618the "uninative binary shim") builds a busybox-based system with the following commands:</p>
 619
 620<blockquote><b>
 621<span id=yocto_cmd>
 622addgroup adduser ascii sh awk base32 basename blkid bunzip2 bzcat bzip2 cat
 623chattr chgrp chmod chown chroot chvt clear cmp cp cpio crc32 cut date dc dd
 624deallocvt delgroup deluser depmod df diff dirname dmesg dnsdomainname du
 625dumpkmap dumpleases echo egrep env expr false fbset fdisk fgrep find flock
 626free fsck fstrim fuser getopt getty grep groups gunzip gzip head hexdump
 627hostname hwclock id ifconfig ifdown ifup insmod ip kill killall klogd less
 628ln loadfont loadkmap logger logname logread losetup ls lsmod lzcat md5sum
 629mesg microcom mkdir mkfifo mknod mkswap mktemp modprobe more mount mountpoint
 630mv nc netstat nohup nproc nslookup od openvt patch pgrep pidof pivot_root
 631printf ps pwd rdate readlink realpath reboot renice reset resize rev rfkill
 632rm rmdir rmmod route run-parts sed seq setconsole setsid sh sha1sum sha256sum
 633shuf sleep sort start-stop-daemon stat strings stty sulogin swapoff swapon
 634switch_root sync sysctl syslogd tail tar tee telnet test tftp time top touch
 635tr true ts tty udhcpc udhcpd umount uname uniq unlink unzip uptime users
 636usleep vi watch wc wget which who whoami xargs xzcat yes zcat
 637</span>
 638</b></blockquote>
 639
 640<p>Nobody seems entirely sure why.</p>
 641
 642<a name="fhs" />
 643<hr /><a href=fhs>Filesystem Hierachy Standard</a>
 644<h2>Filesystem Hierarchy Standard:</h2>
 645
 646<p>Another standard taken over by the Linux Foundation. (At least the
 647links to this one didn't <a href=http://lanana.org/>go 404</a> the
 648instant they took it over). Of historical interest due to what it
 649managed to achieve before they chased away the hobbyists maintaining it.
 650Only one version (3.0 in 2015) has been released since the Linux Foundation
 651absorbed the FHS. The previous release, Version 2.3, was released in 2004.
 652The Linux Foundation did not retain earlier versions. The contents of
 653the relevant sections appear identical between the two versions, in the
 65411 years between releases the Linux Foundation just added section numbers.</p>
 655
 656<p><a href=https://refspects.linuxfoundation.org/FHS_3.0/fhs-3.0.html>FHS 3.0</a>
 657section 3.4.2 requires commands to be in the /bin directory, and then 3.4.3
 658has an optional list,
 659and then 3.16.2 and 3.16.3 similarly cover /sbin. There are linux
 660specific sections in 6.1.2 and 6.1.6 but everything in them is obsolete.</p>
 661
 662<p>The /bin options include csh but not bash, and ed but not vi.
 663The /sbin options have "update" which seems obsolete (filesystem
 664buffers haven't needed a userspace process to flush them for DECADES),
 665"fastboot" and "fasthalt" (reboot and halt have -nf), and
 666fsck.* and mkfs.* that don't actually specify any specific filesystems.
 667Removing that gives us:</p>
 668
 669<blockquote><b>
 670<span id=fhs_cmd>
 671cat chgrp chmod chown cp date dd df dmesg echo false hostname kill ln
 672login ls mkdir mknod more mount mv ps pwd rm rmdir sed sh stty su sync true
 673umount uname tar cpio gzip gunzip zcat netstat ping
 674shutdown fdisk getty halt ifconfig init mkswap reboot route swapon swapoff
 675</span>
 676</b></blockquote>
 677
 678<hr /><a name=buildroot />
 679<h2>buildroot:</h2>
 680
 681<p>If a toybox-based development environment is to support running
 682buildroot under it, the <a href=https://buildroot.org/downloads/manual/manual.html#requirement-mandatory>mandatory packages</a>
 683section of the buildroot manual lists:</p>
 684
 685<blockquote><p><b>
 686which sed make bash patch gzip bzip2 tar cpio unzip rsync file bc wget
 687</b></p></blockquote>
 688
 689<p>(It also lists binutils gcc g++ perl python, and for debian it wants
 690the build-essential meta-package. And it wants file to be in /usr/bin because
 691<a href=https://git.busybox.net/buildroot/tree/support/dependencies/dependencies.sh?h=2018.02.x#n84>libtool
 692breaks otherwise</a>.)</p>
 693
 694<p>Oddly, buildroot can't NOT cross compile. Buildroot does not support a cross toolchain that lives in "/usr/bin"
 695with a prefix of "".  If you try, and chop out the test for a blank prefix,
 696it dies trying to run "/usr/bin/-gcc". In theory you can modify any open source
 697project to do anything if you rewrite enough of it, but buildroot's developers
 698explicitly do not support this usage model.</p>
 699
 700<hr /><a name=klibc />
 701<h2>klibc:</h2>
 702
 703<p>Long ago some kernel developers came up with a project called
 704<a href=http://en.wikipedia.org/wiki/Klibc>klibc</a>.
 705After a decade of development it still has no web page or HOWTO,
 706and nobody's quite sure if the license is BSD or GPL. It inexplicably
 707<a href=http://www.infoworld.com/d/data-center/perl-isnt-going-anywhere-better-or-worse-211580>requires perl to build</a>, and seems like an ideal candidate for
 708replacement.</p>
 709
 710<p>In addition to a C library less general-purpose than old versions of bionic
 711(let alone musl), klibc builds a random assortment of executables to run init scripts
 712with. There's no multiplexer command, these are individual executables:</p>
 713
 714<blockquote><p><b>
 715cat chroot cpio dd dmesg false fixdep fstype gunzip gzip halt ipconfig kill
 716kinit ln losetup ls minips mkdir mkfifo mknodes
 717mksyntax mount mv nfsmount nuke pivot_root poweroff readlink reboot resume
 718run-init sh sha1hash sleep sync true umount uname zcat
 719</b></p></blockquote>
 720
 721<p>To get that list, build klibc according to the instructions (I
 722<a href=http://landley.net/notes-2013.html#23-01-2013>looked at</a> version
 7232.0.2 and did cd klibc-*; ln -s /output/of/kernel/make/headers_install
 724linux; make) then <b>echo $(for i in $(find . -type f); do file $i | grep -q
 725executable && basename $i; done | grep -v '[.]g$' | sort -u)</b> to find
 726executables, then eliminate the *.so files and *.shared duplicates.</p>
 727
 728<p>Some of those binaries are build-time tools that don't get installed,
 729which removes mknodes, mksyntax, sha1hash, and fixdep from the list.
 730(And sha1hash is just an unpolished sha1sum anyway.)</p>
 731
 732<p>The run-init command is more commonly called switch_root, nuke is just
 733"rm -rf -- $@", and minips is more commonly called "ps": I'm not doing aliases
 734for these oddball names.
 735The "kinit" command is another gratuitous rename, it's init running as PID 1.
 736The halt, poweroff, and reboot commands work with it.
 737Yet more stale forks of dash and gzip got sucked in here (see "dubious
 738license terms" above).</p>
 739
 740<p>In theory "blkid" or "file" handle fstype (and df for mounted filesystems),
 741but we could do fstype. We should also implement nfsmount, and probably smbmount
 742and p9mount even though this hasn't got one. (The reason these aren't
 743in the base "mount" command is they interactively query login credentials.)
 744The ipconfig command here has a built in dhcp client, so it's ifconfig
 745and dhcpcd and maybe some other stuff.</p>
 746
 747<p>The resume command is... weird. It finds a swap partition and reads data
 748from it into a /proc file, something the kernel is capable of doing itself.
 749(Even though the klibc author
 750<a href=http://www.zytor.com/pipermail/klibc/2006-June/001748.html>attempted
 751to remove</a> that capability from the kernel, current kernel/power/hibernate.c
 752still parses "resume=" on the command line). And yet various distros seem to
 753make use of klibc for this.
 754Given the history of swsusp/hibernate (and 
 755<a href=http://lwn.net/Articles/333007>TuxOnIce</a>
 756and <a href=http://lwn.net/Articles/242107>kexec jump</a>...) I've lost track
 757of the current state of the art here. Ah, Documentation/power/userland-swsusp.txt
 758has the API docs, and <a href=http://suspend.sf.net>here's a better
 759tool</a>...</p>
 760
 761<p>This gives us a klibc command list:</p>
 762
 763<blockquote><b>
 764<span id=klibc_cmd>
 765cat chroot dmesg false kill ln losetup ls mkdir mkfifo readlink rm switch_root
 766sleep sync true uname
 767
 768cpio dd ps mv pivot_root
 769mount nfsmount fstype umount
 770sh gunzip gzip zcat
 771kinit halt poweroff reboot
 772ipconfig
 773resume
 774</span>
 775</b></blockquote>
 776
 777<hr />
 778<a name=glibc />
 779<h2>glibc</h2>
 780
 781<p>Rather a lot of command line utilities come bundled with glibc:</p>
 782
 783<blockquote><b>
 784catchsegv getconf getent iconv iconvconfig ldconfig ldd locale localedef
 785mtrace nscd rpcent rpcinfo tzselect zdump zic
 786</b></blockquote>
 787
 788<p>Of those, musl libc only implements ldd. Of the rest:</p>
 789
 790<ul>
 791<li><b>catchsegv</b> is a rudimentary debugger, probably out of scope for toybox.</li>
 792<li><b>iconv</b> has been <a href="#susv4">previously discussed</a>.</li>
 793<li><b>iconvconfig</b> is only relevant if iconv is user-configurable; musl uses a
 794non-configurable iconv now that utf8+unicode exist.</li>
 795<li><b>getconf</b> is a posix utility which displays several variables from 
 796unistd.h; it probably belongs in the development toolchain.</li>
 797<li><b>getent</b> handles retrieving entries from passwd-style databases
 798(in a rather lame way) and is trivially replacable by grep.</li>
 799<li><b>locale</b> was discussed under <a href=#susv4>posix</a>.</li>
 800<li><b>localedef</b> compiles locale definitions, which musl currently does not use.</li>
 801<li><b>mtrace</b> is a perl script to use the malloc debugging that glibc has built-in;
 802this is not relevant for musl, and would necessarily vary with libc.</li>
 803<li><b>nscd</b> is a name service caching daemon, which is not yet relevant for musl.</li>
 804<li><b>rpcinfo</b> and <b>rpcent</b> are related to the Remote Procedure Calls
 805layer (an old sun technology used by some userspace NFS implementations),
 806which musl does not include and debian does not install by default.</li>
 807</ul>
 808
 809<p>The remaining commands involve glibc's bundled timezone database,
 810which seems to be derived from the <a href=http://www.iana.org/time-zones>IANA
 811timezone database</a>. Unless we want to maintain our own fork of the
 812standards body's database like glibc does, these are of no interest,
 813but for completeness:</p>
 814
 815<ul>
 816<li><b>tzselect</b> outputs a TZ variable correponding to user input. 
 817The documentation does not indicate how to use it in a script, but it seems
 818that Debian may have done so.</li>
 819<li><b>zdump</b> prints current time in each of several timezones, optionally
 820outputting a great deal of extra information about each timezone.</li>
 821<li><b>zic</b> converts a description of a timezone to a file in tz format.</li>
 822</ul>
 823
 824<p>We implemented getconf and iconv, and I could see maybe arguing for ncsd.
 825The rest are not relevant to toybox.</p>
 826
 827</b></blockquote>
 828
 829<hr />
 830<a name=sash />
 831<h2>Stand-Alone Shell</h2>
 832
 833<p>Wikipedia has <a href=http://en.wikipedia.org/wiki/Stand-alone_shell>a good
 834summary of sash</a>, with links. The original Stand-Alone Shell project reached
 835a stopping point, and then <a href=http://www.baiti.net/sash>"sash plus
 836patches"</a> extended it a bit further. The result is a megabyte executable
 837that provides 40 commands.</p>
 838
 839<p>Sash is a shell with built-in commands. It doesn't have a multiplexer
 840command, meaning "sash ls -l" doesn't work (you have to go "sash -c 'ls -l'").
 841</p>
 842
 843<p>The list of commands can be obtained via building it and doing
 844"echo help | ./sash | awk '{print $1}' | sed 's/^-//' | xargs echo", which
 845gives us:</p>
 846
 847<blockquote><b>
 848alias aliasall ar cd chattr chgrp chmod chown cmp cp chroot dd echo ed exec
 849exit file find grep gunzip gzip help kill losetup losetup ln ls lsattr mkdir
 850mknod more mount mv pivot_root printenv prompt pwd quit rm rmdir setenv source
 851sum sync tar touch umask umount unalias where
 852</b></blockquote>
 853
 854<p>Plus sh because it's a shell. A dozen or so commands can only sanely be
 855implemented as shell builtins (alias aliasall cd exec exit prompt quit setenv
 856source umask unalias), and where is an alias for which.</p>
 857
 858<p>This leaves:</p>
 859
 860<blockquote><b>
 861<span id=sash_cmd>
 862chgrp chmod chown cmp cp chroot echo find grep help kill losetup
 863ln ls mkdir mknod mount mv pivot_root printenv pwd rm rmdir sync tar touch umount
 864ar chattr dd ed file gunzip gzip lsattr more sh
 865</span>
 866</b></blockquote>
 867
 868<p>(For once, this project doesn't include a fork of gzip, instead
 869it sucks in -lz from the host.)</p>
 870
 871<hr />
 872<a name=sbase />
 873<h2>sbase:</h2>
 874
 875<p>It's <a href=http://git.suckless.org/sbase>on suckless</a> in
 876<a href=http://git.suckless.org/ubase>two parts</a>. As of November 2015 it's
 877implemented the following (renaming "cron" to "crond" for
 878consistency, and yanking "sponge", "mesg", "pagesize", "respawn", and
 879"vtallow"):</p>
 880
 881<blockquote><p>
 882<span id=sbase_cmd>
 883basename cal cat chgrp chmod chown chroot cksum cmp comm cp crond cut date
 884dirname du echo env expand expr false find flock fold getconf grep head
 885hostname join kill link ln logger logname ls md5sum mkdir mkfifo mktemp mv
 886nice nl nohup od paste printenv printf pwd readlink renice rm rmdir sed seq
 887setsid sha1sum sha256sum sha512sum sleep sort split strings sync tail
 888tar tee test tftp time touch tr true tty uname unexpand uniq unlink uudecode
 889uuencode wc which xargs yes
 890</span>
 891</p></blockquote>
 892
 893<p>and<p>
 894
 895<blockquote><p>
 896<span id=sbase_cmd>
 897chvt clear dd df dmesg eject fallocate free id login mknod mountpoint
 898passwd pidof ps stat su truncate unshare uptime watch
 899who
 900</span>
 901</p></blockquote>
 902
 903<hr />
 904<a name=nash />
 905<h2>nash:</h2>
 906
 907<p>Red Hat's nash was part of its "mkinitrd" package, replacement for a shell
 908and utilities on the boot floppy back in the 1990's (the same general idea
 909as BusyBox, developed independently). Red Hat discontinued nash development
 910in 2010, replacing it with dracut (which collects together existing packages,
 911including busybox).</p>
 912
 913<p>I couldn't figure out how to beat source code out of
 914<a href=http://pkgs.fedoraproject.org/git/mkinitrd>Fedora's current git</a>
 915repository. The last release version that used it was Fedora Core 12
 916which has <a href=http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/mkinitrd-6.0.93-1.fc12.src.rpm>a source rpm</a>
 917that can be unwound with "rpm2cpio mkinitrd.src.rpm | cpio -i -d -H newc
 918--no-absolute-filenames" and in there is a mkinitrd-6.0.93.tar.bz2 which
 919has the source.</p>
 920
 921<p>In addition to being a bit like a command shell, the nash man page lists the
 922following commands:</p>
 923
 924<blockquote><p>
 925access echo find losetup mkdevices mkdir mknod mkdmnod mkrootdev mount
 926pivot_root readlink raidautorun setquiet showlabels sleep switchroot umount
 927</p></blockquote>
 928
 929<p>Oddly, the only occurrence of the string pivot_root in the nash source code
 930is in the man page, the command isn't there. (It seems to have been removed
 931when the underscoreless switchroot went in.)</p>
 932
 933<p>A more complete list seems to be the handlers[] array in nash.c:</p>
 934
 935<blockquote><p>
 936access buildEnv cat cond cp daemonize dm echo exec exit find kernelopt
 937loadDrivers loadpolicy mkchardevs mkblktab mkblkdevs mkdir mkdmnod mknod
 938mkrootdev mount netname network null plymouth hotplug killplug losetup
 939ln ls raidautorun readlink resume resolveDevice rmparts setDeviceEnv
 940setquiet setuproot showelfinterp showlabels sleep stabilized status switchroot
 941umount waitdev
 942</p></blockquote>
 943
 944<p>This list is nuts: "plymouth" is an alias for "null" which is basically
 945"true" (which the above list doesn't have). Things like buildEnv and
 946loadDrivers are bespoke Red Hat behavior that might as well be hardwired in
 947to nash's main() without being called.</p>
 948
 949<p>Instead of eliminating items
 950from the list with an explanation for each, I'm just going to cherry pick
 951a few: the device mapper (dm, raidautorun) is probably interesting,
 952hotplug (may be obsolete due to kernel changes that now load firmware
 953directly), and another "resume" ala klibc.</p>
 954
 955<p>But mostly: I don't care about this one. And neither does Red Hat anymore.</p>
 956
 957<p>Verdict: ignore</p>
 958
 959<hr />
 960<a name=beastiebox />
 961<h2>Beastiebox</h2>
 962
 963<p>Back in 2008, the BSD guys vented some busybox-envy
 964<a href=http://beastiebox.sourceforge.net>on sourceforge</a>. Then stopped.
 965Their repository is still in CVS, hasn't been touched in years, it's a giant
 966hairball of existing code sucked together. (The web page says the author
 967is aware of crunchgen, but decided to do this by hand anyway. This is not
 968a collection of new code, it's a katamari of existing code rolled up in a
 969ball.)</p>
 970
 971<p>Combining the set of commands listed on the web page with the set of
 972man pages in the source gives us:</P>
 973
 974<blockquote><p>
 975[ cat chmod cp csh date df disklabel dmesg echo ex fdisk fsck fsck_ffs getty
 976halt hostname ifconfig init kill less lesskey ln login ls lv mksh more mount
 977mount_ffs mv pfctl ping poweroff ps reboot rm route sed sh stty sysctl tar test
 978traceroute umount vi wiconfig
 979</p></blockquote>
 980
 981<p>Apparently lv is the missing link between ed and vi, copyright 1982-1997 (do
 982not want), ex is another obsolete vi mode, lesskey is "used to
 983specify a set of key bindings to be used with less", and csh is a shell they
 984sucked in (even though they have mksh?), [ is an alias for test. Several more bsd-isms that don't have Linux
 985equivalents (even in the ubuntu "install this package" search) are
 986disklabel, fsck_ffs, mount_ffs, and pfctl. And wiconfig is a
 987wavelan interface network card driver utility. Subtracting all that and the
 988commands toybox already implements at triage time, we get:</p>
 989
 990<blockquote><p>
 991<span id=beastiebox_cmd>
 992fdisk fsck getty halt ifconfig init kill less more mount mv ping poweroff
 993ps reboot route sed sh stty sysctl tar test traceroute umount vi
 994</span>
 995</p></blockquote>
 996
 997<p>Not a hugely interesting list, but eh.</p>
 998
 999<p>Verdict: ignore</p>
1000
1001<hr />
1002<a name=BsdBox />
1003<h2>BsdBox</h2>
1004
1005<p>Somebody decided to do a <a href=https://wiki.freebsd.org/AdrianChadd/BsdBox>multicall binary for freebsd</a>.</p>
1006
1007<p>They based it on crunchgen, a tool that glues existing programs together
1008into an archive and uses the name to execute the right one. It has no
1009simplification or code sharing benefits whatsoever, it's basically an
1010archiver that produces executables.</p>
1011
1012<p>That's about where I stopped reading.</p>
1013
1014<p>Verdict: ignore.</p>
1015
1016<hr />
1017<a name=slowaris />
1018<h2>OpenSolaris Busybox</h2>
1019
1020<p>Somebody <a href=http://hub.opensolaris.org/bin/view/Project+busybox/>wrote
1021a wiki page</a> saying that Busybox for OpenSolaris would be a good idea.</p>
1022
1023<p>The corresponding "files" tab is an auto-generated stub. The project never
1024even got as far as suggesting commands to include before Oracle discontinued
1025OpenSolaris.</p>
1026
1027<p>Verdict: ignore.</p>
1028
1029<hr />
1030<a name=uclinux />
1031<h2>uClinux</h2>
1032
1033<p>Long ago a hardware developer named Jeff Dionne put together a
1034nommu Linux distribution, which involved rewriting a lot of command line
1035utilities that relied on <a href=http://nommu.org/memory-faq.txt>features
1036unavailable on nommu</a> hardware.</p>
1037
1038<p>In 2003 Jeff moved to Japan and handed
1039the project off to people who allowed it to roll to a stop. The website
1040turned into a mess of 404 links, the navigation indexes stopped being
1041updated over a decade ago, and the project's CVS repository suffered a
1042hard drive failure for which there were no backups. The project continued
1043to put out "releases" through 2014 (you have to scroll down in the "news"
1044section to find them, the "HTTP download" section in the nav bar on the
1045left hasn't been updated in over a decade), which were hand-updated tarball
1046snapshots mostly consisting of software from the 1990's. For example the
10472014 release still contained ipfwadm, the package which predated ipchains,
1048which predated iptables, which is in the process of being replaced by
1049nftables.</p>
1050
1051<p>Nevertheless, people still try to use this because the project was viewed
1052as the place to discuss, develop, and learn about nommu Linux.
1053The role of uclinux.org as an educational resource kept people coming
1054to it long after it had collapsed as a Linux distro.</p>
1055
1056<p>Starting around 0.6.0 toybox began to address nommu support with the goal
1057of putting uClinux out of its misery.</p>
1058
1059<p>An analysis of <a href=http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20140504.tar.bz2>uClinux-dist-20140504</a> found 312 package
1060subdirectories under "user".</p>
1061
1062<h3>Taking out the trash</h3>
1063
1064<p>A bunch of packages (<b>inotify-tools, input-event-demon, ipsec-tools, netifd,
1065keepalived, mobile-broadband-provider-info, nuttp, readline, snort,
1066snort-barnyard, socat, sqlite, sysklogd, sysstat, tcl, ubus, uci, udev,
1067unionfs, uqmi, usb_modeswitch, usbutils, util-linux</b>)
1068are hard to evaluate because
1069uclinux has directories for them, but their source isn't actually in the
1070uclinux tree. In some of these the makefiles download a git repo during
1071the build, so I'm assuming you can build the external package if you really
1072care. (Even when I know what these packages do, I'm skipping them
1073because uclinux doesn't actually contain them, and any given snapshot
1074of the build system will bitrot as external web links change over time.)</p>
1075
1076<p>Other packages are orphaned, meaning they're not mentioned from any Kconfig
1077or Makefiles outside of their directory, so uclinux can't actually build
1078them: <b>mbus</b> is an orphaned i2c test program expecting to run in some sort
1079of hardwired hardware context, <b>mkeccbin</b> is an orphaned "ECC annotated
1080binary file" generator (meaning it's half of a flash writer),
1081<b>wsc_upnp</b> is a "Ralink WPS" driver (some sort of stale wifi chip)...</p>
1082
1083<p>The majority of the remaining packages are probably not of interest to
1084toybox due to being so obsolete or special purpose they may not actually be
1085of interest to anybody anymore. (This list also includes a lot of
1086special-purpose network back-end stuff that's hard for anybody but
1087datacenter admins to evaluate the current relevance of.)</p>
1088
1089<blockquote><b><p>
1090arj asterisk boottools bpalogin br2684ctl camserv can4linux cgi_generic
1091cgihtml clamav clamsmtp conntrack-tools cramfs crypto-tools cxxtest
1092ddns3-client de2ts-cal debug demo diald discard dnsmasq dnsmasq2
1093ethattach expat-examples ez-ipupdate fakeidentd
1094fconfig ferret flatfs flthdr freeradius freeswan frob-led frox fswcert
1095game gettyd gnugk haserl horch
1096hostap hping httptunnel ifattach ipchains
1097ipfwadm ipmasqadm ipportfw ipredir ipset iso_client
1098jamvm jffs-tools jpegview jquery-ui kendin-config kismet klaxon kmod
1099l2tpd lcd ledcmd ledcon lha lilo lirc lissa load loattach
1100lpr lrpstat lrzsz mail mbus mgetty microwin ModemManager msntp musicbox
1101nooom null openswan openvpn palmbot pam_* pcmcia-cs playrt plugdaemon pop3proxy
1102potrace qspitest quagga radauth
1103ramimage readprofile rdate readprofile routed rrdtool rtc-ds1302
1104sendip ser sethdlc setmac setserial sgutool sigs siproxd slattach
1105smtpclient snmpd net-snmp snortrules speedtouch squashfs scep sslwrap stp
1106stunnel tcpblast tcpdump tcpwrappers threaddemos tinylogin tinyproxy
1107tpt tripwire unrar unzoo version vpnled w3cam xl2tpd zebra
1108</p></b></blockquote>
1109    
1110<p>This stuff is all over the place: arj, lha, rar, and zoo are DOS archivers,
1111ethattach describes itself as just "a network tool",
1112mail is a textmode smtp mailer literally described as "Some kind of mail
1113proggy" in uclinux's kconfig (as opposed to clamsmtp and smtpclient and
1114so on), this gettyd isn't a generic version but specifically a
1115hardwired ppp dialin utility, mgetty isn't a generic version but is combined
1116with "sendfax", hostap is an intersil prism driver, wlan-ng is also an
1117intersil prism dirver, null is a program to intentionally dereference a
1118null pointer (in case you needed one), iso_client is a
1119"Demo Application for the USB Device Driver", kendin-config is
1120"for configuring the Micrel Kendin KS8995M over QSPI", speedtouch configures
1121a specific brand of asdl modem, portmap is part of Anfs,
1122ferret, linux-igd, and miniupnp are all upnp packages,
1123lanbypass "can be used to control the LAN
1124bypass switches on the Advantech x86 based hardware platforms", lcd is
1125"test of lcddma device driver" (an out-of-tree Coldfire driver apparently
1126lost to history, the uclinux linux-2.4.x directory has a config symbol for
1127it, but nothing in the code actually _uses_ it...), qspitest is another
1128coldfire thing, mii-tool-fec is
1129"strictly for the FEC Ethernet driver as implemented (and modified) for
1130the uCdimm5272", rtc-ds1302 and rtc-m41t11 are usermode drivers for specific
1131clock chips, stunnel is basically "openssl s_client -quiet -connect",
1132potrace is a bitmap to vector graphic converter, radauth performs command line
1133authentication against a radius server,
1134clamav, klaxon, ferret, l7-protocols, and nessus are very old network security
1135software (it's got a stale snapshot of nmap too), xl2tpd is a PPP over UDP
1136tunnel (rfc 2661), zebra is the package quagga replaced,
1137lilo is the x86-only bootloader that predated grub (and recently discontinued
1138development), lissa is a "framebuffer graphics demo" from
11391998, the squashfs package here is the out of tree patches for 2.4 kernels
1140and such before the filesystem was merged upstream (as opposed to the
1141squashfs-new package which is a snapshot of the userspace tool from 2011),
1142load is basically "dd file /dev/spi", version is basically "cat /proc/version",
1143microwin is a port of the WinCE graphics API to Linux, scep is a 2003
1144implementation of an IETF draft abandoned in 2010, tpt depends on
1145Andrew Morton's 15 year old unmerged "timepegs" kernel patch using the pentium
1146cycle counter, vpnled controls a light that reboots systems (what?),
1147w3cam is a video4linux 1.0 client (v4l2 showed up during 2.5 and support for
1148the old v4l1 was removed in 2.6.38 back in 2011), busybox ate tinylogin
1149over a decade ago, lrpstat is a java network monitor
1150from 2001, lrzsz is zmodem/ymodem/zmodem, msntp and stp implement rfc2030
1151meaning it overflows in 2036 (the package was last updated in 2000), rdate
1152is rfc 868 meaning it also overflows in 2036 (which is why ntp was invented
1153a few decades back), reiserfsprogs development stopped abruptly after
1154Hans Reiser was convicted of murdering his wife Nina (denying it on the
1155stand and then leading them to the body as part of his plea bargain during
1156sentencing)...
1157</p>
1158
1159<p>Seriously, there's a lot of crap in there. It's hard to analyze most
1160of it far enough to prove it _doesn't_ do anything.</p>
1161
1162<h3>Non-toybox programs</h3>
1163
1164<p>The following software may actually still do something intelligible
1165(although the package versions tend to be years out of date), but
1166it's not a direction toybox has chosen to go in.</p>
1167
1168<p>There are several programming languages (<b>bash, lua, jamvm, tinytcl,
1169perl, python</b>) in there. Maybe someone somewhere wants a 2008 release of a
1170java virtual machine tested to work on nommu systems (jamvm), but it's out
1171of scope for toybox.</p>
1172
1173<p>A bunch of benchmark programs: <b>cpu, dhrystone, mathtest, nbench, netperf,
1174netpipe, and whetstone</b>.</p>
1175
1176<p>A bunch of web servers: <b>appWeb, boa, fnord (via tcpserver), goahead, httpd,
1177mini_httpd, and thttpd</b>.</p>
1178
1179<p>A bunch of shells: <b>msh</b> is a clever (I.E. obfuscated) little shell,
1180<b>nwsh</b> is "new shell" (that's what it called itself in 1999 anyway),
1181<b>sash</b> is another shell with a bunch of builtins (ls, ps, df, cp, date, reboot,
1182and shutdown, this roadmap analyzes it <a href="#sash">elsewhere</a>),
1183<b>sh</b> is a very old minix shell fork, and <b>tcsh</b> is also a shell.</p>
1184
1185<p>Also in this category, we have:</p>
1186
1187<blockquote><b><p>
1188dropbear jffs-tools jpegview kexec-tools bind ctorrent
1189iperf iproute2 ip-sentinel iptables kexec
1190nmap oggplay openssl oprofile p7zip pppd pptp play vplay
1191hdparm mp3play at clock
1192mtd-utils mysql logrotate brcfg bridge-utils flashw
1193ebtables etherwake ethtool expect gdb gdbserver hostapd
1194lm_sensors load netflash netstat-nat
1195radvd recover rootloader resolveip rp-pppoe
1196rsyslog rsyslogd samba smbmount squashfs-new squid ssh strace tip
1197uboot-envtools ulogd usbhubctrl vconfig vixie-cron watchdogd
1198wireless_tools wpa_supplicant
1199</p></b></blockquote>
1200
1201<p>An awful lot of those are borderline: play and vplay are wav file
1202audio players, there's oprofile _and_ readprofile (which just reads kernel
1203profiling data from /proc/profile),
1204radvd is a "routr advertisement daemon" (ipv6 stateless autoconf),
1205ctorrent is a bittorent client, 
1206lm_sensors is hardware (heat?) monitoring,
1207resolveip is dig only less so,
1208rp-pppoe is ppp over ethernet,
1209ebtables is an ethernet version of iptables (for bridging),
1210their dropbear is from 2012, and that ssh version is from 2011
1211(which means it's about nine months too _old_ to have the heartbleed bug).
1212There's both ulogd and ulogd2 (no idea why), and pppd is version 2.4 but
1213there's a ppd-2.3 directory also. We used to be interested in ftpd/proftpd
1214as a way of uploading files out of a vm, but support for that has waned
1215over the years and there are lots of alternatives.</p>
1216
1217<p>Lots of flash stuff:
1218flashw is a flash writer, load is an spi flash loader, netflash writes
1219to flash via tftp,
1220recover is also a reflash daemon intended to come up when the system can't boot,
1221rootloader seems to be another reflash daemon but without dhcp.</p>
1222
1223<h3>Already in roadmap</h3>
1224
1225<p>The following packages contain commands already in the toybox roadmap:</p>
1226
1227<blockquote><b><p>
1228agetty cal cksum cron dhcpcd dhcpcd-new dhcpd dhcp-isc dosfstools e2fsprogs
1229elvis-tiny levee fdisk fileutils ftp grep hd hwclock inetd init ntp
1230iputils login module-init-tools netcat shutils ntpdate lspci ping procps
1231rsync shadow shutils stty sysutils telnet telnetd tftp tftpd traceroute
1232unzip wget mawk net-tools
1233</p></b></blockquote>
1234
1235<p>There are some duplicates in there, levee is a tiny vi implementation
1236like elvis-tiny, ntp and ntpdate overlap, etc.</p>
1237
1238<p>Verdict: We don't really need to do a whole lot special for nommu
1239systems, just get the existing toybox roadmap working on nommu and
1240we're good. The uClinux project can rest in peace.</p>
1241
1242<hr />
1243<h2>Requests:</h2>
1244
1245<p>The following additional commands have been requested (and often submitted)
1246by various users. I _really_ need to clean up this section.</p>
1247
1248<p>Also:</p>
1249<blockquote><b>
1250<span id=request>
1251dig freeramdisk getty halt hexdump hwclock klogd modprobe ping ping6 pivot_root
1252poweroff readahead rev sfdisk sudo syslogd taskset telnet telnetd tracepath
1253traceroute unzip usleep vconfig zip free login modinfo unshare netcat help w
1254iwconfig iwlist rdate
1255dos2unix unix2dos clear
1256pmap realpath setsid timeout truncate
1257mkswap swapon swapoff
1258count oneit fstype
1259acpi blkid eject pwdx
1260sulogin rfkill bootchartd
1261arp makedevs sysctl killall5 crond crontab deluser last mkpasswd watch
1262blockdev rpm2cpio arping brctl dumpleases fsck
1263tcpsvd tftpd
1264factor fallocate fsfreeze inotifyd lspci nbd-client partprobe strings
1265base32 base64 mix
1266reset hexedit nsenter shred
1267fsync insmod ionice lsmod lsusb rmmod vmstat xxd top iotop
1268lsof ionice compress dhcp dhcpd addgroup delgroup host iconv ip
1269ipcrm ipcs netstat openvt
1270deallocvt iorenice
1271udpsvd adduser
1272microcom tunctl chrt getfattr setfattr
1273kexec
1274ascii crc32 devmem fmt i2cdetect i2cdump i2cget i2cset i2ctransfer mcookie prlimit sntp ulimit uuidgen dhcp6 ipaddr iplink iproute iprule iptunnel cd exit toysh bash traceroute6
1275blkdiscard rtcwake
1276watchdog
1277pwgen readelf unicode
1278rsync
1279linux32 hd strace
1280gpiodetect gpiofind gpioget gpioinfo gpioset httpd uclampset
1281nbd-server
1282memeater
1283</span>
1284</b></blockquote>
1285
1286<hr />
1287<a name=packages />
1288<h2>Other packages</h2>
1289
1290<p>System administrators have <a href=https://github.com/landley/toybox/issues/168#issuecomment-583725500>asked</a> what other Linux packages toybox commands
1291replace, so they can annotate alternatives in their package management system.</p>
1292
1293<p>This section uses the package definitions from Chapter 6 of
1294<a href=http://www.linuxfromscratch.org/lfs/downloads/9.0/LFS-BOOK-9.0-NOCHUNKS.html>Linux From Scratch 9.0</a>). Each package lists what we currently
1295replace, pending commands [in square brackets], and what we DON'T plan to
1296implement.</p>
1297
1298<p>Each "see also" note means the listed package also installs the listed shared
1299libraries. (While toybox contains equivalent functionality to a lot of these
1300shared libraries in its lib/ directory, it does not currently provide a shared
1301library interface.)</p>
1302
1303<h3>Packages toybox plans to provide complete-ish replacements for:</h3>
1304<ul>
1305<li><b>file</b>: file (see also: libmagic)</li>
1306<li><b>m4</b>: [m4]</li>
1307<li><b>bc</b>: [bc] [dc]</li>
1308<li><b>bison</b>: [yacc] (not: bison, see also: liby)</li>
1309<li><b>flex</b>: [lex] (not: flex flex++, see also: libfl)</li>
1310<li><b>make</b>: [make]</li>
1311<li><b>sed</b>: sed</li>
1312<li><b>grep</b>: grep egrep fgrep</li>
1313<li><b>bash</b>: bash sh (not: bashbug)</li>
1314<li><b>diffutils</b>: cmp [diff] [diff3] [sdiff]</li>
1315<li><b>gawk</b>: [awk] (not: gawk gawk-5.0.1)</li>
1316<li><b>findutils</b>: find xargs (not: locate updatedb)</li>
1317<li><b>less</b>: less (not: lessecho lesskey)</li>
1318<li><b>gzip</b>: zcat [gzip] [gunzip] [zcmp] [zdiff] [zegrep] [zfgrep] [zgrep] [zless] [zmore]
1319(not: gzexe uncompress zforce znew)</li>
1320<li><b>patch</b>: patch</li>
1321<li><b>tar</b>: tar</li>
1322<li><b>procps-ng</b>: free pgrep pidof pkill ps sysctl top uptime vmstat w watch
1323[pmap] [pwdx] [slabtop]
1324(not: tload, see also libprocps)</li>
1325<li><b>sysklogd</b>: [klogd] [syslogd]</li>
1326<li><b>sysvinit</b>: [init] halt poweroff reboot killall5 [shutdown]
1327(not telinit runlevel fstab-decode bootlogd)</li>
1328<li><b>man</b>: man (but not accessdb apropos catman lexgrog mandb manpath whatis,
1329see also libman libmandb)</li>
1330<li><b>vim</b>: vi xxd (but not ex, rview, rvim, view, vim, vimdiff, vimtutor)</li>
1331<li><b>sysvinit</b>: [init] halt poweroff reboot killall5 [shutdown]
1332(not telinit runlevel fstab-decode bootlogd)</li>
1333<li><b>kmod</b>: insmod lsmod rmmod modinfo [modprobe]
1334(not: depmod kmod)</li>
1335<li><b>attr</b>: [getfattr] setfattr (not: attr, see also: libattr)</li>
1336<li><b>shadow</b>: [chfn] [chpasswd] [chsh] [groupadd] [groupdel] [groupmod]
1337[newusers] passwd [su] [useradd] [userdel] [usermod]
1338[lastlog] [login] [newgidmap] [newuidmap]
1339(not: chage expiry faillog groupmems grpck logoutd newgrp nologin pwck sg
1340vigr vipw, grpconv grpunconv pwconv pwunconv, chgpasswd gpasswd)</li>
1341<li><b>psmisc</b>: killall [fuser] [pstree] [peekfd] [prtstat]
1342(not: pslog pstree.x11)</li>
1343<li><b>inetutils</b>: dnsdomainname [ftp] hostname ifconfig ping ping6 [telnet] [tftp] [traceroute] (not: talk)</li>
1344<li><b>coreutils</b>: [ base32 base64 basename cat chgrp chmod chown chroot cksum comm cp cut date
1345dd df dirname du echo env expand factor false fmt fold groups head hostid id install
1346link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od
1347paste printenv printf pwd readlink realpath rm rmdir seq sha1sum shred
1348sleep sort split stat sync tac tail tee test timeout touch true truncate
1349tty uname uniq unlink wc who whoami yes
1350[expr] [fold] [join] [numfmt] [runcon] [sha224sum] [sha256sum] [sha384sum]
1351[sha512sum] [stty] [b2sum] [tr] [unexpand]
1352(not: basenc chcon csplit dir dircolors pathchk
1353pinky pr ptx shuf stdbuf sum tsort users vdir, see also libstdbuf)</li>
1354<li><b>util-linux</b>: blkid blockdev cal chrt dmesg eject fallocate flock hwclock
1355ionice kill logger losetup mcookie mkswap more mount mountpoint nsenter
1356pivot_root prlimit rename renice rev setsid swapoff swapon switch_root taskset
1357umount unshare uuidgen
1358[addpart] [fdisk] [findfs] [findmnt] [fsck] [fsfreeze] [fstrim] [getopt]
1359[hexdump] [linux32] [linux64] [lsblk] [lscpu] [lsns] [setarch]
1360(not: agetty blkdiscard blkzone cfdisk chcpu chmem choom col
1361colcrt colrm column ctrlaltdel delpart fdformat fincore fsck.cramfs
1362fsck.minix ipcmk ipcrm ipcs isosize last lastb ldattach look lsipc
1363lslocks lslogins lsmem mesg mkfs mkfs.bfs mkfs.cramfs mkfs.minix namei partx
1364raw readprofile resizepart rfkill rtcwake script scriptreplay
1365setterm sfdisk sulogin swaplabel ul
1366uname26 utmpdump uuidd uuidparse wall wdctl whereis wipefs
1367i386 x86_64 zramctl)</li>
1368</ul>
1369
1370<p>Commentary: toybox init doesn't do runlevels, man and vim are just the
1371relevant commands without the piles of strange overgrowth, and if you want
1372to call a toybox binary by another name you can create a symlink to a
1373symlink. If somebody really wants to argue for "gzexe" or similar, be
1374my guest, but there's a lot of obsolete crap in shadow, coreutils,
1375util-linux...</p>
1376
1377<p>No idea why LFS is installing inetutils instead of net-tools
1378(which contains arp route ifconfig mii-tool nameif netstat and rarp that
1379toybox does or might implement, and plipconfig slattach that it probably won't.)</p>
1380
1381<h3>Packages toybox plans to provide partial replacements for:</h3>
1382
1383<p>Toybox provides replacements for some binaries from these packages,
1384but there are other useful binaries which this package provides that toybox
1385currently considers out of scope for the project:</p>
1386
1387<ul>
1388<li><b>binutils</b>: strings [ar] [nm] [readelf] [size] [objcopy] [strip]
1389(not c++filt, dwp, elfedit, gprof. The following commands belong
1390in <a href=/code/qcc>qcc</a>: addr2line as ld objdump ranlib)</li>
1391<li><b>bzip2</b>: bunzip2 bzcat [bzcmp] [bzdiff] [bzegrep] [bzfgrep] [bzgrep] [bzless]
1392[bzmore] (not: bzip2, bzip2recover, see also libbz2)</li>
1393<li><b>xz</b>: [xzcat] [lzcat] [lzcmp] [lzdiff] [lzegrep] [lzfgrep] [lzgrep]
1394[lzless] [lzmadec, lzmainfo] [lzmore] [unlzma] [unxz] [xzcat]
1395[xzcmp] [xzdec] [xzdiff] [xzegrep] [xzfgrep] [xzgrep] [xzless] [xzmore]
1396(not: compression side, see also: liblzma)</li>
1397<li><b>ncurses</b>: clear reset (not: everything else, see also: libcurses)</li>
1398<li><b>e2fsprogs</b>: chattr lsattr [e2fsck] [mkfs.ext2] [mkfs.ext3]
1399[fsck.ext2] [fsck.ext3] [e2label] [resize2fs] [tune2fs]
1400(not badblocks compile_et debugfs dumpe2fse2freefrag e2image
1401e2mmpstatus e2scrub e2scrub_all e2undo e4crypt e4defrag filefrag
1402fsck.ext4 logsave mk_cmds mkfs.ext4 mklost+found)</li>
1403</ul>
1404
1405<p>Toybox provides several decompressors but compresses to a single format
1406(deflate, ala gzip/zlib). Our e2fsprogs doesn't currently plan to support
1407ext4 or defrag. The "qcc" reference is because someday an external project to glue
1408QEMU's <a href=https://git.qemu.org/?p=qemu.git;a=blob;f=tcg/README;h=bfa2e4ed246c;hb=HEAD>Tiny Code Generator</a>
1409to Fabrice Bellard's old <a href=http://landley.net/hg/tinycc>Tiny C Compiler</a>
1410making a multicall binary that does cc/ld/as for all the targets QEMU
1411supports (then use the
1412<a href=https://github.com/JuliaComputing/llvm-cbe>LLVM C Backend</a>
1413to compile LLVM itself to C for use as a modern replacement for
1414<a href=https://en.wikipedia.org/wiki/Cfront>cfront</a> to bootstrap
1415C++ code) is under consideration
1416as a successor project to toybox. Until then things like objdump -d
1417(requiring target-specific disassembly for an unbounded number of architectures)
1418are out of scope for toybox. (This means drawing the line somewhere between
1419architecture-specific support in file and strace, and including a full
1420assembler for each architecture.)</p>
1421</span>
1422
1423<h3>Packages from LFS ch6 toybox does NOT plan to replace:</h3>
1424
1425<blockquote><p><b>
1426linux-api-headers man-pages glibc zlib readline gmp mpfr mpc gcc pkg-config
1427ncurses acl libcap psmisc iana-etc libtool gdbm gperf expat perl XML::Parser
1428intltool autoconf automake gettext libelf libffi openssl python ninja meson
1429check groff grub libpipeline texinfo
1430</b></p></blockquote>
1431
1432<p>That said, we do implement our own zlib and readline replacements, and
1433presumably _could_ export them as library bindings. Plus we provide
1434our own version of a bunch of the section 1 man pages (as command help).
1435Possibly libcap and acl are interesting?</p>
1436
1437<h3>Misc</h3>
1438
1439<p>The kbd package has over a dozen commands, we only implement chvt. The
1440iproute2 package implements over a dozen commands, there's an "ip" in
1441pending but I'm not a fan (ifconfig and route and such should be extended
1442to work properly). We don't implement eudev, but toybox's maintainer
1443created busybox mdev way back when (which replaces it) and plans to do a
1444new one for toybox as soon as we work out what subset is still needed now that
1445devtmpfs is available.</p>
1446
1447<hr /><a name=todo /><h2>TODO list</h2>
1448
1449<ul>
1450<li><p>Fill out "development" command list (finish toysh, implement awk, etc.)</p></li>
1451
1452<p><li>Handle "pending" directory.
1453<ul>
1454<li>Cleanup and promote the "pending" commands used to run mkroot.</li>
1455<ul><li>Enabled by $PENDING in mkroot.sh (sh route)</li></ul>
1456
1457<li>Cleanup and promote the "pending" commands used to build mkroot.</li>
1458<ul><li>In scripts/install.sh the $PENDING list symlinked from the host $PATH
1459into "make airlock" directory (expr git tr bash sh gzip   awk bison flex make).</li></ul>
1460<li>Cleanup and promote all $PENDING commands used by android
1461<ul><li><b>grep pending Android.bp</b>
1462in <a href=https://android.googlesource.com/platform/external/toybox>their repo</a>
1463(diff expr tr brctl getfattr lsof modprobe more stty traceroute vi)</li></ul>
1464</li>
1465
1466<li>Cleanup/promote/delete remaining "pending" commands</li>
1467<ul><li>Once empty, remove toys/pending and maybe collape together other
1468directories into just toys/*.c (with "default n" meaning examples, and
1469a "posix_defconfig" target alongside macos/bsd/android).</li></ul>
1470
1471</ul></li></p>
1472
1473<li><p>Replace kconfig/ with a new implementation (menu/def/yes/no/old).</p></li>
1474
1475<p><li>Automate Linux From Scratch build.
1476<ul>
1477
1478<li>Automate the <a href=https://linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-12.0-NOCHUNKS.html>existing build</a>
1479<ul>
1480<li>create chroot directory from host (chapters 4-6)</li>
1481<li>setup/launch chroot directory (start of chapter 7)</li>
1482<li>build in chroot directory (chapters 7-10)</li>
1483</ul>
1484</li>
1485
1486<li>Add record-commands support (both inside and outside chroot)</li>
1487<li>Build host-&gt;chroot part with PATH=$PWD/airlock (moving one command over at a time)
1488<ul><li>Set up native compiler, enumerate/build/install "temp stuff" toybox
1489doesn't provide yet (make, busybox commands, etc).</li></ul>
1490</li>
1491
1492<li>Run host-&gt;chroot build under mkroot, with airlock built+packaged for
1493target (toybox, native compiler, temp stuff from busybox or "make")</li>
1494<li>Run chroot build to completion in chroot under mkroot (kernel etc smoketest)</li>
1495<li>Run chroot build outside chroot (keeping toybox at start of $PATH)
1496to prove toybox commands sufficient to build ALL packages</li>
1497<li>Package LFS build (mkroot/packages/lfs)
1498
1499<ul>
1500<li>host/chroot/target build scripts</li>
1501<li><a href=http://ftp.osuosl.org/pub/lfs/lfs-packages/>download</a> and
1502setup packages.</li>
1503<li>Note: I already did this <a href=https://github.com/landley/control-images/tree/master/images/lfs-bootstrap/mnt>long ago</a> for LFS 6.7.</li>
1504</li>
1505</ul>
1506
1507</ul></p>
1508
1509<li><p>1.0 release</p></li>
1510
1511<li><p>Tackle AOSP build.</p></li>
1512</ul>
1513
1514<!-- #include "footer.html" -->
1515
1516