How to make an OS in C

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
Corey M

How to make an OS in C

Post by Corey M »

:) :) I would like to know how to write my own OS (i need a tutorial or something). If anyone has any info, reply, or
email me.

EMAIL [glow=green,2,300][email protected][/glow] :) :)
Matt aka Kernel

Re:How to make an OS in C

Post by Matt aka Kernel »

Simple. Just make a C file like this:

/* Kernel.c- my little pointless OS */

void main(void) {
/*code here. Note: You cant use functions like printf.
/*You have to re-write these for your OS
for(;;); /* Hang Here because there's nowhere else to
/* go.
}

Compile with gcc like this:
gcc -O3 -c Kernel.c

Then, link with JLOC like this:
jloc kernel.ld kernel.bin

your linker file (kernel.ld) should look like this:

ALL:
kernel_c.o
START: 0,0FF800000
,,code,,kernel_c.o
CODE: 0
,,code
DATA: 0,#10
,,data
BSS: 0,#10
,,bss

Now, put Kernel.bin onto a floppy, then download a protected mode bootsector. BOOTF02 is a good one. Try searching google for 'Bootf02'
Post Reply