Tuesday, May 25, 2010

Bootloader Emulation

Modifying settings on a boot loader can be somewhat annoying; especially if you are inexperienced at it since you are prone to breaking the bootloader. When a bootloader is broken, often times you are forced to resort to throwing in a LiveCD/DVD and chrooting your filesystem and re-installing a fresh untampered bootloader. This is a time consuming and very annoying process. So...why not run an emulator of your current configuration so that in the event that the bootloader is broken, you know about it before you have to reboot. This allows the user to repair the bootloader in his filesystem rather than chrooting and all that mess that follows.

How do you emulate a bootloader you ask?
Simply download and install "qemu". For sabayon users just:
#equo install qemu


Then when the package is properly installed, run this:
#sync ; echo 3 > /proc/sys/vm/drop_caches ; qemu -hda /dev/sda


This assumes the bootloader is on the MBR. Adjust the command accordingly.

Not too shabby!