Unable to boot from an AHCI hhd in qemu
Posted: Thu Oct 17, 2019 10:33 am
I recently started developing my own bootloader and kernel for educational purposes.
I started out booting from a floppy disk using, and then from a hard drive using
I then started working on an ahci driver for reading / writing from sata hhds.
The problem is when starting qemu using these args (taken from https://stackoverflow.com/questions/483 ... ve-in-qemu)
the bios doesn't seem to find the hard drive, it outputs-
starting qemu with does show the ahci drive, but when I select it it just prints the same output from above.
I tried using qemu 4.1.50 on both linux and windows and 2.8.1 on linux, exact same result in all versions.
A workaround I found (for working on the driver) was using
to boot the kernel. (But I do want to boot from the same hard drive that I interact with) I then enumerate the pci bus and find the ahci controller (as part of the driver initialization). But then reading the active ports' sata status results in an ipm of 0 and det of 1 (the device is present but the connection hasn't been initalized) , which according to AHCI the bios should initialize so for now I assume it's the same issue.
Am I doing something wrong here?
(I also posted this question to stack overflow if you happen to encounter it)
I started out booting from a floppy disk using
Code: Select all
qemu-system-i386 -fda image.bin
Code: Select all
qemu-system-i386 -hda image.bin
The problem is when starting qemu using these args (taken from https://stackoverflow.com/questions/483 ... ve-in-qemu)
Code: Select all
qemu-system-i386 \
-drive id=disk,file=image.bin,if=none \
-device ahci,id=ahci \
-device ide-drive,drive=disk,bus=ahci.0
Code: Select all
SeaBIOS (version rel-1.12.-0-ga5cab58e9a3f-prebuilt.qemu.org)
iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+07F914C0+07EF14C0 C980
Booting from Hard Disk...
Boot failed: could not read the boot disk
Booting from Floppy...
Boot failed: could not read the boot disk
Booting from ROM...
...
Code: Select all
-boot menu=on
I tried using qemu 4.1.50 on both linux and windows and 2.8.1 on linux, exact same result in all versions.
A workaround I found (for working on the driver) was using
Code: Select all
qemu-system-i386 \
-hda image.bin
-drive id=disk,file=other.bin,if=none \
-device ahci,id=ahci \
-device ide-drive,drive=disk,bus=ahci.0
Am I doing something wrong here?
(I also posted this question to stack overflow if you happen to encounter it)