explaingit

jart/blink

7,497CAudience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

A tiny virtual machine that runs x86-64 Linux programs on Mac, Windows, ARM, and RISC-V without needing Linux, plus a visual terminal debugger with rewindable execution history.

Mindmap

mindmap
  root((blink))
    What it does
      Run Linux binaries on other OSes
      Visual terminal debugger
    Blink VM
      x86-64 emulation
      221KB binary size
      JIT compilation
    Blinkenlights debugger
      Animated memory panels
      Register display
      Rewind execution history
    Platforms
      Linux ARM and RISC-V
      macOS Intel and Apple Silicon
      FreeBSD and OpenBSD
    Audience
      Systems engineers
      Embedded developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run a Linux x86-64 binary on a Mac with Apple Silicon without installing a full Linux virtual machine.

USE CASE 2

Debug a low-level C program visually by watching memory and registers animate in the terminal as you step through instructions.

USE CASE 3

Deploy a minimal 221KB emulator on a RISC-V embedded device to run Linux tools without a Linux kernel.

USE CASE 4

Use the rewind feature in blinkenlights to trace back through execution and find exactly where a program went wrong.

Tech stack

CC11GNU Makex86-64 assembly

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a C11-compatible compiler and a modern GNU Make, build follows standard ./configure && make pattern.

Open source under a permissive license, use freely in any project including commercial ones.

In plain English

This repository contains two programs: blink and blinkenlights. Blink is a virtual machine that runs programs compiled for x86-64 Linux on other operating systems and hardware architectures. If you have a Linux binary and want to run it on a Mac, a FreeBSD machine, or a computer with an ARM or RISC-V chip, blink can do that without requiring Linux itself. It works similarly to a tool called qemu-x86_64, but it is dramatically smaller: around 221 kilobytes, compared to about 4 megabytes for the QEMU equivalent. Blinkenlights is a separate visual debugging tool that runs in a terminal window. Unlike a traditional debugger where you type commands and read text output, blinkenlights shows animated panels of memory and registers as you step through a program instruction by instruction. You can scroll and zoom those panels with your mouse wheel. You can also rewind execution history by scrolling over the assembly code display, which makes it easier to trace backwards when something goes wrong. Blink runs on Linux (including ARM, RISC-V, MIPS, PowerPC, s390x), macOS on both Intel and Apple Silicon, FreeBSD, OpenBSD, and Windows via Cygwin. To build it, you need a C compiler that supports the C11 standard and a modern version of GNU Make. The build process follows the standard configure-then-make pattern. A tiny build mode is available that strips the binary down to around 115 kilobytes with no performance penalty, useful if you want to ship blink as a minimal embedded tool. Blink includes just-in-time compilation on supported architectures, which contributes to it running faster than QEMU on several benchmarks, particularly for math-heavy workloads. Optional features like VFS emulation, threads, and extended math support can each be toggled at configure time to further shrink or tune the binary. The project ships with over 700 test programs and passes hundreds of test suites from projects including the Linux Test Project and the Musl Libc test suite. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Show me how to build blink from source on macOS Apple Silicon and then run a Linux x86-64 binary with it.
Prompt 2
How do I launch the blinkenlights debugger to step through an x86-64 program and view memory and register state in the terminal?
Prompt 3
How do I enable the tiny build mode for blink to produce a minimal 115KB binary for an embedded system?
Prompt 4
Walk me through running a Linux x86-64 compiled program on a FreeBSD machine using blink.
Prompt 5
How does blink's JIT compilation work and on which architectures does it kick in to speed up emulation?
Open on GitHub → Explain another repo

← jart on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.