I am learning the basic of OS making. I have made a multi boot header compliant .asm file and a .c file. The code in the .asm file calls the main function of .c file.
The problem is that QEMU is unable to boot from the file produced after the compilation and linking of the .asm and the .c file .
It simply says that it can't find a bootable device.
Although, I am able to boot from a simple .asm file like :-
mov ax, 0x0e
mov al, 'H'
times 510 - ($ - $$) db 0
QEMU doesn't have native support for multiboot. Instead, you'll need to create a virtual hard drive image and install some sort of multiboot boot loader (such as grub), then put your multiboot image somewhere on the drive (i.e. in a file on a partition).
As far as actually installing grub onto a virtual HDD, there's multiple ways to do it, but here's the process I always use:
dd if=/dev/zeroto create your HDD image.
qemuwith the blank HDD image and ISO using
-hda <HDD-image-filename> -cdrom <ISO-file-name> -boot once=d. The last bit ensures
qemuwill try to boot from CD first.
parted/etc to format the disk.
Then, you'll be able to boot off the HDD image and use grub or whatever loader you choose to boot your multiboot image.
The reason your simple ASM example works is because you're effectively emulating the MBR, the first sector of a typical hard drive, so QEMU's BIOS will boot from it (specifically, it sees that