๐ช Armybox
A memory-safe #[no_std] BusyBox/Toybox clone written in Rust.
๐ Documentation ยท ๐ฆ Crates.io ยท ๐ง API Docs
โจ Features
- 293 applets โ 100% Toybox compatible + 55 additional utilities
- Multi-call binary โ single executable providing all utilities
- Pure Rust 2024 โ memory-safe implementation using the latest Rust edition
- Incredibly tiny โ 108 KB stripped, ~54 KB with UPX compression
- True
#[no_std]โ no standard library dependency, onlylibcandalloc - Android-native โ first-class Android/Bionic support, works on Android 5.0+
- Embedded-ready โ works on systems without full std support
- Cross-platform โ builds for Linux (glibc/musl), Android, x86_64, ARM64, ARM32
- POSIX.1-2017 compliant โ core utilities follow the POSIX standard
๐ Binary Size Comparison
| Binary | Size | UPX Size | Applets | Size/Applet |
|---|---|---|---|---|
| Armybox | 108 KB | ~54 KB | 293 | ~380 bytes |
| Toybox | ~500 KB | ~200 KB | 238 | ~2.1 KB |
| BusyBox | 2.4 MB | ~1 MB | 274 | ~9 KB |
Armybox is 24x more efficient per applet than BusyBox and 5.5x more efficient than Toybox!
๐ Quick Start
# Clone and build
# Install symlinks
# Compress with UPX (optional)
๐ Applet Categories (293 total)
File Operations (45+)
basename, cat, cd, chattr, chgrp, chmod, chown, cp, dd, dirname, fallocate, file, find, fstype, install, link, ln, ls, lsattr, makedevs, mkdir, mkfifo, mknod, mktemp, mv, patch, pwd, readlink, realpath, rm, rmdir, setfattr, shred, split, stat, sync, touch, truncate, unlink, xargs
Text Processing (35+)
awk, base32, base64, comm, cut, dos2unix, echo, egrep, expand, fgrep, fmt, fold, grep, head, iconv, nl, paste, printf, rev, sed, seq, sort, strings, tac, tail, tee, tr, tsort, unexpand, uniq, unix2dos, wc, yes
System Utilities (60+)
acpi, arch, blkdiscard, blkid, blockdev, cal, chroot, chrt, chvt, date, deallocvt, devmem, df, dmesg, dnsdomainname, du, env, fgconsole, flock, free, freeramdisk, fsfreeze, fsync, getconf, getopt, groups, halt, hostid, hostname, hwclock, id, insmod, ionice, iorenice, iotop, linux32, logger, logname, losetup, lsmod, lspci, lsusb, modinfo, modprobe, mount, mountpoint, nice, nohup, nproc, openvt, partprobe, pivot_root, poweroff, printenv, reboot, readahead, renice, rfkill, rmmod, rtcwake, swapoff, swapon, sysctl, taskset, timeout, top, tty, umount, uname, uptime, users, vmstat, w, watch, who, whoami
Process Management (15+)
kill, killall, killall5, pgrep, pidof, pkill, pmap, prlimit, ps, pwdx, renice, setsid, time
Shell (3)
sh, ash, dash โ full POSIX-compliant shell
Vi Editor (2)
vi, view โ modal editor with normal, insert, and command-line modes
Terminal Multiplexer (2)
screen, tmux โ terminal session management
Init System (6)
init, getty, linuxrc, runlevel, sulogin, telinit
Networking (35+)
arp, arping, brctl, ftpget, ftpput, host, httpd, ifconfig, ifdown, ifup, ip, ipaddr, ipcalc, iplink, ipneigh, iproute, iprule, nameif, nbd-client, nbd-server, nc, netcat, netstat, nslookup, ping, ping6, route, slattach, sntp, ss, telnet, tftp, traceroute, traceroute6, tunctl, wget
Archive & Compression (15)
bunzip2, bzcat, bzip2, compress, cpio, gunzip, gzip, tar, uncompress, unxz, unzip, xz, xzcat, zcat
Checksums & Crypto (10)
cksum, crc32, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha3sum, sha512sum
Hardware & GPIO (15+)
devmem, gpiodetect, gpiofind, gpioget, gpioinfo, gpioset, i2cdetect, i2cdump, i2cget, i2cset, i2ctransfer, lspci, lsusb
Miscellaneous (25+)
[, ascii, clear, cmp, count, diff, expr, factor, false, help, hexdump, hexedit, mcookie, memeater, mesg, microcom, mix, mkpasswd, mkswap, nologin, nsenter, oneit, pwgen, readelf, reset, shuf, sleep, switch_root, test, toybox, true, ts, uclampset, ulimit, unicode, unshare, usleep, uudecode, uuencode, uuidgen, watchdog
๐ฑ Android Support
Armybox has native Android support with Bionic libc compatibility.
# Install Android targets
# Set up Android NDK (required)
# Build for Android ARM64
# Deploy via ADB
๐ฆ Usage
Direct Invocation
List Available Applets
Via Symlinks
After installing symlinks:
๐ Library Usage
Armybox is a #[no_std] library that can be used in embedded environments.
Cargo.toml
[]
= { = "0.3", = false, = ["alloc"] }
Features
| Feature | Description | Default |
|---|---|---|
alloc |
Heap allocation (Vec, String) | โ |
std |
Standard library support | โ |
apk |
APK package manager support | โ |
Example
extern crate alloc;
use applets;
// Find and run an applet
if let Some = find_applet
๐๏ธ Architecture
src/
โโโ lib.rs # Library entry (no_std compatible)
โโโ main.rs # Binary entry (no_std, no_main)
โโโ io.rs # Raw I/O via libc
โโโ sys.rs # System utilities
โโโ applets/
โโโ mod.rs # Applet registry (293 applets)
โโโ file.rs # File operations
โโโ text.rs # Text processing
โโโ system.rs # System utilities
โโโ misc.rs # Miscellaneous
โโโ network.rs # Networking
โโโ archive.rs # Archive/compression
โโโ init.rs # Init system
โโโ shell.rs # POSIX shell
โโโ vi.rs # Vi editor
โโโ screen.rs # Terminal multiplexer
๐ณ Docker
Use armybox as a minimal base for containers. Perfect for FROM scratch images.
FROM scratch
COPY target/release/armybox /bin/armybox
RUN ["/bin/armybox", "--install", "/bin"]
ENTRYPOINT ["/bin/sh"]
Build: docker build -t myapp . โ ~100KB image!
๐ How It Works
Armybox is built entirely with #[no_std]:
- No Rust Standard Library โ Only uses
coreandalloc - Direct libc Calls โ All I/O goes through raw
libc::*functions - Custom Allocator โ Uses
libc::malloc/freefor heap allocation - Custom Panic Handler โ Minimal panic handling without unwinding
- No Main Runtime โ Uses
#[no_main]with raw C entry point
This results in an incredibly small binary that's perfect for:
- Embedded systems
- Containers (FROM scratch)
- Rescue environments
- Space-constrained systems
- Android devices
๐ Comparison
| Feature | Armybox | Toybox | BusyBox |
|---|---|---|---|
| Language | Rust | C | C |
| Memory Safety | โ Compile-time | โ Manual | โ Manual |
| Binary Size | 108 KB | ~500 KB | 2.4 MB |
| Per-Applet Size | ~380 bytes | ~2.1 KB | ~9 KB |
#[no_std] |
โ | N/A | N/A |
| Applet Count | 293 | 238 | 274 |
| Toybox Compatible | โ 100% | N/A | Partial |
| POSIX Shell | โ | โ | โ |
| Vi Editor | โ | โ | โ |
| Init System | โ | Partial | โ |
| Terminal Multiplexer | โ | โ | โ |
| License | MIT/Apache-2.0 | 0BSD | GPL v2 |
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
๐ License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
๐ Acknowledgments
- Toybox โ BSD-licensed Unix utilities
- BusyBox โ The original multi-call binary inspiration
- libc โ Rust FFI bindings to platform libraries
Made with โค๏ธ by Pegasus Heavy Industries