Fabrice Bellard is a prolific hacker who has created a well-known virtual machine emulator for Linux called Qemu. He has also created a project called Temu (tiny emulator), which can compile to JavaScript and run in the browser. Temu supports multiple CPU architectures (riscv and x86) and can run a full Linux environment . This project explores temu's current capabilities and limitations. Finally, I discuss possible use cases for this technology.

Here's what works:

  • Build a custom Linux kernel and base system based on the buildroot embedded Linux distribution
  • Boot in the browser
  • Run python. Works great!

Here's what doesn't work:

  • nodejs
  • ngrok

There were also some gotchas:

  • When temu runs on Linux, it uses KVM for x86 emulation. But in the browser, KVM is not available, so it attempts to provide its own x86 CPU emulation, so the emulation behaves differently, and is buggier. Also, the temu x86 CPU emulator is not currently open source.

Possible uses for this technology are:

  • Supporting online integrated development environments IDEs to develop system software, without needing to spin up a server.
  • Supporting web-focused build toolchains (e.g. typescript, babel) to compile web projects on-the-fly in the browser
  • Pedagogy: create online classroom environments without needing to spin up a bunch of servers

Built With

Share this project: