about.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <html><head><title>What is toybox?</title>
  2. <!--#include file="header.html" -->
  3. <h2><a name="what" />What is toybox?</h2>
  4. <p>Toybox combines many common Linux command line utilities together into
  5. a single <a href=license.html>BSD-licensed</a> executable. It's simple, small, fast, and reasonably
  6. standards-compliant (<a href=http://opengroup.org/onlinepubs/9699919799>POSIX-2008</a> and <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0>LSB 4.1</a>).</p>
  7. <p>Toybox's main goal is to make Android
  8. <a href=http://landley.net/aboriginal/about.html#selfhost>self-hosting</a>
  9. by improving Android's command line utilities so it can
  10. build an installable Android Open Source Project image
  11. entirely from source under a stock Android system. After a talk at the 2013
  12. Embedded Linux Conference explaining this plan
  13. (<a href=http://landley.net/talks/celf-2013.txt>outline</a>,
  14. <a href=https://www.youtube.com/watch?v=SGmtP5Lg_t0>video</a>), Google
  15. <a href=https://lwn.net/Articles/629362/>merged toybox into AOSP</a> and
  16. began shipping toybox in Android Marshmallow in 2015.</p>
  17. <p>Toybox aims to provide one quarter of a theoretical "minimal native
  18. development environment", which is the simplest Linux system capable of
  19. rebuilding itself from source code and then building
  20. <a href=http://linuxfromscratch.org/lfs>Linux From Scratch</a>
  21. and the <a href=https://source.android.com>Android Open Source Project</a>
  22. under the result. In theory, this should only require four packages:
  23. 1) a set of posix-ish command line utilities,
  24. 2) a compiler<a name="1_back"></a><sup><font size=-3><a href=#1>[1]</a></font></sup>,
  25. 3) a C library, and 4) a kernel. This provides a reproducible and auditable
  26. base system, which with the addition of a few convienciences (vi, top,
  27. shell command line history...) can provide a usable interactive experience
  28. rather than just a headless build server.</p>
  29. <b><h2><a name="why" />Why is toybox?</h2></b>
  30. <p>The <a href=http://landley.net/talks/celf-2013.txt>2013 toybox talk</a>
  31. at ELC was devoted to this question, and has the following sections:</p>
  32. <ul>
  33. <li>0m29s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=0m29s>The smartphone is replacing the PC</a></li>
  34. <ul>
  35. <li>4m22s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=4m22s>Software needed to become self-hosting</a></li>
  36. <li>6m20s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=6m20s>Do we care if android or iphone wins?</a></li>
  37. </ul>
  38. <li>9m45s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=9m45s>Android not vanilla: oppose or accept?</a></li>
  39. <ul>
  40. <li>11m30s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=11m30s>Open source can't do User Interfaces</a></li>
  41. </ul>
  42. <li>15m09s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=15m09s>Android is not copyleft: oppose or accept?</a></li>
  43. <li>18m23s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=18m23s>Security issues</a></li>
  44. <li>21m15s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=21m15s>Solutions to the software problems</a></li>
  45. <ul>
  46. <li>22m55s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=22m55s>What toybox needs to be/do</a></li>
  47. <li>28m17s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=28m17s>What is toybox?</a></li>
  48. <ul>
  49. <li>28m58s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=28m58s>Why toybox started...</a></li>
  50. <li>37m50s <a href=http://www.youtube.com/watch?v=SGmtP5Lg_t0#t=37m50s>What does toybox actually implement?</a></li>
  51. </ul>
  52. </ul>
  53. </ul>
  54. <p>A more recent talk from 2019 compares
  55. <a href=https://www.youtube.com/watch?v=MkJkyMuBm3g#t=1m18s>BusyBox vs toybox</a>
  56. and explains the design decisions behind both.
  57. (A 2015 toybox talk was part of the channel
  58. <a href=https://marc.info/?l=linux-embedded&m=158159902514847&w=2>accidentally deleted</a> off youtube by the Linux Foundation,
  59. but the <a href=https://landley.net/talks/celf-2015.txt>outline</a> is
  60. still available.)</p>
  61. <b><h2><a name="context" />What context was toybox created in?</h2></b>
  62. <p>The toybox maintainer's previous minimal self-hosting system project,
  63. <a href=http://landley.net/aboriginal/about.html>Aboriginal Linux</a>,
  64. got a native development environment down to only seven packages in
  65. its 1.0 release (busybox, uClibc, gcc, binutils, make, bash, and linux)
  66. and then built Linux From Scratch under the result. That project
  67. <a href=http://landley.net/aboriginal/history.html>was the reason</a>
  68. toybox's maintainer became busybox maintainer, having done so
  69. much work to extend busybox to replace all the gnu tools in a Linux From
  70. Scratch build that the previous maintainer handed over the project (to
  71. spend more time on buildroot).</p>
  72. <p>Despite the maintainer's history with busybox, toybox is a fresh
  73. from-scratch implementation under an
  74. <a href=https://source.android.com/source/licenses.html>android-compatible</a>
  75. <a href=license.html>license</a>. Busybox predates Android, but has never
  76. shipped with Android due to the license. As long as we're starting over anyway,
  77. we can do a better job.</p>
  78. <p>Toybox's current minimal native development environment builder is a new
  79. <a href=https://github.com/landley/toybox/blob/master/scripts/mkroot.sh>tiny
  80. implementation</a> integrated into the toybox source.
  81. The "make root" target will create a simple toybox chroot
  82. (by default in the root/host directory), and adding a LINUX= argument to
  83. the make command line pointing to Linux kernel source code creates a tiny
  84. bootable system with a wrapper script to run it under the emulator
  85. <a href=https://qemu.org>qemu</a>.</p>
  86. <p>The list of commands remaining before we can build Linux From Scratch under
  87. the result (with an appropriate
  88. <a href=https://github.com/landley/toybox/blob/master/scripts/mcm-buildall.sh>compiler</a>)
  89. is tracked <a href=roadmap.html#dev_env>in
  90. the roadmap</a>, and doing so is one of the main goals for toybox's 1.0
  91. release.</p>
  92. <p>Building LFS requres fewer commands than building AOSP, which has a lot more
  93. <a href=http://source.android.com/source/initializing.html>build
  94. prerequisites</a>. In theory some of those can be built from source
  95. as external packages (we're clearly not including our own java implementation),
  96. but some early prerequisites may need to be added to bootstrap AOSP far enough
  97. to build them (such as a read-only version of "git":
  98. how does repo download the AOSP source otherwise?)
  99. <a name="2_back"></a><sup><font size=-3><a href=#2>[2]</a></font></sup></p>
  100. <b><h2><a name="status" />What commands are planned/implemented in toybox?</h2></b>
  101. <p>The current list of commands implemented by toybox is on the
  102. <a href=status.html>status page</a>, which is updated each release.
  103. There is also a <a href=roadmap.html>roadmap</a> listing all planned commands
  104. for the 1.0 release and the reasons for including them.</p>
  105. <p>In general, configuring toybox with "make defconfig" enables all the commands
  106. compete enough to be useful. Configuring "allyesconfig" enables partially
  107. implemented commands as well, along with debugging features.</p>
  108. <b><h3>Relevant Standards</h3></b>
  109. <p>Most commands are implemented according to POSIX-2008 (I.E.
  110. <a href=http://opengroup.org/onlinepubs/9699919799/idx/utilities.html>The
  111. Single Unix Specification version 4</a>) where applicable. This does not mean
  112. that toybox is implementing every SUSv4 utility: some such as SCCS and ed are
  113. obsolete, while others such as c99 are outside the scope of the project.
  114. Toybox also isn't implementing full internationalization support: it should be
  115. 8-bit clean and handle UTF-8, but otherwise we leave this to X11 and higher
  116. layers. And some things (like $CDPATH support in "cd") await a good
  117. explanation of why to bother with them. (POSIX provides an important
  118. frame of reference, but is not an infallable set of commandments to be blindly
  119. obeyed. We do try to document our deviations from it in the comment section
  120. at the start of each command under toys/posix.)</p>
  121. <p>The other major sources of commands are the Linux man pages, the
  122. Linux Standard Base, and testing the behavior of existing command
  123. implementations (although not generally looking at their
  124. source code), including the commands in Android's toolbox. SUSv4 does not
  125. include many basic commands such as "mount", "init", and "mke2fs", which are
  126. kind of nice to have.</p>
  127. <p>For more on this see the <a href=roadmap.html>roadmap</a> and
  128. <a href=design.html>design goals</a>.</p>
  129. <b><h2><a name="downloads" />Download</h2></b>
  130. <p>This project is maintained as a <a href=https://github.com/landley/toybox>git
  131. archive</a>, and also offers <a href=http://landley.net/toybox/downloads>source
  132. tarballs</a> and <a href=http://landley.net/toybox/bin>static binaries</a>
  133. of the release versions.</p>
  134. <p>The maintainer's <a href=http://landley.net/notes.html>development log</a> and the project's
  135. <a href=http://lists.landley.net/listinfo.cgi/toybox-landley.net>mailing
  136. list</a> are also good ways to track what's going on with the project.</p>
  137. <b><h2><a name="toycans" />What's the toybox logo image?</h2></b>
  138. <p>It's <a href=toycans-big.jpg>carefully stacked soda cans</a>. Specifically,
  139. it's a bunch of the original "Coke Zero" and "Pepsi One" cans, circa 2006,
  140. stacked to spell out the binary values of the ascii string "Toybox", with
  141. null terminator at the bottom. (The big picture's on it's side because
  142. the camera was held sideways to get a better shot.)</p>
  143. <p>No, it's not photoshopped, I actually had these cans until a coworker
  144. who Totally Did Not Get It <sup><font size=-3><a href=http://www.timesys.com>tm</a></font></sup> threw them out one day after I'd gone home,
  145. thinking they were recycling. (I still have two of each kind, but
  146. Pepsi One seems discontinued and Coke Zero switched its can color
  147. from black to grey, presumably in celebration. It was fun while it lasted...)</p>
  148. <b><h2>Footnotes</h2></b>
  149. <p><a name="1" /><a href="#1_back">[1]</a> Ok, most toolchains (gcc, llvm, pcc, libfirm...)
  150. are multiple packages, but the maintainer of toybox used to maintain a
  151. <a href=http://landley.net/tinycc>fork of tinycc</a> (an integrated
  152. compiler/assembler/linker which once upon a
  153. time did <a href=http://bellard.org/tcc/tccboot.html>build a bootable linux
  154. kernel</a> before its original developer abandoned the project),
  155. and has <a href=http://landley.net/hg/qcc/file/tip/todo/todo.txt>vague plans</a> of <a href=http://landley.net/qcc>trying
  156. again someday</a>. The compiler toolchain is _conceptually_ one package,
  157. implementable as a single multicall binary acting like make, cc, as, ld, cpp,
  158. strip, readelf, nm, objdump, and so on as necessary. It's just the existing
  159. packages that do this <strike>kinda suck</strike> don't. (In theory "make"
  160. belongs in qcc, in practice llvm hasn't got its own make so toybox probably
  161. needs to add it after 1.0 to eliminate another gpl build prerequite from
  162. AOSP.)</p>
  163. <p><a name="2" /><a href="#2_back">[2]</a>
  164. The dividing line is
  165. "Is there an acceptably licensed version Android can ship, or do we have
  166. to write one?" Since android is not "GNU/Linux" in any way, we need to
  167. clean out all traces of gnu software from its build to get a clean
  168. self-hosting system.</p>
  169. <!--#include file="footer.html" -->