OpenBSD on Firecracker, a 1.4 MB kernel booting in ~30 ms
This is the start about my ongoing port of OpenBSD to Firecracker, the minimalist VMM that AWS uses for Lambda and Fargate. No BIOS, no UEFI, no bootloader, no PCI — just kernel + virtio-mmio.
Original file:
/openbsd-firecracker.mp4.
How small the kernel is on disk
$ du -h bsd.fc
1.4M bsd.fc
$ file bsd.fc
bsd.fc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), \
statically linked, not stripped
The whole OpenBSD/amd64 kernel targeted at Firecracker fits in 1.4 MB, still unstripped. It is a statically linked ELF — there is no dynamic loader, no modules, nothing to resolve at boot.
The kernel config is 31 lines
$ cat FIRECRACKER
machine amd64
maxusers 4
option SMALL_KERNEL
option NO_PROPOLICE
option MULTIPROCESSOR
option MPTABLE_LINUX_BUG_COMPAT
option FFS
option FFS2
option UFS_DIRHASH
option FIFO
option INET
config bsd swap generic
mainbus0 at root
cpu0 at mainbus?
cpu* at mainbus?
ioapic* at mainbus?
mpbios0 at mainbus?
isa0 at mainbus0
pvbus0 at mainbus0
pvclock0 at pvbus?
com0 at isa? port 0x3f8 irq 4
pseudo-device pvh 1
virtio* at mainbus?
vioblk* at virtio?
vio* at virtio?
viornd* at virtio?
scsibus* at scsi?
sd* at scsibus?
pseudo-device loop 1
pseudo-device bpfilter 1
pseudo-device pty 2
$ cat FIRECRACKER | wc -l
31
Only the devices a Firecracker guest actually sees: mainbus,
mpbios, ioapic, pvbus/pvclock, com0 on the serial port,
virtio-mmio
with vioblk/vio/viornd, plus SMALL_KERNEL for a tiny build.
The Firecracker VM spec is one JSON file
{
"boot-source": {
"kernel_image_path": "./bsd.fc",
"boot_args": "root=sd0a"
},
"drives": [
{
"drive_id": "rootfs",
"path_on_host": "./openbsd-shell-rootfs.img",
"is_root_device": true,
"is_read_only": false
}
],
"machine-config": {
"vcpu_count": 1,
"mem_size_mib": 256,
"smt": false
}
}
1 vCPU, 256 MiB of RAM, one rootfs. No firmware blob to load, no PCI topology to describe.
Booting the microVM in ~30 ms
$ firecracker --no-api \
--log-path /tmp/fc.log \
--level Error \
--config-file openbsd-firecracker/configs/firecracker-shell.json
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2026 OpenBSD. All rights reserved. https://www.OpenBSD.org
OpenBSD 7.9-current (FIRECRACKER) #88: Wed Apr 22 18:03:43 -03 2026
root@vm.my.domain:/usr/src/sys/arch/amd64/compile/FIRECRACKER
real mem = 251658240 (240MB)
avail mem = 248250368 (236MB)
mainbus0 at root
mpbios0 at mainbus0: Intel MP Specification 1.4
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD EPYC, 1696.81 MHz, 17-60-01
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 11, 24 pins, remapped
pvbus0 at mainbus0: KVM
pvclock0 at pvbus0
virtio0 at mainbus0 addr 0xc0001000 irq 5: Virtio Block Device
vioblk0 at virtio0
scsibus0 at vioblk0: 1 targets
sd0 at scsibus0 targ 0 lun 0: <VirtIO, Block Device, >
sd0: 16MB, 512 bytes/sector, 32768 sectors
isa0 at mainbus0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
root on sd0a (5134baf29d195b08.a) swap on sd0b dump on sd0b
OpenBSD/firecracker
ijanc# uname -a
OpenBSD 7.9 FIRECRACKER#88 amd64
ijanc# sysctl hw.model
hw.model=AMD EPYC
ijanc# sysctl hw.ncpu
hw.ncpu=1
ijanc# sysctl kern.osversion
kern.osversion=FIRECRACKER#88
From firecracker fork/exec to the ijanc# shell prompt, the
kernel comes up in roughly 30 ms. PVH entry jumps straight into
32-bit protected mode, no real-mode BIOS, no
UEFI firmware, no bootloader stage.
Where this is going
The guest is past the "prints a line on the serial" phase: I already
have sshd(8) accepting connections over virtio-net and httpd(8)
serving traffic from inside the microVM. Right now I'm wiring up the
Firecracker guest-facing features — starting with
MMDS
(the Firecracker Micro Metadata Service), so the OpenBSD guest can
pull instance metadata the same way a Lambda / Fargate workload
would.
I'll publish a series of posts walking through the whole path — PVH entry, bootargs, mpbios/mainbus, virtio-mmio, FFS2 rootfs, networking, MMDS — and I'll ship the consolidated patch set so anyone who wants to reproduce it (or just poke at OpenBSD/amd64 as a Firecracker guest) can do so.