Page 1 of 1

Setting QEMU Disk Geometry

Posted: Mon May 17, 2010 4:22 am
by jasonc122
Hi,

I've got a FAT32 boot sector driver which works fine on real hardware but not on QEMU. The driver loads sectors correctly on real hardware but not when I use QEMU.

This bootsector is installed on a usb stick with a sector size of 512 bytes and a capacity of 4GB. Does QEMU use larger sector sizes for images greater than the size of a floppy? How can I get QEMU to see the usb stick as a great big floppy?

To get the usb stick to boot on real hardware I get the BIOS to boot from a USB FDD device.

I use the following commands for qemu:

qemu /dev/sdb
qemu usb.img
qemu -drive file=usb.img if=floppy index=0

TIA

Re: Setting QEMU Disk Geometry

Posted: Tue May 18, 2010 5:16 am
by Brynet-Inc
jasonc122 wrote:Hi,

I've got a FAT32 boot sector driver which works fine on real hardware but not on QEMU. The driver loads sectors correctly on real hardware but not when I use QEMU.

This bootsector is installed on a usb stick with a sector size of 512 bytes and a capacity of 4GB. Does QEMU use larger sector sizes for images greater than the size of a floppy? How can I get QEMU to see the usb stick as a great big floppy?

To get the usb stick to boot on real hardware I get the BIOS to boot from a USB FDD device.

I use the following commands for qemu:

qemu /dev/sdb
qemu usb.img
qemu -drive file=usb.img if=floppy index=0

TIA
That's ridiculous, you're telling QEMU you have a 4GB floppy disk.. which do not exist, set that to 'ide'.

On a system with USB boot capability, the BIOS/chipset does some trickery.. and pretends to be a floppy when manipulated using BIOS interrupts, but it is not actually on the floppy controller.

What you should be doing is treating the USB device as a hardrive, installing a complete MBR along with a partition record spanning the entire medium, along with a filesystem.

You can tell QEMU CHS geometry using the cyls/heads/secs arguments to -drive, or by using -hdachs in older versions.. it can automatically guess those.

Re: Setting QEMU Disk Geometry

Posted: Thu May 20, 2010 11:35 am
by jasonc122
Thanks.

I used the cyls/heads/secs arguments to set disk geometry and still no luck. Until such times as QEMU performs some trickery by supporting USB FDD, I'll be using the el torito format to boot my OS.

Thanks again.