Making a simple OS

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.
OutCold

Making a simple OS

Post by OutCold »

Hi. I want to write a very simple OS, preferably in C++. All i want right now is a kernel with a basic input and output function, nothing fancy. How do i do this? Any help would be greatly appreciated.
jrfritz

Re:Making a simple OS

Post by jrfritz »

FritzOS ( not suppose to be here :( i'm busy working on projects... )

anyway, FritzOS has a C++ kernel, compiles easy for Linux, people have used it's code on DGJPP ( on windows ). You can download it's 8th version ( pk0.0 was version 1 ).
here: www.sourceforge.net/projects/fritzos.

It has printf stuff, Print( <int> or <string> or <char> ) stuff and the all the fancy printf stuff you'd need for testing.

All the code is very commented, but not too commented, i.e. it's not 1 meg of just commented code. It is easy to understand though, at least for me and some others...

Bye...
OutCold

Re:Making a simple OS

Post by OutCold »

Thanks, this looks great. I looked over it, but will need to read through it in more detail a little later. One question though, is the assembly ABSOLUTELY necessary? I don't know much assembly (actually thats a lie, i know none) and i would like to try not to use other people's code. Is there any way to do the same stuff in C++?
jrfritz

Re:Making a simple OS

Post by jrfritz »

Actually, you can just use my bootsector and code that uses the assembly, and just skip assembly alltogether. I like assembly abit, that's why I use it.
beyondsociety

Re:Making a simple OS

Post by beyondsociety »

Check this site out:

http://www.nondot.org/sabre/os/articles/TheBootProcess/

Click on the "Making plain binary files using a C compiler"
OutCold

Re:Making a simple OS

Post by OutCold »

I have another question. How exactly do i compile and use your kernel (I mainly use Windows ME, but also have RedHat Linux 7.3)? Do i put all the code for my operating system inside kernel32.cpp, or do i compile the kernel and write a seperate program for the actual OS? Sorry if these questions seem stupid, but im pretty new at this.
jrfritz

Re:Making a simple OS

Post by jrfritz »

Before I can answer, are you using Linux?

And your questions are not stupid...once I asked those ;)
OutCold

Re:Making a simple OS

Post by OutCold »

wow, fast reply. I just edited my message to include my operating system. Using windows ME mainly, but also RedHat 7.3
jrfritz

Re:Making a simple OS

Post by jrfritz »

I suggest you compile my kernel in Linux...do you know Linux command lines?

if so,

all the code that you want to run should be in the kernel32.cpp's start() function. This function acts like main() but returns nothing, and you ALWAYS need "Freeze" at the end of start().

after editing that file, change directories to pk0.7.1/linuxinst

after doing that, but a not used floppy ( can be non blank or blank ) in your first floppy drive, and type

sh install.sh

that's it! reboot, and There is FritzOS working for you! just add your copyright right by mine, and you can do whatever you want with FritzOS, just as long as you don't sell it.
123abc

Re:Making a simple OS

Post by 123abc »

(you can also change the copyright to yourse ;))
OutCold

Re:Making a simple OS

Post by OutCold »

Thanks a lot. I'm doing this for a project at school, so i'm not sure i'll use your code exactly (the assembly should be fine, its a C++ class), but i learned a lot from it. Also, i was wondering whether i can still make objects for my OS. I was reading some other posts, and i read something about needing to write a bunch of stuff to be able to use all the features of C++ or something. Is this correct?
jrfritz

Re:Making a simple OS

Post by jrfritz »

I was just about to tell you that.

Unfortunatly, I didn't include classes support in FritzOS. I will include it soon. also, you cannot use new or delete. I'm sorry, but there is this person called "whyme_t" here that knows how to make classes support.

Whyme_t, could you help?

Also, if you really needed it, I could release pk0.7.2 with classes and new and delete support?
OutCold

Re:Making a simple OS

Post by OutCold »

Being a school project ( :'( ) i'd rather have someone explain to me how to do this than do it for me. Also, i was wondering about how to go about using files in my OS, what filesystem should i use and how do i use it? Thanks again for all the help, i have learned more here in a few hours than a few weeks trying to find tutorials on the internet.
jrfritz

Re:Making a simple OS

Post by jrfritz »

Well, whyme_t has a tutorial that's good and teaches how to make a C++ kernel with run-time support ( classes, new, and delete etc ).

His page uses DGJPP, but you can use the code in linux too...
jrfritz

Re:Making a simple OS

Post by jrfritz »

Oh, forgot about the FS stuff...

to make a FS you need this:
Make a floppy driver After making a IDT.
Use Fat12 code to learn from.

If this sounds like alot, it's time to get books, that's what I'm about to do.
Post Reply