Size of modules within initrd

Posted by LiKao on Server Fault See other posts from Server Fault or by LiKao
Published on 2012-11-14T15:20:11Z Indexed on 2012/11/14 17:05 UTC
Read the original article Hit count: 240

I am currently trying to manually replace the kernel within ubuntu-core on an embedded device with a custom kernel. However when I try to update the initrd my initrd becomes much bigger.

Here is what I did:

  • Extract the initrd that was shipped with ubuntu
  • Make a list of all modules within the old initrd
  • get the same modules from the new module director at /lib/modules/new_kernel_version
  • add these modules to the initrd and remove the old ones

If I do this my initrd becomes quite bigger than the original one, so I checked the individual modules. I picked the btrfs.ko filesystem driver as an example. So by comparing these two modules I noticed the one I just picked into the initrd was much bigger, which caused the difference in size.

-rw-r--r-- 1 root root 999K Nov 14 15:06 btrfs.ko

For the btrfs.ko within the shipped initrd.

-rw-r--r-- 1 root root 7.2M Nov 14 15:08 btrfs.ko

For the new btrfs.ko.

What is different between these two modules? Could this be caused by some faulty setting for the new kernel? When producing the kernel I copied /proc/config.gz and used make oldconfig to update it, so all optimisations should be the same for both kernels.

Or is there something else which is being done to the modules before they are put into the initrd? Maybe is there even some better way to build a new initrd for the new kernel in ubuntu altogether.

Update:

I just also tested with an initrd which I created from scratch using the mkinitrfs command within ubuntu, and it has the same size difference that I found for the initrd I manually updated.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about linux-kernel