[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to create qemu-bootable image using debootstrap?



Andrei Popescu wrote:
On Sun, Jul 06, 2008 at 11:34:52PM -0700, David Barrett wrote:
Carl Fink wrote:
On Sun, Jul 06, 2008 at 09:00:38PM -0700, David Barrett wrote:
David Barrett wrote:
What's the best way to create a raw disk image using debootstrap that can be booted with qemu?
Following up on my previous post: I've figured out some of the steps, but I'm stuck on installing Grub. Do you know how to install grub on a raw device file?
Forgive a silly question, but why do you want to install grub on the image? Are you planning to dd it onto a physical disk?
No, I'm just going to use it as a QEMU image. It'll stay virtual, but it'll need to boot all the same. Unless there's some way to get it to boot without grub?

If I recall correctly, qemu can boot a linux kernel directly so you *probably* don't need grub.

Aha!  I completely forgot about those options.  This works great:

sudo qemu -kernel-kqemu -kernel newtest.mount/boot/vmlinuz-2.6.18-6-486 -append "root=/dev/hda1 ro" -initrd newtest.mount/boot/initrd.img-2.6.18-6-486 newtest.raw

It makes the command line a bit awkward, but does the trick. This is great workaround, thanks!

That said, if possible, I'd still like to get grub installed to make it self-contained and boot up like normal (else I need to update all the startup scripts to be aware of the exact kernel version).

One way would be to boot the VM with the above trick and then install grub from the inside... but there's *got* to be a way to install it from the outside, straight into the raw image.

Joey's idea of grub-mkdevicemap sounds good; I'll need to look into that more.

Thanks everyone for all the help!

-david


Reply to: