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.
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 )
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.
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.
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.)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
...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 .
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
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.
Anything that tells you what but not why is a failure.
Read again, and maybe go find a better tutorial.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
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.
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.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Did you consider he is maybe unable to understand German?
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.