Page 1 of 2

Load the kernel from my bootloader

Posted: Mon Oct 26, 2009 3:06 pm
by CameronD
I'm trying to work out how I load and run my kernel from the bootloader I have created, but I'm not finding anything. The bootloader is written in assembly, and the kernel has a asm entry point, and then is written in C. Can anyone help?
(Btw I'm new at this so please be nice :) )

Thanks

Cameron

Re: Load the kernel from my bootloader

Posted: Mon Oct 26, 2009 3:32 pm
by tantrikwizard
smeezekitty wrote:post your code and please ignore combusto if he tells you you dont have enough experence.
So allow me to tell you that you dont have enough experience. Try searching the wiki before wasting people's time.

http://wiki.osdev.org/Bootloader
http://wiki.osdev.org/Rolling_Your_Own_Bootloader
http://wiki.osdev.org/GRUB

That should get you started and took less than 30 seconds.

Re: Load the kernel from my bootloader

Posted: Mon Oct 26, 2009 3:37 pm
by CameronD
tantrikwizard:
I have read all of those pages, unfortunately none of them helped me too much. Sorry if you feel I am wasting your time and I appreciate you trying to help.

smeezekitty:
At the moment my code is just basic bootloader, switching to protected mode and print something to the screen. And the kernel is something shamefully ripped straight out of a tutorial as well, I'm just hoping to get it all working first.

Thanks

Cameron

Re: Load the kernel from my bootloader

Posted: Mon Oct 26, 2009 4:30 pm
by bluechill
here.

OS Dev tutorial

takes you through the process of making a boot laoder and loading a kernel from a fat12 formatted floppy (kernel is PE) and much more. (did not write it just found it useful very useful).

I'm soon going to be posting some which work with gcc based off of these (the author has said I can) and so if your using gcc your going to have to wait about a week to 2 weeks.

This uses windows

Re: Load the kernel from my bootloader

Posted: Mon Oct 26, 2009 4:33 pm
by neon
Hello,

I am not understanding what the problem is. If you already have a bootloader, just have it load and execute the kernel image. The steps to do this depend on your file system and kernel binary type (Elf, PE, binary, etc.)

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 2:18 am
by gravaera
...so if your using gcc your going to have to wait about a week to 2 weeks.

This uses windows
Hi:

I'm not too sure whether I'm correct in correcting him here, but GCC and windows are two different things. Also, you may use cygwin for a Linux-like environment for development on Windows. Look into that if you will :) .

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 2:26 am
by CameronD
I'm using gcc now under ubuntu, and I have found some samples which tell me i need to put the kernel in the second sector of the disk image, and then call it from the bootloader, I try to do this and just print some text to the screen and it won't work. I'm slightly confused.

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 2:55 am
by Combuster
Anything that tells you what but not why is a failure.

Read again, and maybe go find a better tutorial.

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 3:58 am
by CameronD
I have been searching solidly for the last two days :/. Does anybody know of one that shows (and explains) this process from the ground up?

Thanks

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 4:11 am
by dosfan
In short:

1. Find the kernel on your boot media (fat filesystem, hardcoded sectors etc etc)
2. Read it into memory somewhere
3. Jump to the entry point.

If you didn't know that, you're not ready to write an operating system. Try splitting the functions of a boot sector into smaller programs. For example, write some code that is able to read a file from a FAT filesystem, perhaps under DOS first.

Sorry if this sounds harsh.



Cheers.

Re: Load the kernel from my bootloader

Posted: Tue Oct 27, 2009 4:25 am
by neon
Hello,

What you are wanting to do is not what is recommended. While placing the kernel at a specific sector, and just loading and executing the sector is easier at the beginning, it is harder in the long run.

Nontheless, there is nothing complicated here - just load it and execute it. If it is a sector, load the sector and execute it. If its a file, load the file and execute it. If the kernel is flat binary, to execute just jump to the first byte. If its a specific format, find the entry point and then jump to that. Nothing complicated.

If you need further assistance - please explain exactally what your intentions are (kernel as a file, PE/Elf format, Kernel in a sector, et al..) and what it is that you need help with.

Also, if something "doesnt work" - posting just that is pointless. Programming is all about the details - we cannot help without details.

Re: Load the kernel from my bootloader

Posted: Fri Oct 30, 2009 6:01 am
by ehenkes
You can find both processes here: http://www.henkessoft.de/OS_Dev/OS_Dev1.htm ff.

Re: Load the kernel from my bootloader

Posted: Fri Oct 30, 2009 10:19 am
by XanClic
ehenkes wrote:You can find both processes here: http://www.henkessoft.de/OS_Dev/OS_Dev1.htm ff.
Did you consider he is maybe unable to understand German? :wink:

I don't know if he really is. But the possibility is not too low. One can maybe understand the code without reading the text, but I wouldn't bet on that.

Re: Load the kernel from my bootloader

Posted: Fri Oct 30, 2009 10:32 am
by Andr3w
XanClic wrote:Did you consider he is maybe unable to understand German? :wink:
This tutorial is really good! :) I don't understand German, but I Google Translator translates it to English well! =D>

Re: Load the kernel from my bootloader

Posted: Fri Oct 30, 2009 10:54 am
by XanClic
qandrew wrote:Google Translator translates it to English well!
Then it's all right. :D