Page 1 of 1

Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 5:56 am
by romasi
I created a floppy.img file using the cat command with the files: stage1, stage2 (GRUB), pad, and kernel.bin (created from link.ld, kernel.o (from kernel.c) , and start.o (from start.asm) ) given by one of the tutorials. However, when I use QEMU to load the floppy.img file "qemu -fda floppy.img", input "kernel 200+18" at the GRUB command line (as the author instructed) and input "boot" it hangs. I've even divided the number of bytes used by kernel.bin by 512 and rounded to the nearest digit to make it "kernel 200+10" and it still hangs. I'm not sure if there is a command argument I'm suppose to use to print out the error and if so I will gladly post that information as well.

I'm quite new to OS and bootloader programming and would rather just deal with the kernel at this point then having to implement a custom bootloader when I think GRUB is great already.

Thanks.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 6:44 am
by gravaera
You haven't really given sufficient information, you know. After you load your executable, nothing is really supposed to happen except for what you programmed your executable to do.

You should have stated why you believe that the fact that nothing displays is a problem (for example: "I have created a basic vga_text_mode driver, and it's supposed to clear the screen on load, but nothing happens"). You won't see any visible changes until you make them happen. From the information you've given, I can't see anything wrong with your setup.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 7:16 am
by jal
creating an image by using cat? that seems mightily weird. are you sure everything is the right size and such?


JAL

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 8:39 am
by romasi
The kernel is suppose to give option for clearing the screen and entering characters. I am not prompted for any of these things. Furthermore, an OS, regardless of how basic it is, would be worthless if it did not provide some sort of functions to validate that it is working (especially as a tutorial) so I highly doubt it's suppose to do nothing. Lastly, the tutorial stated using the cat command to create the floppy.img (under linux obviously). Total size of floppy.img came out to being roughly 107KB.

PS: You can't win a flame war, either side will continue thinking they're right. Been there and done that. Lol.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 9:07 am
by torshie
You should try to let your kernel only print something on the screen, because that's MUCH easier than prompt you to enter some characters.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 10:38 am
by neon
romasi wrote:Furthermore, an OS, regardless of how basic it is, would be worthless if it did not provide some sort of functions to validate that it is working (especially as a tutorial) so I highly doubt it's suppose to do nothing.
Not necessarily. For a tutorial. the tutorial might have focus on booting itself, which is enough material to warrant a basic bootable kernel or bootloader that does nothing. This is one of the reasons we need to ask what the program is supposed to do - else we will not know.
flame war, either side will continue thinking they're right. Been there and done that. Lol.
No one here is starting a flame war.

If you can point us to the tutorial that you are using and its demo, that may help.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 12:18 pm
by gravaera
He's using the Bare Bones Tutorial. That's where he got the idea about the cat stage1 stage2 pad my_os.bin >floppy.img from.

It works, since I used it in the first month or so of my own Dev-ing.

@OP: A real, purpose driven kernel would, yes, have self checks and whatnot, but not a tutorial stub...and definitely not one contained in a tutorial titled "OSDev BARE BONES".

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 1:04 pm
by Kitsune
How do you attempt to print to the screen? Some code would definitely help with figuring out what's going wrong.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Wed Aug 12, 2009 3:10 pm
by tharkun
I don't think it's hanging, I think he's just looking in the wrong place.
An 'A' should appear in the top left corner of the screen, not at the cursor position.

Re: Booting GRUB with a Basic Kernel using QEMU

Posted: Thu Aug 13, 2009 12:39 am
by egos
Maybe you will use a fully ended FS instead of that one. I can recommend to do this by using fasm.
Making the GRUB auxiliary disk
Elf vs Binary?