Introduction: Create Your Own Operating System!
Nearly every true computer geek has, at some point, wanted to write an operating system. However, writing a custom kernel and other bits takes years of study, experience and patience. If you intend to keep your sanity, then the best course of action is to use someone else's code.
Cosmos*, or C# open source managed operating system, is a pre-made kernel that provides you with "OS legos" that allow you to quickly and easily create your own operating system.
You will need:
@ Microsoft Visual C# 2008.
@ A knowledge of the C# programming language (don't worry if you don't have this, it's a pretty easy language).
@ The Cosmos user kit (milestone 4).
Step 1: Getting the Software
Let's do a run down of the necessary software mentioned earlier.
Microsoft Visual C# can be downloaded free if you get the express edition. You can download it at http://www.microsoft.com/express/downloads/ You can also download the entire Visual Studio including visual basic and visual c++ as an ISO image (these can be tricky, see below for details on reading ISO images). Even on a blazing fast computer, downloading visual studio will take two hours at most, though.
WARNING: make sure that you get the 2008 edition and not 2010. This may seem backwards, but the Cosmos user kit has yet to support 2010.
The cosmos user kit is the platform that we will write our OS in. It's an all-in-one micro-kernel operating system that is written in 100% C#. You can download it at http://cosmos.codeplex.com/releases/view/35194
A note about ISO images:
If you opted to download the entire visual studio, then you're going to need to read the ISO image file. An ISO image is a map of a virtual DVD, using the same encoding as any other disk. You have two option: Use a program like nero or roxio to burn the image to a CD-ROM then insert that disk into your computer and download it (The latest Windows XP comes with Roxio, and Windows 7 comes with Nero pre-installed. Other than that, you will almost certainly find something on your computer that will burn a CD. Explore a bit), or you can use Daemon tools lite edition to read the file directly.
Daemon tools lite is free and can be found at http://www.daemon-tools.cc/eng/downloads
A: After downloading it, running the setup program, and re-booting, fire up Daemon tools and click Add File (the picture of the CD with a plus sign).
B: Find the image, and open it.
C: Now, select the file and click Mount. A popup (see pic') will show you some options, click "run setup.hta". This will install Visual Studio. Alternatively, you can find setup.hta in the virtual drive that was created, located in My Computer under Devices with removable storage.
Step 2: Creating the Project
After downloading the file CosmosUserKit.MS4, run it and follow the setup instructions. Visual studio will warn you about unsigned code and potential danger and blah blah blah. Cosmos doesn't have any of that, so just click OK.
Now, if you open up Visual C#, and under the heading Recent projects, you will see the text "Create...project". Click this. It will be where we write all the code for the OS. Name it whatever you please. Now, you will see an option under My templates labeled CosmosBoot. Double click it to open up the Cosmos template, and then double click the "program.cs" text over on the right. You should see this text:
using System;
using Cosmos.Compiler.Builder;
namespace CosmosBoot1
{
class Program
{
#region Cosmos Builder logic
// Most users wont touch this. This will call the Cosmos Build tool
[STAThread]
static void Main(string[] args)
{
BuildUI.Run();
}
#endregion
// Main entry point of the kernel
public static void Init()
{
var xBoot = new Cosmos.Sys.Boot();
xBoot.Execute();
//There's supposed to be a bit of text here. Change it to Console.WriteLine("Hello world!");
}
}
}
In the next step we'll boot up our (very) basic OS.
Step 3: Boot!
Now, open up the debug menu, and click Start without debugging. There will be a white popup asking you various questions, but the defaults will suffice for now, so just click OK.
You should see a black console window with a lot of text. Eventually the operating system will finish booting and display "Hello world!". Congratulations, you just made an operating system! Well, okay, so it's not really an OS in the traditional sense, but it's a start.
In addition to providing the template, the Cosmos user kit installs a new Cosmos class. With this, you can do things like shutdown, reboot, and other OS-ey things.
Shutdown:
Cosmos.Sys.Deboot.Shutdown();
Reboot:
Cosmos.Sys.Deboot.Reboot();
NOTE: All the code for the OS will go under the xBoot.Execute() line of code.
Step 4: Conclusion
If you have questions or problems, keep in mind I'm only slightly more experienced with this then you are at this point. I'll try my best to help, though. I'll also be releasing another instructable sometime that more thoroughly explains the ins and outs of Cosmos + C#.
Have fun building your OS!
2 People Made This Project!
- hotrus22server made it!
- MrToxic1234 made it!
174 Comments
2 years ago
If someone has made an os with AI technology please ping me I am making an os Team those who have best programing knowledge and those who have dedication on this work can reach me at
anagha.vashista@gmail.com
Instagram @anagha.vashista
2 years ago
can i do this with visual studio 2019 or with visual studio 2017?
Reply 2 years ago
no
2 years ago
HEY, COSMOS.SYS.DEBOOT IS NOT AVAILABLE IN THE VERSION OF COSMOS THAT I HAVE. USE COSMOS.SYSTEM.POWER INSTEAD (WITH THE SAME METHOD NAMES).
4 years ago
How do you get the cosmos thing? It seems that I can't access the link!
4 years ago
i would like to but i only know c#,python,c, and c++
-mercko@student.wayne.k12.in.us
4 years ago on Step 4
How can check OS.
4 years ago
How will i create a (.iso) of this operating system
Question 5 years ago
Can I do this with LFS (Linux From Scratch)?
6 years ago
I am an enthusiast programmer and learned a lot of languages.
C#, VB, HTML, PAWN, PHP and so on..
I love to work on C# because it is too flexible and is nearly used everywhere.
I am making my own OS or most probably a prototype OS in Visual Studio using C#. I made a lot of progress and it looks too damn beautiful..believe me..to awesome..
I need some more people as all these years I have been working alone. Anyone interested then join me. New ideas will be appreciated too and designing too.
Thanks
-Ankon
Reply 5 years ago
Hello sir im a young programmer and I just wanted to know how you built your OS...Im willing to build one of my own I just wanted to know how you built yours...
Reply 5 years ago
Hows it going?
Reply 5 years ago
i need a home made OS for my college project . if u have any home made os please help me.
Reply 5 years ago
I'd be more than happy to see how I could get involved. I have been wanting to learn how to code for years now, but I have had serious issues trying to learn the code as I have had no sandbox environment to test code in. In the future, I hope to open a technology company and some experience with you and your coding knowledge could be perfect. Just to clarify, I have no prior coding experience, but I'd love to get involved in some way, or if you could teach me any of the basics of C# that would be so useful.
Let me know (bimyou321@gmail.com)
Jack
Reply 5 years ago
Hello Ankan I am also with you. You can contact me on naskars233@gmail.com .
I know a lot of more about programming. I have experienced as a toper.
Reply 5 years ago
Im in.. alvinjoereloaded@gmail.com
Reply 6 years ago
Hey
I would surely like to help
Reply 6 years ago
Hey can I also join....
I would love to help. I know the basics of C# and am very eager to learn.
May I join?? I might not be the most helpful but I want to learn.
Reply 6 years ago
YESS finally someone like me i would love to help
contact me: 54gorillaz@gmail.com
Reply 6 years ago
I am interested too. Contact me.
jaimet561@gmail.com