bootloader, linker, and 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
Nekrose483
Posts: 7
Joined: Sun Nov 01, 2009 5:00 pm
Location: Deutchland

bootloader, linker, and kernel.

Post 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.
–Nekrose
oib111
Member
Member
Posts: 55
Joined: Fri Sep 04, 2009 12:39 am

Re: bootloader, linker, and kernel.

Post 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++.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: bootloader, linker, and kernel.

Post 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.
"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 ]
User avatar
Nekrose483
Posts: 7
Joined: Sun Nov 01, 2009 5:00 pm
Location: Deutchland

Re: bootloader, linker, and kernel.

Post 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
–Nekrose
Post Reply