Awesome Open Source
Awesome Open Source

rustybox

RustyBox is a free-range, non-GMO fork of BusyBox written entirely in Rust. It includes all your favorite commands like ls, mount, and top, but without a single line of C code! Like BusyBox, rustybox weighs in at just under 1 megabyte and includes all the basic utilities you need to set up a small Linux OS.

screenshot

Status

rustybox is a work-in-progress! It started out life as a direct c2rust transpile of the busybox project, and has been steadily improving since then. This has the benefit of ensuring that rustybox is "bug-for-bug" compatible with busybox, but it does mean that we have inherited the raw pointers and unsafes that come from C land. If making essential software memory-safe is your cup of tea then join the party with a PR!

Contributing to rustybox

Contributing to rustybox is a great way to get started with rust, dig into the bowels of linux, or to help to free the world from the diabolical tyranny of C.

There's lots to be done, so we're happy to have you! Here are just a few ideas:

  • Replace some extern "C" includes with more idiomatic uses. Pretty straightforward find/replace-all usually does the trick.
  • Pick a utility, like cat or touch, and work on translating it into safer, more idiomatic rust. There are plenty of unsafes lying around that you can tackle!
  • Try building Alpine linux with rustybox in place of busybox. This could be an awesome drop-in replacement for the popular alpine Docker image.

Check out the contributing doc for more info!

And of course please test out rustybox and report any and all issues, concerns, and comments!

Building rustybox

Rustybox requires a Linux system to build. Developing in Docker works just as well on macOS and Windows. You'll need GCC and its development headers (esp. quadmath.h) in order to build the f128 dependency. Running sudo apt install build-essential should do the trick on Ubuntu/Debian.

Please open an issue if you have trouble building!

Customizing your rustybox distribution

By default, rustybox does not include any utility. You can include all of them:

cargo build --all-features

Chances are you don't actually need or want everything in rustybox, especially for a release. If you'd like to build rustybox with only a specific set of utilities:

cargo build --release --features "cat ls which"

Check out the [features] section of Cargo.toml for the full list of utilities on tap.

After building, you can remove unnecessary debug sections with strip. This is recommended if you are particularly size-conscious.

Acknowledgements

There's simply no way this project would be possible without the hard work from the wonderful busybox and c2rust teams. Both projects are dope, and you should check them out. Much of the code you find in this repo is transpiled from the work of the busybox AUTHORS.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
rust (4,342
linux (2,349
rust-lang (113

Find Open Source By Browsing 7,000 Topics Across 59 Categories