Most Linux distros ship with GRUB or systemd-boot. But what if you could boot the kernel itself as an EFI executable, with no bootloader in between?
In this article I'll show how I built crabOS — a minimal Linux system that boots as a Unified Kernel Image (UKI), where the kernel + initramfs + cmdline are packed into one EFI binary.
The boot flow
UEFI firmware → /EFI/BOOT/BOOTX64.EFI (kernel + initramfs + cmdline) → kernel boots, unpacks initramfs → /init runs, starts shell
No GRUB, no systemd-boot, no intermediate bootloader. The kernel is the bootloader.
How UKI works
A UKI is a PE/COFF executable (the same format as .exe on Windows) that contains:
- The Linux kernel (bzImage)
- The initramfs (cpio.gz)
- The kernel command line
- An OS release section (optional)
UEFI firmware loads this as a regular EFI application, and the kernel boots itself.
Building the UKI
I used ukify from systemd (or objcopy as a fallback):
ukify build --linux=bzImage --initrd=initramfs.cpio.gz --cmdline="root=PARTUUID=4352424f-02 rootwait rw init=/init" --output=BOOTX64.EFI
Then place it at /EFI/BOOT/BOOTX64.EFI on the ESP (FAT32 partition).
The catch: no command line from firmware
When UEFI boots \EFI\BOOT\BOOTX64.EFI directly, it passes no command line. So root= must be built into the kernel via CONFIG_CMDLINE:
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=PARTUUID=4352424f-02 rootwait rw init=/init"
This works, but it's fragile — if you change the disk layout, you need to rebuild the kernel. A better approach would be to discover root by label/UUID from initramfs, or use a real bootloader. That's next on my roadmap.
The stack
- Kernel: Linux 6.18.65 (EFI stub enabled)
- libc: musl 1.2.6 (static toolchain)
- Userland: BusyBox 1.38.0, statically linked
- Installer: written in Go (static, CGO off)
- Packages: apk against Alpine v3.23 repos
What's inside the live system
- UKI boot (kernel + initramfs + cmdline in one EFI binary)
- Go installer that writes MBR, creates ESP (FAT32) + ext2 root
- UTF-8 console with Cyrillic font and us/ru/ua layouts
- DHCP on boot, apk add htop works from the live ISO
- Experimental X11 via crab-x (starts Xorg on a real VT)
- ~42 MB RAM after boot, ISO is 106 MB
Try it in 30 seconds
qemu-system-x86_64 -m 1G -cdrom crabos.iso -bios /usr/share/edk2/ovmf/OVMF_CODE.fd
Or clone the repo and run ./run.sh — it sets up OVMF and a 4 GB test disk for you.
VirtualBox: Linux 64-bit, ≥1 GB RAM, EFI enabled, Secure Boot off.
Build from source
./build.sh # kernel + musl + static BusyBox + initramfs
./build-iso.sh # hybrid ISO (UEFI; BIOS if isolinux is installed)
./run.sh # live boot in QEMU
./run.sh disk # boot the installed system via UEFI/OVMF
Host deps (Fedora names): gcc make wget cpio tar flex bison bc perl, xorriso mtools dosfstools syslinux, systemd-ukify, qemu, kbd, terminus-fonts-console.
Everything user-facing lives in overlay/, configs in configs/.
Honest limitations (0.1)
- x86_64 + UEFI only; image is unsigned, Secure Boot must be off
- Tested in QEMU and VirtualBox only — no bare metal yet
- MBR partitioning: disks >2 TiB are partly wasted
- Whole-disk install, no dual boot
- Root PARTUUID is hardcoded in CONFIG_CMDLINE — first thing to fix in 0.2
What I learned
- UKI boot is surprisingly simple — no GRUB config, no bootloader maintenance
- EFI stub kernels are the future for minimal systems
- The tradeoff: hardcoded CONFIG_CMDLINE is fragile, but good enough for 0.1
- Static BusyBox + musl gives you a ~42 MB RAM footprint after boot
- Writing the installer in Go was a good choice — static binary, no runtime deps
Resources
- ISO and GPL sources: https://github.com/mango5512xxx-crypto/crabOS/releases
- Source code: https://github.com/mango5512xxx-crypto/crabOS
- Verify ISO: sha256sum -c SHA256SUMS or gh attestation verify crabos.iso --repo mango5512xxx-crypto/crabOS
If you're building a minimal Linux or embedded system, UKI boot is worth exploring. No more "which bootloader do I use?" — the kernel is the bootloader.
I'm the author of crabOS. This is a learning project — I wanted to understand the boot chain from kernel to initramfs without remastering someone else's work. Feedback welcome, especially on root discovery by label/UUID from initramfs vs using a real bootloader.

Top comments (0)