Booting GRUB with a Basic Kernel using QEMU
Booting GRUB with a Basic Kernel using QEMU
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.
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.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Booting GRUB with a Basic Kernel using QEMU
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.
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.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Booting GRUB with a Basic Kernel using QEMU
creating an image by using cat? that seems mightily weird. are you sure everything is the right size and such?
JAL
JAL
Re: Booting GRUB with a Basic Kernel using QEMU
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.
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
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
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.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.
No one here is starting a flame war.flame war, either side will continue thinking they're right. Been there and done that. Lol.
If you can point us to the tutorial that you are using and its demo, that may help.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Booting GRUB with a Basic Kernel using QEMU
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".
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".
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: Booting GRUB with a Basic Kernel using QEMU
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
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.
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
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?
Making the GRUB auxiliary disk
Elf vs Binary?
- Attachments
-
- GrubOnFloppy.zip
- (53.73 KiB) Downloaded 171 times
If you have seen bad English in my words, tell me what's wrong, please.