Page 1 of 1
bootloader, linker, and kernel.
Posted: Mon Nov 02, 2009 9:18 am
by Nekrose483
to start out, i have written a VERY SIMPLE bootloader with the help of a few tutorials. some of the code was even copied. anyway, its "loader.bin" and its loaded into the floppy where its supposed to be to be bootable in the first segment of memory. its all nice and good and it works. it then calls the second segment whitch has the kernel (also written in ASM). the kernel is very simple and only has about three commands. problem is, i want to write it in C++. i don't know what to do. i've looked at pages and i've found stuff like "linker.s" but truthfully, i dont know what to do with it. i just want clear steps like, first off... I have the bootloader, it makes the computer turn on, now what do i do? is there any tutorials that include the bootloader all the way to writing the kernel in c++? if you want to see my code for the bootloader and kernel, i can post it if you want to take a look. (i just dont have it right this second. its on my windows box at home.) also, i am using emu8086 and NOT nasm. i seems ALOT easyer and it comes with an emulator already.
Re: bootloader, linker, and kernel.
Posted: Mon Nov 02, 2009 9:22 am
by oib111
Look at
this. You may also want to look at some tutorial's over at brokenthorn.com. They cover programming a kernel in C++.
Re: bootloader, linker, and kernel.
Posted: Mon Nov 02, 2009 1:15 pm
by Combuster
To answer the exact question, there is no tutorial that covers both a bootloader and a high-level-language kernel together.
What you will need is to determine where the kernel will be located, where it comes from, and what the state of the computer is when control is transferred. Most people use multiboot as this standard, which allows them to use an existing bootloader (read:
GRUB) and skip that part altogether.
Possible course of action:
- make a specification for your bootloader
- compare the specification with multiboot
- adapt the
C++ Bare Bones (which you can find on the wiki) to reflect the differences.
Note that in all cases, you need some assembly to setup the processor for a higher-level-language, and some form of custom linking to make everything fall into place correctly.
Re: bootloader, linker, and kernel.
Posted: Tue Nov 03, 2009 12:05 pm
by Nekrose483
Combuster wrote:To answer the exact question, there is no tutorial that covers both a bootloader and a high-level-language kernel together.
heh, i noticed. :\ i've done ALOT of searching so far, read most of this wiki (didnt understand most of it) the the linux from scratch kit etc etc and downloaded ALOT of opensource OS's. im beginning to understand this concept more clearly and thank you, you both for the help. and the links. that really helped