How to get QEMU to recognize hard drive

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nlobo
Posts: 1
Joined: Mon Nov 12, 2018 2:35 pm

How to get QEMU to recognize hard drive

Post by nlobo »

Hi!
I'm currently working on an x86 OS and have most of the very basics such as GDT, IDT, console output, keyboard input and a physical memory manager. I would like to start working on reading and writing to disk. However, I have not been able to get grub to recognize the harddrive. I started by following the bare bones tutorial which uses grub to create an iso file and uses qemu to start the os from this file as a cdrom. I've tried adding an additional virtual harddrive when booting qemu and also tried loading grub into a virtual harddrive but I have not been successful with either of these approaches. Can anyone tell me a better way to load the operating system using qemu such that it also can recognize a virtual harddrive? Any reading suggestions would also help.
Thanks!
User avatar
eryjus
Member
Member
Posts: 286
Joined: Fri Oct 21, 2011 9:47 pm
Libera.chat IRC: eryjus
Location: Tustin, CA USA

Re: How to get QEMU to recognize hard drive

Post by eryjus »

If your host is Linux, take a look here. https://github.com/eryjus/century-os/bl ... efile#L113 I'm not sure how well it would translate to cygwin if you are using that.

It took me a while to sort this out to be robust enough to include in make, including setting up sudo to allow password-less commands. You could of course move all this to a shell script.
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
Post Reply