I discoverd this lovley forum a few days ago, have been going trough some off the many many good posts people have been writing. And i now feel ready to dive into writing my own OS.
I have choosen to try to write it in C. Since i have very good knowledge in PHP (pretty much the same as C i have been toled).
What i pretty much want to acive is writing a kernel that displays a text to the screen.
Ive understud that i need a Kernel.c, Link.ld, a bootloader(I will try to use GRUB), Loader.asm
Here is the following code inside off those files i have writen so far.
Kernel.c
Code: Select all
#include<stdio.h>
main()
{
printf("Hi, Testing..");
}
Loader.asm
Code: Select all
; Loader.asm
[BITS 32] ; protected mode (Skyddad mode)
[global start]
[extern _main] ; detta ?r min C kod
start:
call _main ; anropa int main fr?n C koden
cli ;
hlt ; stanna maskinen
Link.ld
Code: Select all
/* Link.ld */
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
Questions now are.
- Will that Kernel.c acutally print that to the screen?
- How would i compile all this? (I use Windows2k)
Regards Veldriss