Tuesday 19 July 2016

Initrmfs generator for kdump

Creating a initramfs generator was a part of my GSOC project.

A initramfs is basically a image which is used before root file system get mounted. The kernel simply extract image and uses it as early file system. It sometime contains Microcode for processors. The microcode is applied during boot. The initramfs is basically for advanced users. It's not compulsory. It contains the directory structure of a linux system. It contains any user space utilities, device drivers and mainly the "init" binary which prepares the system. The user generally uses a custom init by help of tools like systemd, which behaved like init. It uses cpio newc format archive as initramfs. This can also be compressed using formats like gzip. This cpio supports device nodes.

For kdump our initramfs's job is to take the dump from /proc/vmcore and save it. The current initramfs for kdump in fedora contains a lot of things which are unnecessary for our purpose. Our job is to create the minimal initramfs.

For this we have to include the necessary things. The systemd unit configuration files, makedumpfile, busybox, usb storage drivers (it takes dump in usb thumb drive). That's what I found necessary till now.

Current kdump user space tool uses dracut for this purpose. dracut puts the necessary things in a folder and creates a cpio archive out of this. Our kdump user space tool puts the necessary things in that temporary folder.
It takes some help of dracut (using dracut functions) for this.


dracut takes modular approach. All the things we want to put in initramfs is in some dracut module. That way dracut can easily takes the decision what to put in the initramfs. The module must include a setup script called module-setup.sh which contains the functions check, install, installkernel which defines if the modules will be included or not and the functionality of modules.

Current kexec tool inserts the extra things (makedumpfile, systemd unit config files etc) which are not present in dracut inbuilt modules by creating a dracut module called 99kdumpbase.

No comments:

Post a Comment