Hasty Briefsbeta

Bilingual

WebAssembly (WASM) arch support for the Linux kernel

5 months ago
  • #Linux
  • #Docker
  • #WebAssembly
  • Scripts to download, build, and run a Linux system executable on the web using WebAssembly (Wasm).
  • Supports execution on a host machine, generic Docker container, or specific Docker container (see Dockerfile).
  • Components include LLVM Project (18.1.2), Linux kernel (6.4.16), musl (1.2.5), BusyBox (1.36.1), and a minimal initramfs.
  • Patches applied to enable Wasm support, including GNU ld-style linker scripts in wasm-ld and Wasm architecture support in the kernel.
  • BusyBox requires modified kernel headers, originally from Sabotage Linux, adjusted for musl.
  • Initramfs packages BusyBox into a compressed cpio archive, setting up a pty for shell access.
  • Includes a minimal JavaScript Wasm host runtime for debugging purposes.
  • Wasm lacks an MMU, requiring Linux to be built in NOMMU configuration; programs need -fPIC/-shared.
  • Docker setup includes linux-wasm-base (Ubuntu 20.04 with tools) and linux-wasm-contained (isolated build environment).
  • Building LLVM may fail due to a bug; workaround involves rebuilding (works on odd-numbered attempts).
  • Linux kernel build system requires the LLVM cross-compiler path to be space-free.