I read the following tutorial on C++ Kernels here and I understand everything (except the part about setting up global variables, but I'll learn that later).
This kernel seems simple enough but that is about the extent of my knowlege. I am new to OS dev (tried to read some tutorials) but many of them are difficult to understand and overall it's hard to figure out just where everything fits together.
Basically I would like to understand how to get from nothing(where I am now) to that kernel operating. I read some tutorials on bootloaders but none which got to the point of loading a kernel.
So I guess what I really need is:
How to I create a basic bootsector/loader
How do I use it to load a C++ kernel (as in above tut)
Anything else needed inbetween.
C++ Kernel - Understood but now what??
Check out my site:
OS Development Series
It covers creating a basic 2 stage bootloader from scratch, and loads a basic 32bit kernel; specifically meant for beginners to systems programming.
Please note that it is still being worked on. Im not quite up to the C/C++ Kernel yet, but it sets up the system so that one can.
If you wanted to, you can also use an existing bootloader, such as GRUB, to boot your C++ Kernel. This way you can start at the Kernel, and not worry about the ugly bootloader code.
OS Development Series
It covers creating a basic 2 stage bootloader from scratch, and loads a basic 32bit kernel; specifically meant for beginners to systems programming.
Please note that it is still being worked on. Im not quite up to the C/C++ Kernel yet, but it sets up the system so that one can.
If you wanted to, you can also use an existing bootloader, such as GRUB, to boot your C++ Kernel. This way you can start at the Kernel, and not worry about the ugly bootloader code.
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();}
Unless you are really good with assembly and know how to read and write to disks without an OS present I would recommend using GRUB. This is coming from a person who spent 3 weeks debugging his kernel only to find that the boot loader was overwriting a portion of the kernel code with its stack. GRUB has thousands of hours of testing and debugging and will save you a lot of trouble.
EDIT: Although you may want to write a small hello world boot loader just for the experience. But don't spend too much time on it.
EDIT: Although you may want to write a small hello world boot loader just for the experience. But don't spend too much time on it.
GRUB is the way forward. There are actually much better C tutorials out there than C++, so I recommend that you firstly get hello,world working in C, then port straight to C++ (it's not a lot of work at that stage). Might save you some grief.
If you've tried the barebones and Bran's tutorials, maybe these might help:
http://www.jamesmolloy.co.uk
EDIT: these use GRUB, by the way, and talk you through how to use it properly.
They're 'basic-get-me-started-quick' tutorials I cooked up in some free time at work. Haven't got too far - up to the GDT and IDT, but it'll get you going. Sample code provided of course.
Once you have a C kernel up (that can print to screen, for example), read the C++ barebones article on the wiki and implement what it says.
Happy coding!
If you've tried the barebones and Bran's tutorials, maybe these might help:
http://www.jamesmolloy.co.uk
EDIT: these use GRUB, by the way, and talk you through how to use it properly.
They're 'basic-get-me-started-quick' tutorials I cooked up in some free time at work. Haven't got too far - up to the GDT and IDT, but it'll get you going. Sample code provided of course.
Once you have a C kernel up (that can print to screen, for example), read the C++ barebones article on the wiki and implement what it says.
Happy coding!