Create an operating system in C#!



Create an operating system in C#!



Have you ever wanted to make your very own operating system? Well you've come to the right place - sit down and relax and I'll take you though how to make one that with run in QEMU. I should mention - it is fully managed code, including the kernel - the C++ fanboys will be REAL "happy" that you can do this :P

For this tutorial, I will assume you have at least moderate knowledge of C# and the Visual Studio IDE. (I am using the Visual Studio 2008 C# Express Edition)
I have attached some photos to help explain what I'm doing.
1. First goto Gocosmos.org and download the Cosmos User Kit (this is what I'm using for the tutorial not the DevKit)

2. Once you have the setup file.... set it up :P It all sets up just like a normal application install, until Visual Studio has its way. A dialog will come up (pic1.jpg) click Next on it.

3. Visual Studio will give you a warning about a unsigned content file that could contain harmful code - it doesn't so just click Yes. (pic2.jpg)

4. It will say "Installation complete successfully", click Close.

5. Open up Visual Studio, you will notice you now have a new template installed called CosmosBoot, click it and press ok.

6. In the Program.cs file there will be a line below Cosmos.Kernel.Boot.Default(); - replace it with Console.WriteLine("Hello World"); (pic3.jpg)

7. Goto the debug menu, and press Start without debugging.

8. A little console window will show up, and then a white dialog. On the white dialog just leave everything as it is and press "Build".

9. A lot of text will now show up, the Cosmos kernel and your part of the OS (hello world outputed if you done step 6) is being converted to assembly language and then it will be compiled by NASM (which is installed with Cosmos).

10. QEMU will start booting up, QEMU is a PC Emulator. Once done it should display, "Init Keyboard" and then "Hello World". (pic4.jpg).

And thats all there is to it, to build more onto it, just edit the area where you put the Console.WriteLine("Hello World"); part.

Enjoy building your own operating system in C#!

No comments:

Post a Comment