Hello,
recently I was looking for a way to boot a xen linux guest in qemu in
order to upgrade it with a cdrom. I've posted my
problem on the forum and since there wasn't any answer until couple of
hours ago I programmed a qemu block driver myself.
Following the FAQ about booting
from partitions I came to a qemu-devel mailing list's thread about using
partition images, where Jim Brown posted an experimental patch
which supports just one partition.
My patch is based on the same idea, but it supports up to four
partition (which is the maximum actually). The partition table could be
automatically generated or left unchanged. An image file could be used
for the MBR, which could provide a boot code or just to keep changes
made to the MBR. A partition is defined with a disk image, partition
type (fs id) and status (active / non-active). Those values are only
used if partition table generation is requested. Any qemu-supported
image format could be used as disk image. I think it's also possible to
use this in some sick recursive way, but I didn't test that.
The block driver uses a mini config file as already suggested on the mailing
list thread. The format of the config file is described in the
patch itself. Example: "qemu -hda multi:mymultipart.img", where
'mymultipart.img' is the config file.
I already did some testing and everything seems to be working fine.
I'll try it tomorrow with the xen guests, which I have to upgrade .
I'll be glad if more people give this driver a try and review the code.
I find this a nice feature which could be included in qemu and which
could change the FAQ's short answer to 'yes' :-).
best regards,
Aleksandar Kanchev