Skip to content

Instantly share code, notes, and snippets.

@ahhajlou
Last active June 7, 2025 18:04
Show Gist options
  • Save ahhajlou/9b2547cd8bfa7fcf53c061e04833e703 to your computer and use it in GitHub Desktop.
Save ahhajlou/9b2547cd8bfa7fcf53c061e04833e703 to your computer and use it in GitHub Desktop.
# Create initramfs without compression
# Run this command from within the rootfs directory; it will generate `initrd.cpio` in the parent directory.
find . | cpio -o -H newc >../initrd.cpio
# Create initramfs with gzip compression
# Run this command from within the rootfs directory; it will generate `initrd.cpio` in the parent directory.
find . | cpio -o -H newc | gzip >../initrd.gz
# Extract initramfs archive to current directory
cpio --extract --make-directories --format=newc --no-absolute-filenames < rootfs.cpio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment