Problem with booting into kernel.

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
User avatar
awesomeO
Posts: 4
Joined: Thu Aug 06, 2009 5:22 pm

Problem with booting into kernel.

Post by awesomeO »

I've been following the Bran's Kernel Development Tutorial and I am having a problem trying to boot into my little "Hello World" kernel... :( Also I'm trying to use Grub...

Image

I don't understand why that happens ](*,) ......

Has anyone else had this problem, and is there a way to fix it?

Sorry I am a noob to OS development :oops:

Thanks
manonthemoon
Member
Member
Posts: 65
Joined: Sat Jul 04, 2009 9:39 pm

Re: Problem with booting into kernel.

Post by manonthemoon »

It seems GRUB isn't on the disk you are booting. What exactly are you doing to prepare your floppy disk image?
User avatar
awesomeO
Posts: 4
Joined: Thu Aug 06, 2009 5:22 pm

Re: Problem with booting into kernel.

Post by awesomeO »

Well, I am kind of confused of how exactly to make the image. What I did was make the folder /boot/grub with the stage1 and stage2 files inside it and kernel.bin was at the root. Here's what it looks like:

Image

I'm probably doing it wrong :?
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Problem with booting into kernel.

Post by gravaera »

Hi. Not to bash you, but I really don't think you should be trying to compile the source from anybody's tutorial. I'm sure there are members here who will refute that, saying that "As long as you don't wholesale use it in/as your final kernel, it should be okay", but I would advise you to just read. And then read over. And then read over again. Begin to do sketches, and whatnot, and get the concept down. Then write your own, and debug it. Theoretically, if your overall coding expertise isn't bad, you should have a bootable kernel in a day.

Now about the actual problem (which stems loosely from the point outlined above, really), like the poster above me said, it seems like GrUB is not on the image you are loading. However it seems like you are using another, custom bootloader, and that it isn't able to find your disk image.

That's logical, since this bootloader was most likely intended to load from a real, detected disk. GrUB can access a file as an offset. You should try the Bare bones tutorial until you can write a full, 2 staged, proper bootloader.

After eading Bare Bones, you could try to understand it by reading about executable file formats (specifically ELF, and even more specifically the sections you'll see in the ASM file, .text, .data, .BSS, etc.), then move on to understanding Real Mode, etc etc.

Just start searching and reading extensively.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
manonthemoon
Member
Member
Posts: 65
Joined: Sat Jul 04, 2009 9:39 pm

Re: Problem with booting into kernel.

Post by manonthemoon »

I am not familiar with that program. Have you tried using the image provided with Bran's Kernel tutorial? Skip to the last page called "What's Left", and download the floppy image provided. It has GRUB pre-loaded on it, ready to go. Then just replace their kernel.bin with yours and try that.
User avatar
awesomeO
Posts: 4
Joined: Thu Aug 06, 2009 5:22 pm

Re: Problem with booting into kernel.

Post by awesomeO »

manonthemoon wrote:I am not familiar with that program. Have you tried using the image provided with Bran's Kernel tutorial? Skip to the last page called "What's Left", and download the floppy image provided. It has GRUB pre-loaded on it, ready to go. Then just replace their kernel.bin with yours and try that.
I'll try that :)
manonthemoon
Member
Member
Posts: 65
Joined: Sat Jul 04, 2009 9:39 pm

Re: Problem with booting into kernel.

Post by manonthemoon »

gravaera wrote:You should try the Bare bones tutorial until you can write a full, 2 staged, proper bootloader.
Definitely read the Bare bones tutorial, but I would suggest that you don't worry about making a bootloader until you have a kernel. Bootloaders are only a small part of an operating system, and they require you to worry about obsolete hardware issues that will not show up anywhere else in your kernel.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Problem with booting into kernel.

Post by gravaera »

I just saw your previous post (the one you made while I was still typing), and I see that you're developing under a windows environment. I'm not bashing windows, but you're going to have to do some work: Get cygwin (Use google), and whatever other tools (I can't remember them; I use linux) you'll need for windows (the other forum members will most likely mention them), and start going.

You'll need, if I remember correctly, to do a Cross Compiler setup, etc. Anyway: it was nice speaking to you, and if you don't do some reading, you will never really understand what's going on. :wink:

EDIT: And yup: what manonthemoon said: the bootloader can wait. :)
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
awesomeO
Posts: 4
Joined: Thu Aug 06, 2009 5:22 pm

Re: Problem with booting into kernel.

Post by awesomeO »

Well I originally built the kernel on Ubuntu in VMware and I don't know what emulator to use on Linux so I just do the emulation for it on Windows with qemu... (my guess is qemu runs on Linux too I just never looked into it)...

I plan on reading as much as I can to understand all of this OS development, because I've been into 2d game programming with C++ and SDL for a long time and I'm very much bored with that :o

And thanks for the good replies!
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Problem with booting into kernel.

Post by gravaera »

awesomeO wrote:Well I originally built the kernel on Ubuntu in VMware and I don't know what emulator to use on Linux so I just do the emulation for it on Windows with qemu...
Try:
sudo apt-get install bochs-x
(the -x at the end is important, and no, there is no space) or
sudo apt-get install qemu

All the best
-gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Kitsune
Posts: 20
Joined: Wed Aug 05, 2009 7:13 pm

Re: Problem with booting into kernel.

Post by Kitsune »

awesomeO wrote:Well I originally built the kernel on Ubuntu in VMware and I don't know what emulator to use on Linux so I just do the emulation for it on Windows with qemu... (my guess is qemu runs on Linux too I just never looked into it)...
I gotta echo what was said before: read the Bare Bones tutorial, primarily the section about booting the kernel (as you can use the same method with the tutorial you'd been using).

I'd recommend simply building the floppy image on the Linux system, as it's pretty simply to do, and could even be added as part of your build process (that's what I do :)). Whether you attempt to run the kernel inside the guest or not is really a judgement call... it'd probably be easier just to do it inside for now (I personally just use qemu, but bochs is probably better for debugging... either are dead easy to install in Ubuntu), as it'll save you from having to copy the file outside the VM.


Also, after you finish going through the tutorial you're already doing, I'd recommend checking out this tutorial (I can't recall the author's handle... but I'm pretty sure he had Fry as his avatar :P). It goes into quite a lot of detail, probably more than you can take in with a single reading, although it'd make a great reference to come back to later if you get fuzzy on some specifics.
Post Reply