Custom appliances — TinyCore Shake

4 min read Original article ↗

One application. Just enough OS.

Turn an application into a bootable appliance. This example combines a Genesis emulator, two original games, graphics, keyboard input and sound in one image.

Sega Genesis / Mega Drive

READY TO BOOT640 × 480

Paddle Rally demo preview

Your console is ready

Choose a demo and boot the appliance. Your game runs locally in this tab.

CLICK SCREEN TO PLAY

Boot log

          

Construct the appliance around its job.

Start with the application, its assets, and the devices it actually uses. Build those choices into a bootable artifact rather than installing a general-purpose guest environment.

  1. 1. SpecifyStatic app + assets + device profile
  2. 2. ConstructCustom PID 1 + initramfs + kernel
  3. 3. BootOne application in its own VM
  4. 4. InspectSources, manifests, hashes and runtime evidence

Enough operating system

A stock Tiny Core x86-64 kernel, custom PID 1 and a small initramfs provide framebuffer graphics, keyboard input and AC97 audio. BlastEm is statically linked. The two original cartridges are ordinary application assets.

The app runs as UID/GID 1000 with dropped capabilities and no_new_privileges. The supplied launch profile has no guest NIC, host directory share or writable data disk.

A smaller exposed guest environment

The image has no interactive shell, package manager, SSH daemon, general desktop or background network service. Its application and required drivers are selected at construction time. The website backend is outside the appliance.

The appliance is built for one job: run the emulator with its game assets, display, controls and audio. Selecting these components at build time keeps the guest small, self-contained and focused, with fewer exposed interfaces.

Prior art & related work.

Custom appliances have a substantial history in systems research and embedded Linux. This demo combines a Linux appliance with an explicit boot-control graph specialized by Lean. The projects and papers below explore related ways to select OS components, tailor a VM to one application, and remove unused code.

MirageOS: specialize the whole appliance

Madhavapeddy et al. · ASPLOS 2013

Compiles applications and OS libraries into standalone, specialized kernels. A foundational example of constructing a single-purpose appliance at compile time.

Unikernels: Library Operating Systems for the Cloud ↗

Unikraft: select the OS components

Kuenzer et al. · EuroSys 2021

Organizes OS functionality into selectable micro-libraries, so an application can be built with the components it needs. Relevant to making appliance dependencies explicit at build time.

Unikraft: Fast, Specialized Unikernels the Easy Way ↗

Tinyx & LightVM: tailor a small Linux VM

Manco et al. · SOSP 2017

Tinyx creates trimmed Linux guests tailored to an application; LightVM streamlines Xen's VM control plane. Tinyx is a close precedent for constructing small Linux appliances.

My VM is Lighter (and Safer) than your Container ↗

LinuxKit: assemble an immutable guest

LinuxKit project · Documentation & source

Builds minimal, immutable Linux distributions from a selected kernel and container-based system components. A practical example of assembling a guest from explicit component choices.

LinuxKit project & build documentation ↗

Buildroot: configure a complete Linux image

Buildroot developers · User manual

Generates toolchains, root filesystems, kernels and bootloaders for embedded systems. Its package and kernel configuration offer useful precedents for selecting an appliance's contents.

The Buildroot user manual ↗

TRIMMER: specialize native application code

Sharif et al. · ASE 2018

Uses supplied configuration values and program analysis to remove functionality unused in that context. Relevant to extending the shaker from explicit control graphs into native feature selection.

TRIMMER: Application Specialization for Code Debloating (PDF) ↗

Run the appliance on your own machine.

Download the bootable ISO or the complete native kit. Native QEMU boots the same guest with 256 MiB of guest RAM and no WebAssembly dependency.