ex: kernel.c
#include "stdio.h"
main()
{
printf("Hello World!");
}
I am use DJGPP under WIN2000.
How can i compile kernle.c as my os's Kernle?
how to compile "hello world" as kernel use DJGPP
Re:how to compile "hello world" as kernel use DJGP
1. Write your own printf function.
2. Insert an infinite loop at the end of main.
3. Write some assembly startup code which acts as a bridge between the loader and the C code. This should set up registers, stack, etc.
4. Compile the kernel.c file as normal.
5. Link in the way that your loader expects.
If you have a copy of GRUB (recommended), you'll find a simple hello world kernel there which does the stuff in the list.
2. Insert an infinite loop at the end of main.
3. Write some assembly startup code which acts as a bridge between the loader and the C code. This should set up registers, stack, etc.
4. Compile the kernel.c file as normal.
5. Link in the way that your loader expects.
If you have a copy of GRUB (recommended), you'll find a simple hello world kernel there which does the stuff in the list.