1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
|
<html><head><title>toybox roadmap</title>
<!--#include file="header.html" -->
<title>Toybox Roadmap</title>
<h2>Goals and use cases</h2>
<p>We have several potential use cases for a new set of command line
utilities, and are using those to determine which commands to implement
for Toybox's 1.0 release.</p>
<p>The most interesting standards are POSIX-2008 (also known as the Single
Unix Specification version 4) and the Linux Standard Base (version 4.1).
The main test harness including toybox in Aboriginal Linux and if that can
build itself using the result to build Linux From Scratch (version 6.8).
We also aim to replace Android's Toolbox.</p>
<p>At a secondary level we'd like to meet other use cases. We've analyzed
the commands provided by similar projects (klibc, sash, sbase, s6, embutils,
nash, and beastiebox), along with various vendor configurations of busybox,
and some end user requests.</p>
<p>Finally, we'd like to provide a good replacement for the Bash shell,
which was the first program Linux ever ran and remains the standard shell
of Linux no matter what Ubuntu says. This doesn't mean including the full
set of Bash 4.x functionality, but does involve {various,features} beyond
posix.</p>
<p>See the <a href=status.html>status page</a> for the combined list
and progress towards implementing it.</p>
<ul>
<li><a href=#susv4>POSIX-2008/SUSv4</a></li>
<li><a href=#sigh>Linux "Standard" Base</a></li>
<li><a href=#dev_env>Development Environment</a></li>
<li><a href=#android>Android Toolbox</a></li>
<li>Miscelaneous: <a href=#klibc>klibc</a>, <a href=#glibc>glibc</a>,
<a href=#sash>sash</a>, <a href=#sbase>sbase</a>, <a href=#s6>s6</a>...</li>
</ul>
<hr />
<a name="standards">
<h2>Use case: standards compliance.</h2>
<h3><a name=susv4 /><a href="#susv4">POSIX-2008/SUSv4</a></h3>
<p>The best standards are the kind that describe reality, rather than
attempting to impose a new one. (I.E. a good standard should document, not
legislate.)</p>
<p>The kind of standards which describe existing reality tend to be approved by
more than one standards body, such ANSI and ISO both approving C. That's why
the IEEE POSIX committee's 2008 standard, the Single Unix Specification version
4, and the Open Group Base Specification edition 7 are all the same standard
from three sources.</p>
<p>The <a href="http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html">"utilities"
section</a>
of these standards is devoted to the unix command line, and are the best such
standard for our purposes. (My earlier work on BusyBox was implemented with
regard to SUSv3, an earlier version of this standard.)</p>
<h3>Problems with the standard</h3>
<p>Unfortunately, these standards describe a subset of reality, lacking any
mention of commands such as init, login, or mount required to actually boot a
system. It provides ipcrm and ipcs, but not ipcmk, so you can use System V IPC
resources but not create them.</p>
<p>These standards also contain a large number of commands that are
inappropriate for toybox to implement in its 1.0 release. (Perhaps some of
these could be reintroduced in later releases, but not now.)</p>
<p>Starting with the full "utilities" list, we first remove generally obsolete
commands (compess ed ex pr uncompress uccp uustat uux), commands for the
pre-CVS "SCCS" source control system (admin delta get prs rmdel sact sccs unget
val what), fortran support (asa fort77), and batch processing support (batch
qalter qdel qhold qmove qmsg qrerun qrls qselect qsig qstat qsub).</p>
<p>Some commands are for a compiler toolchain (ar c99 cflow ctags cxref gencat
iconv lex m4 make nm strings strip tsort yacc), which is outside of toybox's
mandate and should be supplied externally. (Again, some of these may be
revisited later, but not for toybox 1.0.)</p>
<p>Some commands are part of a command shell, and cannot be implemented as
separate executables (alias bg cd command fc fg getopts hash jobs kill read
type ulimit umask unalias wait). These may be revisited as part of a built-in
toybox shell, but are not exported into $PATH via symlinks. (If you fork a
child process and have it "cd" then exit, you've accomplished nothing.)</p>
<p>A few other commands are judgement calls, providing command-line
internationalization support (iconv locale localedef), System V inter-process
communication (ipcrm ipcs), and cross-tty communication from the minicomputer
days (talk mesg write). The "pax" utility was supplanted by tar, "mailx" is
a command line email client, and "lp" submits files for printing to... what
exactly? (cups?) The standard defines crontab but not crond.</p>
<p>Removing all of that leaves the following commands, which toybox should
implement:</p>
<blockquote><b>
<span id=posix>
at awk basename bc cal cat chgrp chmod chown cksum cmp comm cp
csplit cut date dd df diff dirname du echo env expand expr false file find
fold fuser getconf grep head id join kill link ln logger logname ls man
mkdir mkfifo more mv newgrp nice nl nohup od paste patch pathchk printf ps
pwd renice rm rmdir sed sh sleep sort split stty tabs tail tee test time
touch tput tr true tty uname unexpand uniq unlink uudecode uuencode vi wc
who xargs zcat
</span>
</b></blockquote>
<h3><a name=sigh /><a href="#sigh">Linux Standard Base</a></h3>
<p>One attempt to supplement POSIX towards an actual usable system was the
Linux Standard Base. Unfortunately, the quality of this "standard" is
fairly low.</p>
<p>POSIX allowed its standards process to be compromised
by leaving things out, thus allowing IBM mainframes and Windows NT to drive
a truck through the holes and declare themselves compilant. But it means what
they DID standardize tends to be respected.</p>
<p>The Linux Standard Base's failure mode is different, they respond to
pressure by including special-case crap, such as allowing Red Hat to shoehorn
RPM on the standard even though all sorts of distros (Debian, Slackware, Arch,
Gentoo) don't use it and probably never will. This means anything in the LSB is
at best a suggestion: arbitrary portions of this standard are widely
ignored.</p>
<p>The LSB does specify a <a href=http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html>list of command line
utilities</a>:</p>
<blockquote><b>
ar at awk batch bc chfn chsh col cpio crontab df dmesg du echo egrep
fgrep file fuser gettext grep groupadd groupdel groupmod groups
gunzip gzip hostname install install_initd ipcrm ipcs killall lpr ls
lsb_release m4 md5sum mknod mktemp more mount msgfmt newgrp od passwd
patch pidof remove_initd renice sed sendmail seq sh shutdown su sync
tar umount useradd userdel usermod xargs zcat
</b></blockquote>
<p>Where posix specifies one of those commands, LSB's deltas tend to be
accomodations for broken tool versions which aren't up to date with the
standard 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>
for examples.)</p>
<p>Since we've already committed to using our own judgement to skip bits of
POSIX, and LSB's "judgement" in this regard is purely bug workarounds to declare
various legacy tool implementations "compliant", this means we're mostly
interested in the set of tools that aren't specified in posix at all.</p>
<p>Of these, gettext and msgfmt are internationalization, install_initd and
remove_initd aren't present on ubuntu 10.04, lpr is out of scope, and
lsb_release is a distro issue (it's a nice command, but the output of
lsb_release -a is the name and version number of the linux distro you're
running, which toybox doesn't know).</p>
<p>This leaves:</p>
<blockquote><b>
<span id=lsb>
chfn chsh dmesg egrep fgrep groupadd groupdel groupmod groups
gunzip gzip hostname install killall md5sum
mknod mktemp mount passwd pidof sendmail seq shutdown
su sync tar umount useradd userdel usermod zcat
</span>
</b></blockquote>
<hr />
<a name="dev_env">
<h2><a href="#dev_env">Use case: provide a self-hosting development environment</a></h2>
<p>The following commands are enough to build the Aboriginal Linux development
environment, boot it to a shell prompt, and build Linux From Scratch 6.8 under
it. (Aboriginal Linux currently uses BusyBox for this, thus provides a
drop-in test environment for toybox. We install both implementations side
by side, redirecting the symlinks a command at a time until the older
package is no longer used, and can be removed.)</p>
<p>This use case includes running init scripts and other shell scripts, running
configure, make, and install in each package, and providing basic command line
facilities such as a text editor. (It does not include a compiler toolchain or
C library, those are outside the scope of this project.)</p>
<blockquote><b>
<span id=development>
bzcat cat cp dirname echo env patch rmdir sha1sum sleep sort sync
true uname wc which yes zcat
awk basename bzip2 chmod chown cmp cut date dd diff
egrep expr find grep gzip head hostname id install ln ls
mkdir mktemp mv od readlink rm sed sh tail tar touch tr uniq
wget whoami xargs chgrp comm gunzip less logname man split
tee test time bunzip2 chgrp chroot comm cpio dmesg
dnsdomainname ftpd ftpget ftpput gunzip ifconfig init less
logname losetup man mdev mount mountpoint nc pgrep pkill
pwd route split stat switch_root tac umount vi
</span>
</b></blockquote>
<p>Note: Aboriginal Linux installs bash 2.05b as #!/bin/sh and its scripts
require bash extensions not present in shells such as busybox ash.
This means that toysh needs to supply several bash extensions _and_ work
when called under the name "bash".</p>
<hr />
<h2><a name=android /><a href="#android">Use case: Replacing Android Toolbox</a></h2>
<p>Android has a policy against GPL in userspace, so even though BusyBox
predates Android by many years, they couldn't use it. Instead they grabbed
an old version of ash and implemented their own command line utility set
called "toolbox".</p>
<p>Toolbox doesn't have its own repository, instead it's part of Android's
<a href=https://android.googlesource.com/platform/system/core>system/core
git repository</a> (this analysis looked at commit 51ccef27cab58).</p>
<h3>Toolbox commands:</h3>
<p>According to core/toolbox/Android.mk the toolbox directory builds the
following commands:</p>
<blockquote><b>
ls mount cat ps kill ln insmod rmmod lsmod ifconfig setconsole
rm mkdir rmdir reboot getevent sendevent date wipe sync umount
start stop notify cmp dmesg route hd dd df getprop setprop watchprops
log sleep renice printenv smd chmod chown newfs_msdos netstat ioctl
mv schedtop top iftop id uptime vmstat nandread ionice touch lsof md5 r
cp du grep watchdogd
</b></blockquote>
<p>If selinux is enabled, you also get:</p>
<blockquote><b>
getenforce setenforce chcon restorecon runcon getsebool setsebool load_policy
</b></blockquote>
<p>The Android.mk file also refers to dynarray.c and toolbox.c as library
code. This leaves the following apparently unused C files in toolbox/*.c, each
of which has a command_main() function and seems to implement a standalone
command:</p>
<blockquote><b>
alarm exists lsusb readtty rotatefb setkey syren
</b></blockquote>
<h3>Command shell (ash)</h3>
<p>The core/sh subdirectory contains a fork of ash 1.17, and sucks in
liblinenoise to provide command line history/editing.</p>
<h3>Other Android core commands</h3>
<p>Other than the toolbox and sh directories, the currently interesting
subdirectories in the core repository are fs_mgr, gpttool, init,
logcat, logwrapper, mkbootimg, netcfg, run-as, and sdcard.</p>
<ul>
<li><b>fs_mgr</b> - subset of mount</li>
<li><b>gpttool</b> - subset of fdisk</li>
<li><b>init</b> - Android's PID 1</li>
<li><b>logcat</b> - read android log format</li>
<li><b>logwrapper</b> - redirect stdio to android log</li>
<li><b>mkbootimg</b> - create signed boot image</li>
<li><b>netcfg</b> - network configuration (sucks in libnetutils)</li>
<li><b>run-as</b> - subset of sudo</li>
<li><b>sdcard</b> - FUSE wrapper to squash UID/GID/permissions to what FAT supports.</li>
</ul>
<p>Almost all of these reinvent an existing wheel with less functionality and a
different user interface. We may want to provide that interface, but
implementing the full commands (mount, fdisk, init, ifconfig with dhcp,
and sudo) come first.</p>
<p>Although logcat/logwrapper also reinvent a wheel, Android did so in the
kernel and these provide an interface to that.</p>
<p>Also, gpttool and mkbootimg are install tools, and sdcard looks like a
testing tool. These aren't a priority if android wants to use its own
bespoke code to install itself.</p>
<h3>Analysis</h3>
<p>For reference, combining everything listed above, we get:</p>
<blockquote><b>
alarm ash cat chcon chmod chown cmp cp date dd df dmesg du exists fs_mgr
getenforce
getevent getprop getsebool gpttool grep hd id ifconfig iftop init insmod ioctl
ionice kill ln load_policy log logcat logwrapper ls lsmod lsof lsusb md5
mkbootimg mkdir mount mv nandread netcfg netstat newfs_msdos notify printenv
ps r readtty reboot renice restorecon rm rmdir rmmod rotatefb route run-as
runcon schedtop sdcard sendevent setconsole setenforce setkey setprop setsebool
sleep smd start stop sync syren top touch umount uptime vmstat watchdogd
watchprops wipe
</b></blockquote>
<p>We may eventually implement all of that, but for toybox 1.0 we need to
focus a bit. For our first pass, let's ignore selinux, strip out the "unlisted"
commands except lsusb, and grab just logcat and logwrapper from the "core"
commands (since the rest have some full/standard version providing that
functionality, which we can implement a shim interface for later).</p>
<p>This means toybox should implement:</p>
<blockquote><b>
<span id=toolbox>
cat chmod chown cmp cp date dd df dmesg du getevent getprop grep hd id ifconfig
iftop insmod ioctl ionice kill ln log logcat logwrapper ls lsmod lsof lsusb md5
mkdir mount mv nandread
netstat newfs_msdos notify printenv ps r reboot renice rm rmdir rmmod route
schedtop sendevent setconsole setprop sleep smd start stop sync top touch
umount uptime vmstat watchprops watchdogd wipe
</span>
</b></blockquote>
<p>The following Toolbox commands are already covered in previous
sections of this analysis:</p>
<blockquote><b>
cat chmod chown cmp cp date dd df dmesg du grep id ifconfig insmod kill ln ls
lsmod mkdir mount mv ps renice rm rmdir rmmod route sleep sync top touch umount
</b></blockquote>
<p>Which leaves the following commands as new from Toolbox:</p>
<blockquote><b>
getevent getprop hd iftop ioctl ionice log lsof nandread netstat
newfs_msdos notify printenv r reboot schedtop sendevent setconsole
setprop smd start stop top uptime vmstat watchprops watchdogd wipe
</b></blockquote>
<hr /><a name=klibc />
<h2>klibc:</h2>
<p>Long ago some kernel developers came up with a project called
<a href=http://en.wikipedia.org/wiki/Klibc>klibc</a>.
After a decade of development it still has no web page or HOWTO,
and nobody's quite sure if the license is BSD or GPL. It inexplicably
<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
replacement.</p>
<p>In addition to a C library even less capable than bionic (obsoleted by
musl), klibc builds a random assortment of executables to run init scripts
with. There's no multiplexer command, these are individual executables:</p>
<blockquote><p>
cat chroot cpio dd dmesg false fixdep fstype gunzip gzip halt ipconfig kill
kinit ln losetup ls minips mkdir mkfifo mknodes
mksyntax mount mv nfsmount nuke pivot_root poweroff readlink reboot resume
run-init sh sha1hash sleep sync true umount uname zcat
</p></blockquote>
<p>To get that list, build klibc according to the instructions (I
<a href=http://landley.net/notes-2013.html#23-01-2013>looked at</a> version
2.0.2 and did cd klibc-*; ln -s /output/of/kernel/make/headers_install
linux; make) then <b>echo $(for i in $(find . -type f); do file $i | grep -q
executable && basename $i; done | grep -v '[.]g$' | sort -u)</b> to find
executables, then eliminated the *.so files and *.shared duplicates.</p>
<p>Some of those binaries are build-time tools that don't get installed,
which removes mknodes, mksyntax, sha1hash, and fixdep from the list.
(And sha1hash is just an unpolished sha1sum anyway.)</p>
<p>The run-init command is more commonly called switch_root, nuke is just
"rm -rf -- $@", and minips is more commonly called "ps". I'm not doing aliases
for the oddball names.</p>
<p>Yet more stale forks of dash and gzip sucked in here (see "dubious
license terms" above), adding nothing to the other projects we've looked at.
But we still need sh, gunzip, gzip, and zcat to replace this package.</p>
<p>By the time I did the analysis toybox already had cat, chroot, dmesg, false,
kill, ln, losetup, ls, mkdir, mkfifo, readlink, rm, switch_root, sleep, sync,
true, and uname.</p>
<p>The low hanging fruit is cpio, dd, ps, mv, and pivot_root.</p>
<p>The "kinit" command is another gratuitous rename, it's init running as PID 1.
The halt, poweroff, and reboot commands work with it.</p>
<p>I've got mount and umount queued up already, fstype and nfsmount go with
those. (And probably smbmount and p9mount, but this hasn't got one. Those
are all about querying for login credentials, probably workable into the
base mount command.)</p>
<p>The ipconfig command here has a built in dhcp client, so it's ifconfig
and dhcpcd and maybe some other stuff.</p>
<p>The resume command is... weird. It finds a swap partition and reads data
from it into a /proc file, something the kernel is capable of doing itself.
(Even though the klibc author
<a href=http://www.zytor.com/pipermail/klibc/2006-June/001748.html>attempted
to remove</a> that capability from the kernel, current kernel/power/hibernate.c
still parses "resume=" on the command line). And yet various distros seem to
make use of klibc for this>
Given the history of swsusp/hibernate (and
<a href=http://lwn.net/Articles/333007>TuxOnIce</a>
and <a href=http://lwn.net/Articles/242107>kexec jump</a>) I've lost track
of the current state of the art here. Ah, Documentation/power/userland-swsusp.txt
has the API docs, and <a href=http://suspend.sf.net>here's a better
tool</a>...</p>
<p>So the list of things actually in klibc are:</p>
<blockquote><b>
<span id=klibc_cmd>
cat chroot dmesg false kill ln losetup ls mkdir mkfifo readlink rm switch_root
sleep sync true uname
cpio dd ps mv pivot_root
mount nfsmount fstype umount
sh gunzip gzip zcat
kinit halt poweroff reboot
ipconfig
resume
</span>
</b></blockquote>
<hr />
<a name=glibc />
<h2>glibc</h2>
<p>Rather a lot of command line utilities come bundled with glibc:</p>
<blockquote><b>
catchsegv getconf getent iconv iconvconfig ldconfig ldd locale localedef
mtrace nscd rpcent rpcinfo tzselect zdump zic
</b></blockquote>
<p>Of those, musl libc only implements ldd.</p>
<p>catchsegv is a rudimentary debugger, probably out of scope for toybox.</p>
<p>iconv has been <a href="#susv4">previously discussed</a>.</p>
<p>iconvconfig is only relevant if iconv is user-configurable; musl uses a
non-configurable iconv.</p>
<p>getconf is a posix utility which displays several variables from
unistd.h; it probably belongs in the development toolchain.</p>
<p>getent handles retrieving entries from passwd-style databases,
in a rather lame way.</p>
<p>locale was discussed under <a href=#susv4>posix</a>.
localedef compiles locale definitions, which musl currently does not use.</p>
<p>mtrace is a perl script to use the malloc debugging that glibc has built-in;
this is not relevant for musl, and would necessarily vary with libc. </p>
<p>nscd is a name service caching daemon, which is not yet relevant for musl.
rpcinfo and rpcent are related to rpc, which musl does not include.</p>
<p>tzselect outputs a TZ variable correponding to user input.
The documentation does not indicate how to use it in a script, but it seems
that Debian may have done so.
zdump prints current time in each of several timezones, optionally
outputting a great deal of extra information about each timezone.
zic converts a description of a timezone to a file in the tz format.</p>
<p>So this leaves the following interesting commands:</p>
<blockquote><b>
<span id=glibc_cmd>
getent
tzselect zdump zic
</span>
</b></blockquote>
<hr />
<a name=sash />
<h2>Stand-Alone Shell</h2>
<p>Wikipedia has <a href=http://en.wikipedia.org/wiki/Stand-alone_shell>a good
summary of sash</a>, with links. The original Stand-Alone Shell project reached
a stopping point, and then <a href=http://www.baiti.net/sash>"sash plus
patches"</a> extended it a bit further. The result is a megabyte executable
that provides 40 commands.</p>
<p>Sash is a shell with built-in commands. It doesn't have a multiplexer
command, meaning "sash ls -l" doesn't work (you have to go "sash -c 'ls -l'").
</p>
<p>The list of commands can be obtained via building it and doing
"echo help | ./sash | awk '{print $1}' | sed 's/^-//' | xargs echo", which
gives us:</p>
<blockquote><b>
alias aliasall ar cd chattr chgrp chmod chown cmp cp chroot dd echo ed exec
exit file find grep gunzip gzip help kill losetup losetup ln ls lsattr mkdir
mknod more mount mv pivot_root printenv prompt pwd quit rm rmdir setenv source
sum sync tar touch umask umount unalias where
</b></blockquote>
<p>Plus sh because it's a shell. A dozen or so commands can only sanely be
implemented as shell builtins (alias aliasall cd exec exit prompt quit setenv
source umask unalias), where is an alias for which, and at triage time toybox
already has chgrp, chmod, chown, cmp, cp, chroot, echo, help, kill, losetup,
ln, ls, mkdir, mknod, printenv, pwd, rm, rmdir, sync, and touch.</p>
<p>This leaves:</p>
<blockquote><b>
<span id=sash_cmd>
ar chattr dd ed file find grep gunzip gzip lsattr more mount mv pivot_root
sh sum tar umount
</span>
</b></blockquote>
<p>(For once, this project doesn't include a fork of gzip, instead
it sucks in -lz from the host.)</p>
<hr />
<a name=sbase />
<h2>sbase:</h2>
<p>It's <a href=http://git.suckless.org/sbase>on suckless</a>. So far it's
implemented:</p>
<blockquote><p>
<span id=sbase_cmd>
basename cat chmod chown cksum cmp cp date dirname echo false fold grep head
kill ln ls mc mkdir mkfifo mv nl nohup pwd rm seq sleep sort tail tee test
touch true tty uname uniq wc yes
</span>
</p></blockquote>
<p>And has a TODO list:</p>
<blockquote><p>
<span id=sbase_cmd>
cal chgrp chvt comm cut df diff du env expand expr id md5sum nice paste
printenv printf readlink rmdir seq sha1sum split sync test tr unexpand unlink
who
</span>
</p></blockquote>
<p>At triage time, of the first list I still need to do: fold grep mc mv nl. Of
the second list: diff expr paste printf split test tr unexpand who.</p>
<hr />
<a name=s6 />
<h2>s6</h2>
<p>The website <a href=http://skarnet.org/software/>skarnet</a> has a bunch
of small utilities as part of something called "s6". This includes the
<a href=http://skarnet.org/software/s6-portable-utils>s6-portabile-utils</a>
and the <a href=http://skarnet.org/software/s6-linux-utils>s6-linux-utils</a>.
</p>
<p>Both packages rely on multiple bespoke external libraries without which
they can't compile. The source is completely uncommented and doesn't wrap at
80 characters. Doing a find for *.c files brings up the following commands:</p>
<blockquote><b>
<span id=s6>
basename cat chmod chown chroot clock cut devd dirname echo env expr false
format-filter freeramdisk grep halt head hiercopy hostname linkname ln
logwatch ls maximumtime memoryhog mkdir mkfifo mount nice nuke pause
pivotchroot poweroff printenv quote quote-filter reboot rename rmrf sleep
sort swapoff swapon sync tail test touch true umount uniquename unquote
unquote-filter update-symlinks
</span>
</b></blockquote>
<p>Triage: memoryhog isn't even listed on the website nor does it have
a documentation file, clock seems like a subset
of date, devd is some sort of netlink wrapper that spawns its command line
every time it gets a message (maybe this is meant to implement part of
udev/mdev?), format-filter is sort of awk's '{print $2}' function split out
into its own command, hiercopy a subset of "cp -r", maximumtime is something
I implemented as a shell script (more/timeout.sh in Aboriginal Linux),
nuke isn't the same as klibc (this one's "kill SIG -1" only with hardwared
SIG options), pause is a program that literally waits to be killed (I
generally sleep 999999999 which is a little over 30 years),
pivotchroot is a subset of switch_root, rmrf is rm -rf...</p>
<p>I see "nuke" resurface, and if "rmrf" wasn't also here I might think
klibc had a point.</b>
<blockquote>
basename cat chmod chown chroot cut dirname echo env expr false
freeramdisk grep halt head hostname linkname ln
logwatch ls mkdir mkfifo mount nice
pivotchroot poweroff printenv quote quote-filter reboot rename sleep
sort swapoff swapon sync tail test touch true umount uniquename unquote
unquote-filter update-symlinks
</blockquote>
<hr />
<a name=nash />
<h2>nash:</h2>
<p>Red Hat's nash was part of its "mkinitrd" package, replacement for a shell
and utilities on the boot floppy back in the 1990's (the same general idea
as BusyBox, developed independently). Red Hat discontinued nash development
in 2010, replacing it with dracut (which collects together existing packages,
including busybox).</p>
<p>I couldn't figure out how to beat source code out of
<a href=http://pkgs.fedoraproject.org/git/mkinitrd>Fedora's current git</a>
repository. The last release version that used it was Fedora Core 12
which 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>
that can be unwound with "rpm2cpio mkinitrd.src.rpm | cpio -i -d -H newc
--no-absolute-filenames" and in there is a mkinitrd-6.0.93.tar.bz2 which
has the source.</p>
<p>In addition to being a bit like a command shell, the nash man page lists the
following commands:</p>
<blockquote><p>
access echo find losetup mkdevices mkdir mknod mkdmnod mkrootdev mount
pivot_root readlink raidautorun setquiet showlabels sleep switchroot umount
</p></blockquote>
<p>Oddly, the only occurrence of the string pivot_root in the nash source code
is in the man page, the command isn't there. (It seems to have been removed
when the underscoreless switchroot went in.)</p>
<p>A more complete list seems to be the handlers[] array in nash.c:</p>
<blockquote><p>
access buildEnv cat cond cp daemonize dm echo exec exit find kernelopt
loadDrivers loadpolicy mkchardevs mkblktab mkblkdevs mkdir mkdmnod mknod
mkrootdev mount netname network null plymouth hotplug killplug losetup
ln ls raidautorun readlink resume resolveDevice rmparts setDeviceEnv
setquiet setuproot showelfinterp showlabels sleep stabilized status switchroot
umount waitdev
</p></blockquote>
<p>This list is nuts: "plymouth" is an alias for "null" which is basically
"true" (which thie above list doesn't have). Things like buildEnv and
loadDrivers are bespoke Red Hat behavior that might as well be hardwired in
to nash's main() without being called.</p>
<p>Instead of eliminating items
from the list with an explanation for each, I'm just going to cherry pick
a few: the device mapper (dm, raidautorun) is probably interesting,
hotplug (may be obsolete due to kernel changes that now load firmware
directly), and another "resume" ala klibc.</p>
<p>But mostly: I don't care about this one. And neither does Red Hat anymore.</p>
<p>Verdict: ignore</p>
<hr />
<a name=beastiebox />
<h2>Beastiebox</h2>
<p>Back in 2008, the BSD guys vented some busybox-envy
<a href=http://beastiebox.sourceforge.net>on sourceforge</a>. Then stopped.
Their repository is still in CVS, hasn't been touched in years, it's a giant
hairball of existing code sucked together. (The web page says the author
is aware of crunchgen, but decided to do this by hand anyway. This is not
a collection of new code, it's a katamari of existing code rolled up in a
ball.)</p>
<p>Combining the set of commands listed on the web page with the set of
man pages in the source gives us:</P>
<blockquote><p>
[ cat chmod cp csh date df disklabel dmesg echo ex fdisk fsck fsck_ffs getty
halt hostname ifconfig init kill less lesskey ln login ls lv mksh more mount
mount_ffs mv pfctl ping poweroff ps reboot rm route sed sh stty sysctl tar test
traceroute umount vi wiconfig
</p></blockquote>
<p>Apparently lv is the missing link ed and vi, copyright 1982-1997 (do not
want), ex is another obsolete vi mode, lesskey is "used to
specify a set of key bindings to be used with less", and csh is a shell they
sucked in, [ is an alias for test. Several more bsd-isms that don't have Linux
equivalents (even in the ubuntu "install this package" search) are
disklabel, fsck_ffs, mount_ffs, and pfctl. And wiconfig is a wavelan interface
network card driver utility. Subtracting all that and the commands toybox
already implements at triage time, we get:</p>
<blockquote><p>
<span id=beastiebox_cmd>
fdisk fsck getty halt ifconfig init kill less mksh more mount mv ping poweroff
ps reboot route sed sh stty sysctl tar test traceroute umount vi
</span>
</p></blockquote>
<p>Not a hugely interesting list, but eh.</p>
<p>Verdict: ignore</p>
<hr />
<a name=BsdBox />
<h2>BsdBox</h2>
<p>Somebody decided to do a <a href=https://wiki.freebsd.org/AdrianChadd/BsdBox>multicall binary for freebsd</a>.</p>
<p>They based it on crunchgen, a tool that glues existing programs together
into an archive and uses the name to execute the right one. It has no
simplification or code sharing benefits whatsoever, it's basically an
archiver that produces executables.</p>
<p>That's about where I stopped reading.</p>
<p>Verdict: ignore.</p>
<hr />
<a name=slowaris />
<h2>OpenSolaris Busybox</h2>
<p>Somebody <a href=http://hub.opensolaris.org/bin/view/Project+busybox/>wrote
a wiki page</a> saying that Busybox for OpenSolaris would be a good idea.</p>
<p>The corresponding "files" tab is an auto-generated stub. The project never
even got as far as suggesting commands to include before Oracle discontinued
OpenSolaris.</p>
<p>Verdict: ignore.</p>
<hr />
<h2>Requests:</h2>
<p>The following additional commands have been requested by various users:</p>
<blockquote><b>
<span id=request>
dig freeramdisk getty halt hexdump hwclock klogd modprobe ping ping6 pivot_root
poweroff readahead rev sfdisk sudo syslogd taskset telnet telnetd tracepath
traceroute unzip usleep vconfig zip free login modinfo unshare netcat help w
ntpd iwconfig iwlist rdate
dos2unix unix2dos catv clear
pmap realpath setsid timeout truncate
mkswap swapon swapoff
count oneit fstype
acpi blkid eject pwdx
</span>
</b></blockquote>
<!-- #include "footer.html" -->
|