Having used Xen and its
pygrub for a while, I'm now trying to do something similar with KVM/qemu.
Basically, I have a LVM logical volume (though that could as well be a file) that contains the root filesystem of a Linux distribution (no partitioning, just FS directly on disk) which also contains a /boot/grub/grub.cfg, and I'd like to be able to boot that.
I was under the impression that the grub-firmware-qemu package on Debian/Ubuntu was intended for that, but I have not managed to make it work. AFAICT, the grub.bin image contains a hardcoded memdisk with a grub.cfg file with a few menu options (like search for a multiboot.img or search for a grub.cfg), but all I get when running
kvm -bios grub.bin is an "incompatible license" error message. And I'm not too sure how to generate a different
grub.bin with a different grub.cfg (one that would only do
Of course, I could create a floppy or cdrom or disk image with a minimal grub configuration that does just that but I've got the feeling that there should be a cleaner/canonical way to do it and my research has brought back very little so far.
I suppose one could use qemu's
-kernel option as well, but again, I don't know how to generate a
grub.img for that. (using a grub.img generated with
grub-mkimage -O i386-pc -o grub.img -c =(echo 'configfile (hd0)/boot/grub/grub.cfg') /usr/lib/grub/i386-pc/*.mod brings up the same "incompatible license" error message again).
That's on debian with version 1.99-23 of the grub packages and 1.1.2+dfsg-2 of kvm/qemu.
So, in short, how should I go about creating either a grub.bin (to be used with
kvm -bios) or a grub.img (to be used with
kvm -kernel) to have kvm boot a grub image that is able to parse the /boot/grub/grub.cfg on the virtual disk?