# Create a minimal initramfs with 'find

**Date:** 2025-12-16  
**Tags:** Linux, Kernel, Boot  
**URL:** https://kelexine.is-a.dev/til/linux-initramfs

---

TIL: Create a minimal initramfs with 'find . | cpio -o -H newc | gzip'. The kernel extracts this to RAM before mounting real root. Perfect for custom recovery environments or embedded systems. Just need /init as the entry point.


```bash
# Create initramfs from directory
cd rootfs/
find . | cpio -o -H newc | gzip > ../initramfs.cpio.gz

# Boot with QEMU
qemu-system-x86_64 -kernel bzImage -initrd initramfs.cpio.gz
```




---

*This content is available at [kelexine.is-a.dev/til/linux-initramfs](https://kelexine.is-a.dev/til/linux-initramfs)*
