Page 1 of 1

How to make an OS in C

Posted: Thu Aug 01, 2002 2:55 pm
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] :) :)

Re:How to make an OS in C

Posted: Thu Aug 01, 2002 7:48 pm
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'