Skip to content

cross platofm shell abstractions using BusyBox WASM builds

Notifications You must be signed in to change notification settings

mayflower/busybox-wasm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BusyBox + Emscripten + nanozip + diff3

Build

BusyBox compiled to WebAssembly using Emscripten. This repo contains build scripts without being a full fork of BusyBox, making version upgrades easier.

Current versions: BusyBox 1.37.0, Emscripten 4.x

Download

Pre-built binaries are available on the Releases page:

  • busybox-linux-x86_64 - Native Linux binary
  • busybox.js / busybox.wasm - WebAssembly build

Build

Requires Emscripten SDK for WASM builds.

Deno runner

The WASM build is emitted as an ES module (MODULARIZE + EXPORT_ES6) so it can be used directly in Deno. The helper in deno/busybox_runner.ts loads busybox.js/busybox.wasm and exposes a simple run() API. busybox.js/busybox.wasm are expected to live next to the runner in releases or your build output.

# native version
make build/native/busybox

# wasm version
make build/wasm/busybox_unstripped.js

Custom Applets

This repo includes two custom BusyBox applets:

  • nanozip - miniz-based imitation of zip utility:

    busybox nanozip [-r] [[-x EXCLUDED_PATH] ...] OUTPUT_NAME.zip INPUT_PATH [...]
    
  • diff3 - OpenBSD-based implementation of diff3:

    busybox diff3 [-exEX3] /tmp/d3a.?????????? /tmp/d3b.?????????? file1 file2 file3
    

Credits

The em-shell.c, em-shell.h, em-shell.js files are based on the excellent work by Todd Fleming:

These have been updated for modern Emscripten (4.x) compatibility.

About

cross platofm shell abstractions using BusyBox WASM builds

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 36.9%
  • TypeScript 35.8%
  • Makefile 16.9%
  • JavaScript 10.4%