blog/content/post/reduce-size-of-initramfs.md
2023-04-29 12:33:57 +05:30

1.9 KiB

title date lastmod draft keywords description tags categories author comment toc autoCollapseToc postMetaInFooter hiddenFromHomePage contentCopyright reward mathjax mathjaxEnableSingleDollar mathjaxEnableAutoNumber hideHeaderAndFooter flowchartDiagrams sequenceDiagrams
Reduce Size of Initramfs 2023-04-29T12:15:25+05:30 2023-04-29T12:15:25+05:30 false
initramfs kernel initrd
kernel-development
linux
false false false true false false false false false false false
enable options
false
enable options
false

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?