It is possible, but I couldn't tell ya. I program my OS exclusively in ASM. I recommend writing the bootloader in ASM for now if you don't get an answer fast enough, since the only thing that you'll be messing with most of the time is the kernel, which I suppose is written in C, correct?
Besides, the only thing you need to change is how many sectors the loader reads.
How to load karnel from a bootloader?
- ClarionCoder51
- Member

- Posts: 28
- Joined: Sun Aug 16, 2009 11:52 am
- Location: Georgia, USA
Re: How to load karnel from a bootloader?
"The n00b zone is for loading and unloading newbies only."
- Combuster
- 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: How to load karnel from a bootloader?
Please, if you suggest something especially promoting bad practice, please tell why. Especially when someone else says otherwise.
- ClarionCoder51
- Member

- Posts: 28
- Joined: Sun Aug 16, 2009 11:52 am
- Location: Georgia, USA
Re: How to load karnel from a bootloader?
And what would be "bad practice" that I am telling electritwist? (hope I spelled that right)
"The n00b zone is for loading and unloading newbies only."
Re: How to load karnel from a bootloader?
Hello,
This method is a little tricky, but works quite well. Perhaps a method like this can help? There are other methods, so keep your options open
What is it that you are having trouble with? Just read up on your boot file system and have your bootloader parse it and load the kernel into memory.Thank you all for the answers, but they didn't help me out, I'm trying to figure it out with a friend.
What I do in my bootloader is prepend an assembly program to my PE program (my bootloader written in C). The assembly program does basic tasks such as going into protected mode, enabling paging, etc and is responsible for relocating the PE program and executing it. It is possible to create an interface that will allow the C program to interact with the BIOS via RMode as well if needed.off topic: Can anyone give me an easy and short example of how to write boot loader written with C language? Is it even possible?
This method is a little tricky, but works quite well. Perhaps a method like this can help? There are other methods, so keep your options open
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();}