mkinitrd
A handy way to run a program as init without a filesystem:
#! /bin/bash
set -e
set -u
set -x
rm -rf initrd/
mkdir initrd/
g++ -static [...] -o initrd/init main.cc
(cd initrd/ && (find | cpio -o -H newc)) \
| gzip -c \
> initrd.gz