faq.html 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. <html><head><title>toybox FAQ</title>
  2. <!--#include file="header.html" -->
  3. <h1>Frequently Asked Questions</h1>
  4. <h2>General Questions</h2>
  5. <ul>
  6. <li><h2><a href="#why_toybox">Why toybox? (What was wrong with busybox?)</a></h2></li>
  7. <li><h2><a href="#capitalize">Do you capitalize toybox?</a></h2></li>
  8. <li><h2><a href="#support_horizon">Why a 7 year support horizon?</a></h2></li>
  9. <li><h2><a href="#releases">Why time based releases?</a></h2></li>
  10. <li><h2><a href="#code">Where do I start understanding the toybox source code?</a></h2></li>
  11. <li><h2><a href="#when">When were historical toybox versions released?</a></h2></li>
  12. <li><h2><a href="#bugs">Where do I report bugs?</a></h2></li>
  13. <li><h2><a href="#b_links">What are those /b/number links in the git log?</a></h2></li>
  14. <li><h2><a href="#opensource">What is the relationship between toybox and android?</a></h2></li>
  15. <li><h2><a href="#backporting">Will you backport fixes to old versions?</a></h2></li>
  16. <li><h2><a href="#dotslash">What's this ./ on the front of commands in your examples?</a></h2></li>
  17. </ul>
  18. <h2>Using toybox</h2>
  19. <ul>
  20. <!-- get binaries -->
  21. <li><h2><a href="#install">How do I install toybox?</h2></li>
  22. <li><h2><a href="#cross">How do I cross compile toybox?</h2></li>
  23. <li><h2><a href="#targets">What architectures does toybox support?</li>
  24. <li><h2><a href="#system">What part of Linux/Android does toybox provide?</h2></li>
  25. <li><h2><a href="#mkroot">How do I build a working Linux system with toybox?</a></h2></li>
  26. </ul>
  27. <hr /><h2><a name="why_toybox" />Q: "Why is there toybox? What was wrong with busybox?"</h2>
  28. <p>A: Toybox started back in 2006 when I (Rob Landley)
  29. <a href=https://lwn.net/Articles/202106/>handed off BusyBox maintainership</a>
  30. and <a href=http://landley.net/notes-2006.html#28-09-2006>started over from
  31. scratch</a> on a new codebase after a
  32. <a href=http://lists.busybox.net/pipermail/busybox/2006-September/058617.html>protracted licensing argument</a> took all the fun out of working on BusyBox.</p>
  33. <p>Toybox was just a personal project until it got
  34. <a href=http://landley.net/notes-2011.html#13-11-2011>relaunched</a>
  35. in November 2011 with a new goal to make Android
  36. <a href=http://landley.net/aboriginal/about.html#selfhost>self-hosting</a>.
  37. This involved me relicensing my own
  38. code, which made people who had never used or participated in the project
  39. <a href=https://lwn.net/Articles/478308/>loudly angry</a>. The switch came
  40. after a lot of thinking <a href=http://landley.net/talks/ohio-2013.txt>about
  41. licenses</a> and <a href=http://landley.net/notes-2011.html#21-03-2011>the
  42. transition to smartphones</a>, which led to a
  43. <a href=https://www.youtube.com/watch?v=SGmtP5Lg_t0>2013 talk</a> laying
  44. out a
  45. <a href=http://landley.net/talks/celf-2013.txt>strategy</a>
  46. to make Android self-hosting using toybox. This helped
  47. <a href=https://code.google.com/p/android/issues/detail?id=76861>bring
  48. it to Android's attention</a>, and they
  49. <a href=https://lwn.net/Articles/629362/>merged it</a> into Android M.</p>
  50. <p>The unfixable problem with busybox was licensing: BusyBox predates Android
  51. by almost a decade, but Android still doesn't ship with it because GPLv3 came
  52. out around the same time Android did and caused many people to throw
  53. out the GPLv2 baby with the GPLv3 bathwater.
  54. Android <a href=https://source.android.com/source/licenses.html>explicitly
  55. discourages</a> use of GPL and LGPL licenses in its products, and has gradually
  56. reimplemented historical GPL components (such as its bluetooth stack) under the
  57. Apache license. Apple's
  58. <a href=http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/>less subtle</a> response was to freeze xcode at the last GPLv2 releases
  59. (GCC 4.2.1 with binutils 2.17) for over 5 years while sponsoring the
  60. development of new projects (clang/llvm/lld) to replace them,
  61. implementing a
  62. <a href=https://www.osnews.com/story/24572/apple-ditches-samba-in-favour-of-homegrown-replacement/>new SMB server</a> from scratch to
  63. <a href=https://archive.org/details/copyleftconf2020-allison>replace samba</a>,
  64. switching <a href=https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features>bash with zsh</a>, and so on.
  65. Toybox itself exists because somebody in a legacy position
  66. just wouldn't shut up about GPLv3, otherwise I would probably
  67. still happily be maintaining BusyBox. (For more on how I wound
  68. up working on busybox in the first place,
  69. <a href=http://landley.net/aboriginal/history.html>see here</a>.)</p>
  70. <hr /><h2><a name="capitalize" />Q: Do you capitalize toybox?</h2>
  71. <p>A: Only at the start of a sentence. The command name is all lower case so
  72. it seems silly to capitalize the project name, but not capitalizing the
  73. start of sentences is awkward, so... compromise. (It is _not_ "ToyBox".)</p>
  74. <hr /><h2><a name="support_horizon">Q: Why a 7 year support horizon?</a></h2>
  75. <p>A: Our <a href=http://lists.busybox.net/pipermail/busybox/2006-September/058440.html>longstanding rule of thumb</a> is to try to run and build on
  76. hardware and distributions released up to 7 years ago, and feel ok dropping
  77. support for stuff older than that. (This is a little longer than Ubuntu's
  78. Long Term Support, but not by much.)</p>
  79. <p>My original theory was "4 to 5 of the 18-month cycles of moore's law should cover
  80. the vast majority of the installed base of PC hardware", loosely based on some
  81. research I did <a href=http://www.catb.org/esr/halloween/halloween9.html#id2867629>back in 2003</a>
  82. and <a href=http://catb.org/esr/writings/world-domination/world-domination-201.html#id248066>updated in 2006</a>
  83. which said that low end systems were 2 iterations of moore's
  84. law below the high end systems, and that another 2-3 iterations should cover
  85. the useful lifetime of most systems no longer being sold but still in use and
  86. potentially being upgraded to new software releases.</p>
  87. <p>That analysis missed <a href=http://landley.net/notes-2011.html#26-06-2011>industry
  88. changes</a> in the 1990's that stretched the gap
  89. from low end to high end from 2 cycles to 4 cycles, and ignored
  90. <a href=https://landley.net/notes-2010.html#09-10-2010>the switch</a> from PC to smartphone cutting off the R&D air supply of the
  91. laptop market. Meanwhile the Moore's Law <a href=https://en.wikipedia.org/wiki/Logistic_function>s-curve</a> started bending back down (as they
  92. <a href=https://en.wikipedia.org/wiki/Diffusion_of_innovations>always do</a>)
  93. back in 2000, and these days is pretty flat: the drive for faster clock
  94. speeds <a href=http://www.anandtech.com/show/613>stumbled</a>
  95. and <a href=http://www.pcworld.com/article/118603/article.html>died</a>, with
  96. the subsequent drive to go "wide" maxing out for most applications
  97. around 4x SMP with maybe 2 megabyte caches. These days the switch from exponential to
  98. linear growth in hardware capabilities is
  99. <a href=https://www.cnet.com/news/end-of-moores-law-its-not-just-about-physics/>common knowledge</a> and
  100. <a href=http://www.acm.org/articles/people-of-acm/2016/david-patterson>widely
  101. accepted</a>.</p>
  102. <p>But the 7 year rule of thumb stuck around anyway: if a kernel or libc
  103. feature is less than 7 years old, I try to have a build-time configure test
  104. for it to let the functionality cleanly drop out. I also keep old Ubuntu
  105. images around in VMs to perform the occasional defconfig build there to
  106. see what breaks. (I'm not perfect about this, but I accept bug reports.)</p>
  107. <hr /><h2><a name="releases" />Q: Why time based releases?</h2>
  108. <p>A: Toybox targets quarterly releases (a similar schedule to the Linux
  109. kernel) because Martin Michlmayr's excellent
  110. <a href=http://www.youtube.com/watch?v=IKsQsxubuAA>talk on the
  111. subject</a> was convincing. This is actually two questions, "why have
  112. releases" and "why schedule them".</p>
  113. <p>Releases provide synchronization points where the developers certify
  114. "it worked for me". Each release is a known version with predictable behavior,
  115. and right or wrong at least everyone should be seeing
  116. similar results so might be able to google an unexpected outcome.
  117. Releases focus end-user testing on specific versions
  118. where issues can be reproduced, diagnosed, and fixed.
  119. Releases also force the developers to do periodic tidying, packaging,
  120. documentation review, finish up partially implemented features languishing
  121. in their private trees, and give regular checkpoints to measure progress.</p>
  122. <p>Changes accumulate over time: different feature sets, data formats,
  123. control knobs... Toybox's switch from "ls -q" to "ls -b" as the default output
  124. format was not-a-bug-it's-a "design improvement", but the
  125. difference is academic if the change breaks somebody's script.
  126. Releases give you the option to schedule upgrades as maintenance, not to rock
  127. the boat just now, and use a known working release version until later.</p>
  128. <p>The counter-argument is that "continuous integration"
  129. can be made robust with sufficient automated testing. But like the
  130. <a href=https://web.archive.org/web/20131123071427/http://www.shirky.com/weblog/2013/11/healthcare-gov-and-the-gulf-between-planning-and-reality/>waterfall method</a>, this places insufficent
  131. emphasis on end-user feedback and learning from real world experience.
  132. Developer testing is either testing that the code does what the developers
  133. expect given known inputs running in an established environment, or it's
  134. regression testing against bugs previously found in the field. No plan
  135. survives contact with the enemy, and technology always breaks once it
  136. leaves the lab and encounters real world data and use cases in new
  137. runtime and build environments.</p>
  138. <p>The best way to give new users a reasonable first experience is to point
  139. them at specific stable versions where development quiesced and
  140. extra testing occurred. There will still be teething troubles, but multiple
  141. people experiencing the _same_ teething troubles can potentially
  142. help each other out.</p>
  143. <p>Releases on a schedule are better than releases "when it's ready" for
  144. the same reason a regularly scheduled bus beats one that leaves when it's
  145. "full enough": the schedule lets its users make plans. Even if the bus leaves
  146. empty you know when the next one arrives so missing this one isn't a disaster.
  147. and starting the engine to leave doesn't provoke a last-minute rush of nearby
  148. not-quite-ready passengers racing to catch it causing further delay and
  149. repeated start/stop cycles as it ALMOST leaves.
  150. (The video in the first paragraph goes into much greater detail.)</p>
  151. <hr /><h2><a name="code" />Q: Where do I start understanding the source code?</h2>
  152. <p>A: Toybox is written in C. There are longer writeups of the
  153. <a href=design.html>design ideas</a> and a <a href=code.html>code walkthrough</a>,
  154. and the <a href=about.html>about page</a> summarizes what we're trying to
  155. accomplish, but here's a quick start:</p>
  156. <p>Toybox uses the standard three stage configure/make/install
  157. <a href=code.html#building>build</a>, in this case "<b>make defconfig;
  158. make; make install</b>". Type "<b>make help</b>" to
  159. see available make targets.</p>
  160. <p><u>The configure stage</u> is copied from the Linux kernel (in the "kconfig"
  161. directory), and saves your selections in the file ".config" at the top
  162. level. The "<b>make defconfig</b>" target selects the
  163. maximum sane configuration (enabling all the commands and features that
  164. aren't unfinished, or only intended as examples, or debug code...) and is
  165. probably what you want. You can use "<b>make menuconfig</b>" to manually select
  166. specific commands to include, through an interactive menu (cursor up and
  167. down, enter to descend into a sub-menu, space to select an entry, ? to see
  168. an entry's help text, esc to exit). The menuconfig help text is the
  169. same as the command's "<b>--help</b>" output.</p>
  170. <p><u>The "make" stage</u> creates a toybox binary (which is stripped, look in
  171. generated/unstripped for the debug versions), and "<b>make install</b>" adds a bunch of
  172. symlinks to toybox under the various command names. Toybox determines which
  173. command to run based on the filename, or you can use the "toybox" name in which case the first
  174. argument is the command to run (ala "toybox ls -l").</p>
  175. <p><u>You can also build
  176. individual commands as standalone executables</u>, ala "make sed cat ls".
  177. The "make change" target builds all of them, as in "change for a $20".</p>
  178. <p><u>The main() function is in main.c</u> at the top level,
  179. along with setup plumbing and selecting which command to run this time.
  180. The function toybox_main() in the same file implements the "toybox"
  181. multiplexer command that lists and selects the other commands.</p>
  182. <p><u>The individual command implementations are under "toys"</u>, and are grouped
  183. into categories (mostly based on which standard they come from, posix, lsb,
  184. android...) The "pending" directory contains unfinished commands, and the
  185. "examples" directory contains example code that aren't really useful commands.
  186. Commands in those two directories
  187. are _not_ selected by defconfig. (Most of the files in the pending directory
  188. are third party submissions that have not yet undergone
  189. <a href=cleanup.html>proper code review</a>.)</p>
  190. <p><u>Common infrastructure shared between commands is under "lib"</u>. Most
  191. commands call lib/args.c to parse their command line arguments before calling
  192. the command's own main() function, which uses the option string in
  193. the command's NEWTOY() macro. This is similar to the libc function getopt(),
  194. but more powerful, and is documented at the top of lib/args.c. A NULL option
  195. string prevents this code from being called for that command.</p>
  196. <p><u>The build/install infrastructure is shell scripts under
  197. "scripts"</u> (starting with scripts/make.sh and scripts/install.sh).
  198. <u>These populate the "generated" directory</u> with headers
  199. created from other files, which are <a href=code.html#generated>described</a>
  200. in the code walkthrough. All the
  201. build's temporary files live under generated, including the .o files built
  202. from the .c files (in generated/obj). The "make clean" target deletes that
  203. directory. ("make distclean" also deletes your .config and deletes the
  204. kconfig binaries that process .config.)</p>
  205. <p><u>Each command's .c file contains all the information for that command</u>, so
  206. adding a command to toybox means adding a single file under "toys".
  207. Usually you <a href=code.html#adding>start a new command</a> by copying an
  208. existing command file to a new filename
  209. (toys/examples/hello.c, toys/examples/skeleton.c, toys/posix/cat.c,
  210. and toys/posix/true.c have all been used for this purpose) and then replacing
  211. all instances of its old name with the new name (which should match the
  212. new filename), and modifying the help text, argument string, and what the
  213. code does. You might have to "make distclean" before your new command
  214. shows up in defconfig or menuconfig.</p>
  215. <p><u>The toybox test suite lives in the "tests" directory</u>, and is
  216. driven by scripts/test.sh and scripts/runtest.sh. From the top
  217. level you can "make tests" to test everything, or "make test_sed" to test a
  218. single command's standalone version (which should behave identically,
  219. but that's why we test). You can set TEST_HOST=1 to test the host version
  220. instead of the toybox version (in theory they should work the same),
  221. and VERBOSE=all to see diffs of the expected and actual output for all
  222. failing tests. The default VERBOSE=fail stops at the first such failure.</p>
  223. <hr /><h2><a name="when" />Q: When were historical toybox versions released?</h2>
  224. <p>A: For vanilla releases, check the
  225. <a href=https://github.com/landley/toybox/tags>date on the commit tag</a>
  226. or <a href=https://landley.net/toybox/downloads/binaries/>the
  227. example binaries</a> against the output of "toybox --version".
  228. Between releases the --version
  229. information is in "git describe --tags" format with "tag-count-hash" showing the
  230. most recent commit tag, the number of commits since that tag, and
  231. the hash of the current commit.</p>
  232. <p>Android makes its own releases on its own
  233. <a href=https://en.wikipedia.org/wiki/Android_version_history>schedule</a>
  234. using its own version tags, but lists corresponding upstream toybox release
  235. versions <a href=https://android.googlesource.com/platform/system/core/+/master/shell_and_utilities/README.md>here</a>. For more detail you can look up
  236. <a href=https://android.googlesource.com/platform/external/toybox/+refs>AOSP's
  237. git tags</a>. (The <a href=https://source.android.com/setup/start>Android Open Source Project</a> is the "upstream" android vendors
  238. start form when making their own releases. Google's phones run AOSP versions
  239. verbatim, other vendors tend to take those releases as starting points to
  240. modify.)</p>
  241. <p>If you want to find the vanilla toybox commit corresponding to an AOSP
  242. toybox version, find the most recent commit in the android log that isn't from a
  243. @google or @android address and search for it in the vanilla commit log.
  244. (The timestamp should match but the hash will differ,
  245. because each git hash includes the previous
  246. git hash in the data used to generate it so all later commits have a different
  247. hash if any of the tree's history differs; yes Linus Torvalds published 3 years
  248. before Satoshi Nakamoto.) Once you've identified the vanilla commit's hash,
  249. "git describe --tags $HASH" in the vanilla tree should give you the --version
  250. info for that one.</p>
  251. <hr /><h2><a name="bugs" />Q: Where do I report bugs?</h2>
  252. <p>A: Ideally on the <a href=http://lists.landley.net/listinfo.cgi/toybox-landley.net>mailing list</a>, although <a href=mailto:rob@landley.net>emailing the
  253. maintainer</a> is a popular if slightly less reliable alternative.
  254. Issues submitted to <a href=https://github.com/landley/toybox>github</a>
  255. are generally dealt with less promptly, but mostly get done eventually.
  256. AOSP has its <a href=https://source.android.com/setup/contribute/report-bugs>own bug reporting mechanism</a> (although for toybox they usually forward them
  257. to the mailing list) and Android vendors usually forward them to AOSP which
  258. forwards them to the list.</p>
  259. <p>Note that if we can't reproduce a bug, we probably can't fix it.
  260. Not only does this mean providing enough information for us to see the
  261. behavior ourselves, but ideally doing so in a reasonably current version.
  262. The older it is the greater the chance somebody else found and fixed it
  263. already, so the more out of date the version you're reporting a bug against
  264. the less effort we're going to put into reproducing the problem.</p>
  265. <hr /><h2><a name="b_links" />Q: What are those /b/number bug report
  266. links in the git log?</h2>
  267. <p>A: It's a Google thing. Replace /b/$NUMBER with
  268. https://issuetracker.google.com/$NUMBER to read it outside the googleplex.</p>
  269. <hr /><a name="opensource" /><h2>Q: What is the relationship between toybox and android?</h2>
  270. <p>A: The <a href=about.html>about page</a> tries to explain that,
  271. and Linux Weekly News has covered toybox's history a
  272. <a href=https://lwn.net/Articles/202106/>little</a>
  273. <a href=https://lwn.net/Articles/478308/>over</a>
  274. <a href=https://lwn.net/Articles/616272/>the</a>
  275. <a href=https://lwn.net/Articles/629362/>years</a>.</p>
  276. <p>Toybox is a traditional open source project created and maintained
  277. by hobbyist (volunteer) developers, originally for Linux but these days
  278. also running on Android, BSD, and MacOS. The project started in 2006
  279. and its original author (Rob Landley)
  280. continues to maintain the open source project.</p>
  281. <p>Android's base OS maintainer (Elliott Hughes, I.E. enh)
  282. <a href=https://github.com/landley/toybox/commit/69a9f257234a>ported</a>
  283. <a href=https://github.com/landley/toybox/commit/6a29bb1ebe62>toybox</a>
  284. to Android in 2014, merged it into Android M (Marshmallow), and remains
  285. Android's toybox maintainer. (He explained it in his own words in
  286. <a href=http://androidbackstage.blogspot.com/2016/07/episode-53-adb-on-adb.html>this podcast</a>, starting either 18 or 20 minutes in depending how
  287. much backstory you want.)</p>
  288. <p>Android's policy for toybox development is to push patches to the
  289. open source project (submitting them via the mailing list) then
  290. "git pull" the public tree into Android's tree. To avoid merge conflicts, Android's
  291. tree doesn't change any of the existing toybox files but instead adds <a href=https://android.googlesource.com/platform/external/toybox/+/refs/heads/master/Android.bp>parallel
  292. build infrastructure</a> off to one side. (Toybox uses a make wrapper around bash
  293. scripts, AOSP builds with soong/ninja instead and checks in a snapshot of the
  294. generated/ directory to avoid running kconfig each build).
  295. Android's changes to toybox going into the open source tree first
  296. and being pulled from there into Android keeps the two trees in
  297. sync, and makes sure each change undergoes full open source design review
  298. and discussion.</p>
  299. <p>Rob acknowledges Android is by far the largest userbase for the project,
  300. but develops on a standard 64-bit Linux+glibc distro while building embedded
  301. 32-bit big-endian nommu musl systems requiring proper data alignment for work,
  302. and is not a Google employee so does not have access
  303. to the Google build cluster of powerful machines capable of running the full
  304. AOSP build in a reasonable amount of time. Rob is working to get android
  305. building under android (the list of toybox tools Android's build uses is
  306. <a href=https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/heads/master/path/linux-x86/>here</a>,
  307. and what else it needs from its build environment is
  308. <a href=https://android.googlesource.com/platform/build/soong/+/refs/heads/master/ui/build/paths/config.go>here</a>), and he hopes someday to not only make a usable development
  309. environment out of it but also nudge the base OS towards a more granular
  310. package management system allowing you to upgrade things like toybox without
  311. a complete reinstall and reboot, plus the introduction of a "posix container"
  312. within which you can not only run builds, but selinux lets you run binaries
  313. you've just built). In the meantime, Rob tests static bionic
  314. builds via the Android NDK when he remembers, but has limited time to work
  315. on toybox because it's not his day job. (The products his company makes ship
  316. toybox and they do sponsor the project's development, but it's one of many
  317. responsibilities at work.)</p>
  318. <p>Elliott is the Android base OS maintainer, in which role he manages
  319. a team of engineers. He also has limited time for toybox, both because it's one
  320. of many packages he's responsible for (he maintains bionic, used to maintain
  321. dalvik...) and because he allowed himself to be promoted into management
  322. and thus spends less time coding than he does sitting in meetings where testers
  323. talk to security people about vendor issues.</p>
  324. <p>Android has many other coders and security people who submit the occasional
  325. toybox patch, but of the last 1000 commits at the <a href=https://github.com/landley/toybox/commit/88b34c4bd3f8>time
  326. of writing</a> this FAQ entry, Elliott submitted 276 and all other google.com
  327. or android.com addresses combined totaled 17. (Rob submitted 591, leaving
  328. 116 from other sources, but for both Rob and Elliott there's a lot of "somebody
  329. else pointed out an issue, and then we wrote a patch". A lot of patches
  330. from both "Author:" lines thank someone else for the suggestion in the
  331. commit comment.)</p>
  332. <hr /><a name="backporting" /><h2>Q: Will you backport fixes to old versions?</h2>
  333. <p>A: Probably not. The easiest thing to do is get your issue fixed upstream
  334. in the current release, then get the newest version of the
  335. project built and running in the old environment.</p>
  336. <p>Backporting fixes generally isn't something open source projects run by
  337. volunteer developers do because the goal of the project's development community
  338. is to extend and improve the project. We're happy to respond to our users'
  339. needs, but if you're coming to the us for free tech support we're going
  340. to ask you to upgrade to a current version before we try to diagnose your
  341. problem.</p>
  342. <p>The volunteers are happy to fix any bugs you point out in the current
  343. versions because doing so helps everybody and makes the project better. We
  344. want to make the current version work for you. But diagnosing, debugging, and
  345. backporting fixes to old versions doesn't help anybody but you, so isn't
  346. something we do for free. The cost of volunteer tech support is using a
  347. reasonably current version of the project.</p>
  348. <p>If you're using an old version built with an old
  349. compiler on an old OS (kernel and libc), there's a fairly large chance
  350. whatever problem you're
  351. seeing already got fixed, and to get that fix all you have to do is upgrade
  352. to a newer version. Diagnosing a problem that wasn't our bug means we spent
  353. time that only helps you, without improving the project.
  354. If you don't at least _try_ a current version, you're asking us for free
  355. personalized tech support.</p>
  356. <p>Reproducing bugs in current versions also makes our job easier.
  357. The further back in time
  358. you are, the more work it is for us digging back in the history to figure
  359. out what we hadn't done yet in your version. If spot a problem in a git
  360. build pulled 3 days ago, it's obvious what changed and easy to fix or back out.
  361. If you ask about the current release version 3 months after it came out,
  362. we may have to think a while to remember what we did and there are a number of
  363. possible culprits, but it's still tractable. If you ask about 3 year old
  364. code, we have to reconstruct the history and the problem could be anything,
  365. there's a lot more ground to cover and we haven't seen it in a while.</p>
  366. <p>As a rule of thumb, volunteers will generally answer polite questions about
  367. a given version for about three years after its release before it's so old
  368. we don't remember the answer off the top of our head. And if you want us to
  369. put any _effort_ into tracking it down, we want you to put in a little effort
  370. of your own by confirming it's still a problem with the current version
  371. (I.E. we didn't fix it already). It's
  372. also hard for us to fix a problem of yours if we can't reproduce it because
  373. we don't have any systems running an environment that old.</p>
  374. <p>If you don't want to upgrade, you have the complete source code and thus
  375. the ability to fix it yourself, or can hire a consultant to do it for you. If
  376. you got your version from a vendor who still supports the older version, they
  377. can help you. But there are limits as to what volunteers will feel obliged to
  378. do for you.</p>
  379. <p>Commercial companies have different incentives. Your OS vendor, or
  380. hardware vendor for preinstalled systems, may have their own bug reporting
  381. mechanism and update channel providing backported fixes. And a paid consultant
  382. will happily set up a special environment just to reproduce your problem.</p>
  383. <hr /><h2><a name="install" />Q: How do I install toybox?</h2>
  384. <p>A:
  385. Multicall binaries like toybox behave differently based on the filename
  386. used to call them, so if you "mv toybox ls; ./ls -l" it acts like ls. Creating
  387. symlinks or hardlinks and adding them to the $PATH lets you run the
  388. commands normally by name, so that's probably what you want to do.</p>
  389. <p>If you already have a <a href=https://landley.net/toybox/downloads/binaries/>toybox binary</a>
  390. you can install a tree of command symlinks to
  391. <a href=http://git.musl-libc.org/cgit/musl/tree/include/paths.h>the
  392. standard path</a>
  393. locations (<b>export PATH=/bin:/usr/bin:/sbin:/usr/sbin</b>) by doing:</p>
  394. <blockquote><p><b>for i in $(/bin/toybox --long); do ln -s /bin/toybox $i; done</b></p></blockquote>
  395. <p>Or you can install all the symlinks in the same directory as the toybox binary
  396. (<b>export PATH="$PWD:$PATH"</b>) via:</p>
  397. <blockquote><p><b>for i in $(./toybox); do ln -s toybox $i; done</b></p></blockquote></p>
  398. <p>When building from source, use the "<b>make install</b>" and
  399. "<b>make install_flat</b>"
  400. targets with an appropriate <b>PREFIX=/target/path</b> either
  401. exported or on the make command line. When cross compiling,
  402. "<b>make list</b>" outputs the command names enabled by defconfig.
  403. For more information, see "<b>make help</b>".</p>
  404. <p>The command name "toybox" takes the second argument as the name of the
  405. command to run, so "./toybox ls -l" also behaves like ls. The "toybox"
  406. name is special in that it can have a suffix (toybox-i686 or toybox-1.2.3)
  407. and still be recognized, so you can have multiple versions of toybox in the
  408. same directory.</p>
  409. <p>When toybox doesn't recognize its
  410. filename as a command, it dereferences one
  411. level of symlink. So if your script needs "gsed" you can "ln -s sed gsed",
  412. then when you run "gsed" toybox knows how to be "sed".</p>
  413. <hr /><h2><a name="dotslash" />Q: What's this ./ on the front of commands in your examples?</h2>
  414. <p>A: When you don't give a path to a command's executable file,
  415. linux command shells search the directories listed in the $PATH envionment
  416. variable (in order), which usually doesn't include the current directory
  417. for security reasons. The
  418. magic name "." indicates the current directory (the same way ".." means
  419. the parent directory and starting with "/" means the root directory)
  420. so "./file" gives a path to the executable file, and thus runs a command
  421. out of the current directory where just typing "file" won't find it.
  422. For historical reasons PATH is colon-separated, and treats an
  423. empty entry (including leading/trailing colon) as "check the current
  424. directory", so if you WANT to add the current directory to PATH you
  425. can PATH="$PATH:" but doing so is a TERRIBLE idea.</p>
  426. <p>Toybox's shell (toysh) checks for built-in commands before looking at the
  427. $PATH (using the standard "bash builtin" logic just with lots more builtins),
  428. so "ls" doesn't have to exist in your filesystem for toybox to find it. When
  429. you give a path to a command the shell won't run the built-in version
  430. but will run the file at that location. (But the multiplexer command
  431. won't: "toybox /bin/ls" runs the built-in ls, you can't point it at an
  432. arbitrary file out of the filesystem and have it run that. You could
  433. "toybox nice /bin/ls" though.)</p>
  434. <hr /><h2><a name="standalone" />Q: How do I make individual/standalone toybox command binaries?</h2>
  435. <p>After running the configure step (generally "make defconfig")
  436. you can "make list" to see available command names you can use as build
  437. targets to build just that command
  438. (ala "make sed"). Commands built this way do not contain a multiplexer and
  439. don't care what the command filename is.</p>
  440. <p>The "make change" target (as in change for a $20) builds every command
  441. standalone (in the "change" subdirectory). Note that this is collectively
  442. about 10 times as large as the multiplexer version, both in disk space and
  443. runtime memory. (Even more when statically linked.)</p>
  444. <hr /><h2><a name="cross" />Q: How do I cross compile toybox?</h2>
  445. <p>A: You need a compiler "toolchain" capable of producing binaries that
  446. run on your target. A toolchain is an
  447. integrated suite of compiler, assembler, and linker, plus the standard
  448. headers and
  449. libraries necessary to build C programs. (And a few miscellaneous binaries like
  450. nm and objdump that display info about <a href=https://en.wikipedia.org/wiki/Executable_and_Linkable_Format>ELF files</a>.)</p>
  451. <p>Toybox supports the standard $CROSS_COMPILE prefix environnment variable,
  452. same as the Linux kernel build uses. This is used to prefix all the tools
  453. (target-cc, target-ld, target-strip) during the build, meaning the prefix
  454. usually ends with a "-" that's easy to forget but kind of important
  455. ("target-cc" and "targetcc" are not the same name).</p>
  456. <p>You can either provide a
  457. full path in the CROSS_COMPILE string, or add the appropriate bin directory
  458. to your $PATH. I.E:</p>
  459. <blockquote>
  460. <b><p>make LDFLAGS=--static CROSS_COMPILE=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin/m68k-linux-musl- distclean defconfig toybox</p></b>
  461. </blockquote>
  462. <p>Is equivalent to:</p>
  463. <blockquote><b><p>
  464. export "PATH=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin:$PATH"<br />
  465. LDFLAGS=--static CROSS_COMPILE=m68k-linux-musl- make distclean defconfig toybox
  466. </p></b></blockquote>
  467. <p>(Both of those examples use static linking so you can install just
  468. the single file to target, or test them with "qemu-m68k toybox". Feel free
  469. to dynamically link instead if you prefer, mkroot offers a "dynamic"
  470. add-on to copy the compiler's shared libraries into the new root
  471. filesystem.)</p>
  472. <p>Toybox's <a href=#mkroot>system builder</a> can use a simpler $CROSS
  473. variable to specify the target(s) to build for if you've installed
  474. <a href=#cross2>compatible</a> cross compilers under the "ccc" directory.
  475. Behind the scenes this uses wildcard expansion to set $CROSS_COMPILER to
  476. an appropriate path/prefix-.</p>
  477. <hr /><h2><a name="targets">Q: What architectures does toybox support?</h2>
  478. <p>Toybox runs on 64 bit and 32 bit processors, little endian and big endian,
  479. tries to respect alignment, and will enable nommu support when fork() is
  480. unavailable (or when TOYBOX_FORCE_NOMMU is enabled in the config to
  481. work around broken nommu toolchains), but otherwise tries to be
  482. processor agnostic (although some commands such as strace can't avoid
  483. a processor-specific if/else staircase.).</p>
  484. <P>Several commands (such as ps/top) are unavoidably full of Linux assumptions.
  485. Some subset of the commands have been made to run on BSD and MacOS X, and
  486. lib/portability.* and scripts/genconfig.sh exist to catch some known
  487. variations.</p>
  488. </p>
  489. <p>Each release gets tested against two compilers (llvm, gcc), three C
  490. libraries (bionic, musl, glibc), and a half-dozen different processor
  491. types, in the following combinations:</p>
  492. <a name="cross1" />
  493. <p><a href="#cross1">1) gcc+glibc = host toolchain</a></p>
  494. <p>Most Linux distros come with that as a host compiler, which is used by
  495. default when you build normally
  496. (<b>make distclean defconfig toybox</b>, or <b>make menuconfig</b> followed
  497. by <b>make</b>).</p>
  498. <p>You can use LDFLAGS=--static if you want static binaries, but static
  499. glibc is hugely inefficient ("hello world" is 810k on x86-64) and throws a
  500. zillion linker warnings because one of its previous maintainers
  501. <a href=https://www.akkadia.org/drepper/no_static_linking.html>was insane</a>
  502. (which meant at the time he refused to fix
  503. <a href=https://elinux.org/images/2/2d/ELC2010-gc-sections_Denys_Vlasenko.pdf>obvious bugs</a>), plus it uses dlopen() at runtime to implement basic things like
  504. <a href=https://stackoverflow.com/questions/15165306/compile-a-static-binary-which-code-there-a-function-gethostbyname>DNS lookup</a> (which is almost impossible
  505. to support properly from a static binary because you wind up with two
  506. instances of malloc() managing two heaps which corrupt as soon as a malloc()
  507. from one is free()d into the other, although glibc added
  508. <a href=https://stackoverflow.com/questions/14289488/use-dlsym-on-a-static-binary>improper support</a> which still requires the shared libraries to be
  509. installed on the system alongside the static binary:
  510. <a href=https://www.youtube.com/watch?v=Ih-3vK2qLls>in brief, avoid</a>).
  511. These days glibc is <a href=https://blog.aurel32.net/175>maintained
  512. by a committee</a> instead of a single
  513. maintainer, if that's an improvement. (As with Windows and
  514. Cobol, most people just try to get on with their lives.)</p>
  515. <a name="cross2" />
  516. <p><a href="#cross2">2) gcc+musl = musl-cross-make</a></p>
  517. <p>These cross compilers are built from the
  518. <a href=http://musl.libc.org/>musl-libc</a> maintainer's
  519. <a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>
  520. project, built by running toybox's <a href=https://github.com/landley/toybox/blob/master/scripts/mcm-buildall.sh>scripts/mcm-buildall.sh</a> in that directory,
  521. and then symlink the resulting "ccc" subdirectory into toybox where
  522. "make root CROSS=" can find them, ala:</p>
  523. <blockquote><b><pre>
  524. cd ~
  525. git clone https://github.com/landley/toybox
  526. git clone https://github.com/richfelker/musl-cross-make
  527. cd musl-cross-make
  528. ../toybox/scripts/mcm-buildall.sh # this takes a while
  529. ln -s $(realpath ccc) ../toybox/ccc
  530. </pre></b></blockquote>
  531. <p>Since this takes a long time to run, and builds lots of targets
  532. (cross and native), we've uploaded
  533. <a href=downloads/binaries/toolchains/latest>the resulting binaries</a>
  534. so you can wget and extract a tarball or two instead of
  535. compiling them all yourself. (See the README in that directory for details.
  536. Yes there's a big source tarball in there for license compliance reasons.)</p>
  537. <p>Instead of CROSS= you can also specify a CROSS_COMPILE= prefix
  538. in the same format the Linux kernel build uses. You can either provide a
  539. full path in the CROSS_COMPILE string, or add the appropriate bin directory
  540. to your $PATH. I.E:</p>
  541. <blockquote>
  542. <b><p>make LDFLAGS=--static CROSS_COMPILE=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin/m68k-linux-musl- distclean defconfig toybox</p></b>
  543. </blockquote>
  544. <p>Is equivalent to:</p>
  545. <blockquote><b><p>
  546. export "PATH=~/musl-cross-make/ccc/m68k-linux-musl-cross/bin:$PATH"<br />
  547. LDFLAGS=--static make distclean defconfig toybox CROSS=m68k-linux-musl-
  548. </p></b></blockquote>
  549. <p>Note: these examples use static linking because a dynamic musl binary
  550. won't run on your host unless you install musl's libc.so into the system
  551. libraries (which is an accident waiting to happen adding a second C library
  552. to most glibc linux distribution) or play with $LD_LIBRARY_PATH.
  553. (The <a href=https://github.com/landley/toybox/blob/master/scripts/root/dynamic>dynamic</a> package
  554. in mkroot copies the shared libraries out of the toolchain to create a dynamic
  555. linking environment in the root filesystem, but it's not nearly as well
  556. tested.)</p>
  557. <a name="cross3" />
  558. <p><a href="#cross3">3) llvm+bionic = Android NDK</a></p>
  559. <p>The <a href=https://developer.android.com/ndk/downloads>Android
  560. Native Development Kit</a> provides an llvm toolchain with the bionic
  561. libc used by Android. To turn it into something toybox can use, you
  562. just have to add an appropriately prefixed "cc" symlink to the other
  563. prefixed tools, ala:</p>
  564. <blockquote><b><pre>
  565. unzip android-ndk-r21b-linux-x86_64.zip
  566. cd android-ndk-21b/toolchains/llvm/prebuilt/linux-x86_64/bin
  567. ln -s x86_64-linux-android29-clang x86_64-linux-android-cc
  568. PATH="$PWD:$PATH"
  569. cd ~/toybox
  570. make distclean
  571. make LDFLAGS=--static CROSS_COMPILE=x86_64-linux-android- defconfig toybox
  572. </pre></b></blockquote>
  573. <p>Again, you need to static link unless you want to install bionic on your
  574. host. Binaries statically linked against bionic are almost as big as with
  575. glibc, but at least it doesn't have the dlopen() issues. (You still can't
  576. sanely use dlopen() from a static binary, but bionic doesn't use dlopen()
  577. internally to implement basic features.)</p>
  578. <p>Note: although the resulting toybox will run in a standard
  579. Linux system, even "hello world"
  580. statically linked against bionic segfaults before calling main()
  581. when /dev/null isn't present. This presents mkroot with a chicken and
  582. egg problem for both chroot and qemu cases, because mkroot's init script
  583. has to mount devtmpfs on /dev to provide /dev/null before the shell binary
  584. can run mkroot's init script.
  585. Since mkroot runs as a normal user, we can't "mknod dev/null" at build
  586. time to create a "null" device in the filesystem we're packaging up so
  587. initramfs doesn't start with an empty /dev, and the
  588. <a href=https://lkml.org/lkml/2016/6/22/686>kernel</a>
  589. <a href=https://lkml.org/lkml/2017/5/14/180>developers</a>
  590. <a href=https://lkml.org/lkml/2017/9/13/651>repeatedly</a>
  591. <a href=https://lkml.org/lkml/2020/5/14/1584>rejected</a> a patch to
  592. make the Linux kernel honor DEVTMPFS_MOUNT in initramfs. Teaching toybox
  593. cpio to accept synthetic filesystem metadata,
  594. presumably in <a href=https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt>get_init_cpio</a> format, remains a todo item.</p>
  595. <hr /><h2><a name="system" />Q: What part of Linux/Android does toybox provide?</h2>
  596. <p>A:
  597. Toybox is one of three packages (linux, libc, command line) which together provide a bootable unix-style command line operating system.
  598. Toybox provides the "command line" part, with a
  599. <a href=https://en.wikipedia.org/wiki/Bash_(Unix_shell)>bash</a> compatible
  600. <a href=https://en.wikipedia.org/wiki/Unix_shell>command line interpreter</a>
  601. and over two hundred <a href=https://landley.net/toybox/help.html>commands</a>
  602. to call from it, as documented in
  603. <a href=https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/>posix</a>,
  604. the <a href=https://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html>Linux Standard Base</a>, and the
  605. <a href=https://man7.org/linux/man-pages/dir_section_1.html>Linux Manual
  606. Pages</a>.</p>
  607. <p>Toybox is not by itself a complete operating system, it's a set of standard command line utilities that run in an operating system.
  608. Booting a simple system to a shell prompt requires a kernel to drive the hardware (such as Linux, or BSD with a Linux emulation layer), programs for the system to run (such as toybox's commands), and a C library ("libc") to connect them together.</p>
  609. <p>Toybox has a policy of requiring no external dependencies other than the
  610. kernel and C library (at least for defconfig builds). You can optionally enable support for
  611. additional libraries in menuconfig (such as openssl, zlib, or selinux),
  612. but toybox either provides its own built-in versions of such functionality
  613. (which the libraries provide larger, more complex, often assembly optimized
  614. alternatives to), or allows things like selinux support to cleanly drop
  615. out.</p>
  616. <p>Static linking (with the --static option) copies library contents
  617. into the resulting binary, creating larger but more portable programs which
  618. can run even if they're the only file in the filesystem. Otherwise,
  619. the "dynamically" linked programs require each shared library file to be
  620. present on the target system, either copied out of the toolchain or built
  621. again from source (with potential version skew if they don't match the toolchain
  622. versions exactly), plus a dynamic linker executable installed at a specific
  623. absolute path. See the
  624. <a href=https://www.man7.org/linux/man-pages/man1/ldd.1.html>ldd</a>,
  625. <a href=https://www.man7.org/linux/man-pages/man8/ld.so.8.html>ld.so</a>,
  626. and <a href=https://www.man7.org/linux/man-pages/man7/libc.7.html>libc</a>
  627. man pages for details.</p>
  628. <p>Most embedded systems will add another package to the kernel/libc/cmdline
  629. above containing the dedicated "application" that the embedded system exists to
  630. run, plus any other packages that application depends on.
  631. Build systems add a native version of the toolchain packages so
  632. they can compile additional software on the resulting system. Desktop systems
  633. add a GUI and additional application packages like web browsers
  634. and video players. A linux distro like Debian adds hundreds of packages.
  635. Android adds around a thousand.</p>
  636. <p>But all of these systems conceptually sit on a common three-package
  637. "kernel/libc/cmdline" base (often inefficiently implemented and broken up
  638. into more packages), and toybox aims to provide a simple, reproducible,
  639. auditable version of the cmdline portion of that base.</p>
  640. <hr /><h2><a name="mkroot" />Q: How do you build a working Linux system with toybox?</h2>
  641. <p>A: Toybox has a built-in <a href=https://github.com/landley/toybox/blob/master/scripts/mkroot.sh>system builder</a>, with the Makefile target "<b>make
  642. root</b>". To enter the resulting root filesystem, "<b>sudo chroot
  643. root/host/fs /init</b>". Type "exit" to get back out.</p>
  644. <p>You can cross compile simple three package (toybox+libc+linux)
  645. systems configured to boot to a shell prompt under the emulator
  646. <a href=https://qemu.org>qemu</a>
  647. by specifying a target type with CROSS=
  648. (or by setting CROSS_COMPILE= to a <a href=#cross>cross compiler</a> prefix with optional absolute
  649. path), and pointing the build at a Linux kernel source directory, ala:</p>
  650. <blockquote><p><b>make root CROSS=sh4 LINUX=~/linux</b></p></blockquote>
  651. <p>Then you can <b>cd root/sh4; ./qemu-sh4.sh</b> to launch the emulator.
  652. (You'll need the appropriate qemu-system-* emulator binary installed.)
  653. Type "exit" when done and it should shut down the emulator on the way out,
  654. similar to exiting the chroot version. (Except this is more like you ssh'd
  655. to a remote machine: the emulator created its own CPU with its own memory
  656. and I/O devices, and booted a kernel in it.)</p>
  657. <p>The build finds the <a href=#system>three packages</a> needed to produce
  658. this system because 1) you're in a toybox source directory, 2) your cross
  659. compiler has a libc built into it, 3) you tell it where to find a Linux kernel
  660. source directory with LINUX= on the command line. If you don't say LINUX=,
  661. it skips that part of the build and just produces a root filesystem directory
  662. ala the first example in this FAQ answer.</p>
  663. <p>The CROSS= shortcut expects a "ccc" symlink in the toybox source directory
  664. pointing at a directory full of cross compilers. The ones I test this with are built from the musl-libc
  665. maintainer's
  666. <a href=https://github.com/richfelker/musl-cross-make>musl-cross-make</a>
  667. project, built by running toybox's scripts/mcm-buildall.sh in that directory,
  668. and then symlink the resulting "ccc" subdirectory into toybox where CROSS=
  669. can find them:</p>
  670. <blockquote><b><pre>
  671. cd ~
  672. git clone https://github.com/landley/toybox
  673. git clone https://github.com/richfelker/musl-cross-make
  674. cd musl-cross-make
  675. ../toybox/scripts/mcm-buildall.sh # this takes a while
  676. ln -s $(realpath ccc) ../toybox/ccc
  677. </pre></b></blockquote>
  678. <p>If you don't want to do that, you can download <a href=http://mkroot.musl.cc/latest/>prebuilt binary versions</a> from Zach van Rijn's site and
  679. just extract them into a "ccc" subdirectory under the toybox source.</p>
  680. <p>Once you've installed the cross compilers, "<b>make root CROSS=help</b>"
  681. should list all the available cross compilers it recognizes under ccc,
  682. something like:</p>
  683. <blockquote><b><p>
  684. aarch64 armv4l armv5l armv7l armv7m armv7r i486 i686 m68k microblaze mips mips64 mipsel powerpc powerpc64 powerpc64le s390x sh2eb sh4 x32 x86_64
  685. </p></b></blockquote>
  686. <p>(A long time ago I
  687. <a href=http://landley.net/aboriginal/architectures.html>tried to explain</a>
  688. what some of these architectures were.)</p>
  689. <p>You can build all the targets at once, and can add additonal packages
  690. to the build, by calling the script directly and listing packages on
  691. the command line:</p>
  692. <blockquote>
  693. <p><b>scripts/mkroot.sh CROSS=all LINUX=~/linux dropbear</b></p>
  694. </blockquote>
  695. <p>An example package build script (building the dropbear ssh server, adding a
  696. port forward from 127.0.0.1:2222 to the qemu command line, and providing a
  697. ssh2dropbear.sh convenience script to the output directory) is provided
  698. in the scripts/root directory. If you add your own scripts elsewhere, just
  699. give a path to them on the command line. (No, I'm not merging more package build
  700. scripts, I <a href=https://speakerdeck.com/landley/developing-for-non-x86-targets-using-qemu?slide=78>learned that lesson</a> long ago. But if you
  701. want to write your own, feel free.)</p>
  702. <p>(Note: currently mkroot.sh cheats. If you don't have a .config it'll
  703. make defconfig and add CONFIG_SH and CONFIG_ROUTE to it, because the new
  704. root filesystem kinda needs those commands to function properly. If you already
  705. have a .config that
  706. _doesn't_ have CONFIG_SH in it, you won't get a shell prompt or be able to run
  707. the init script without a shell. This is currently a problem because sh
  708. and route are still in pending and thus not in defconfig, so "make root"
  709. cheats and adds them. I'm working on it. tl;dr if make root doesn't work
  710. "rm .config" and run it again, and all this should be fixed up in future when
  711. those two commands are promoted out of pending so "make defconfig" would have
  712. what you need anyway. It's designed to let yout tweak your config, which is
  713. why it uses the .config that's there when there is one, but the default is
  714. currently wrong because it's not quite finished yet. All this should be
  715. cleaned up in a future release, before 1.0.)</p>
  716. <!--#include file="footer.html" -->