Reduce Size of Initramfs

Table of contents

When I was developing a Linux distribution, I had trouble getting it boot on my machine. I thought I was building the kernel wrong and was generating initramfs wrong. So I took Debian's initrd from my machine and used it to boot. It took some time but it booted. So certainly I was generating initramfs wrong.
After digging around on the Internet, I found the problem lies in the large size of the initramfs. My version was several hundred megabytes. For whatever reason, the large size renders it unable to serve its purpose. The kernel modules are not stripped. Stripping the image solves the issue.
cd /path/to/new-kernel
find . -name *.ko -exec strip --strip-unneeded {} +
Reference: How to reduce the size of the initrd when compiling your kernel?
Subscribe to my newsletter
Read articles from Aditya Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Aditya Kumar
Aditya Kumar
Student