Sunday, 4 April 2010

Modifying your initrd

In the 'mer-efi.tar.gz' which gforums provided, there is a file in efi\elilo, named initrd-2.6.30.

This file is essentially a initramfs, or translated: a gzipped cpio archive. It is referred to in the elilo.conf and provides modules and a script to boot up the system.

However, this initramfs is very tied to a certain kernel version. So, how do you modify it?

To extract the archive, do the following in a directory called initfs, do this as root:

gzip -dc initrd-2.6.30 | cpio -id

This will extract the archive into the current directory (We'll call this /initfs from now on).

You can then modify it as you'd like.

To take a new kernel and update the kernel modules in the initramfs, you can make modules; make modules_install INSTALL_MOD_PATH=/initfs in the kernel source. This will install the updated modules into /lib/modules/ on your initfs and /lib/firmware.

The modules might be a bit big, so thin out any unneeded ones or old modules for kernel versions.

Then, from the same directory, find | cpio -H newc -o | gzip -c > initrd-newname

And you can put this initrd in your efi\elilo directory and change your elilo.conf initrd= line to point to it.

No comments:

Post a Comment