Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
quajak committed Apr 15, 2024
1 parent eb5c287 commit 10fb579
Show file tree
Hide file tree
Showing 21 changed files with 424 additions and 398 deletions.
7 changes: 4 additions & 3 deletions articles/Changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Devkit changelog </title>
<title>DevKit changelog </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Devkit changelog ">
<meta name="title" content="DevKit changelog ">
<meta name="generator" content="docfx 2.59.4.0">

<link rel="shortcut icon" href="../favicon.ico">
Expand Down Expand Up @@ -188,7 +188,7 @@
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="">
<h1 id="devkit-changelog">Devkit changelog</h1>
<h1 id="devkit-changelog">DevKit changelog</h1>

<h2 id="c5c087c697d106348adbcff86d5d43331500e648-update-then-merged-in">c5c087c697d106348adbcff86d5d43331500e648 (update then merged in)</h2>
<h3 id="features">Features</h3>
Expand All @@ -198,6 +198,7 @@ <h3 id="features">Features</h3>
</ul>
<h3 id="breaking-changes">Breaking changes</h3>
<p>Plugs are now included via a nuget package, to update cosmos past this commit you need to add the <code>Cosmos.Plugs</code> package to your kernel project. Don't forget to tick the <code>Include prerelease</code> checkbox and to set the package origin to <code>All</code>!</p>
<p><em>Last updated on 4 September 2023.</em></p>
</article>
</div>

Expand Down
11 changes: 6 additions & 5 deletions articles/Compiler/il2cpu.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@
<article class="content wrap" id="_content" data-uid="">
<h1 id="il2cpu">IL2CPU</h1>

<p>This is one of the most important pieces of code in Cosmos. It's an AOT (Ahead-Of-Time) compiler.</p>
<p>When you compile your C# (or any .NET language) program, it is compiled into CIL (common intermediate language). The CIL is then interpreted and executed by a virtual machine when you open your exe.</p>
<p>Cosmos is written in C# and Visual Studio compiles it into CIL as always. But a PC does not come with an interpreter for the CIL code. And writing a virtual machine for running an operating system is not always ideal.</p>
<p>This is where IL2CPU comes in. IL2CPU takes the CIL code and translates it to processor opcodes. Currently, only x86 opcodes are available at the moment. However, more architectures are planned for the future (ARM, PowerPC, x86-64).</p>
<p>At this point, IL2CPU performs some more magic before finally converting the entire file into a bootable binary file, which can be loaded by a bootloader on any system (Cosmos uses the <a href="https://github.com/limine-bootloader/limine">Limine bootloader</a>).</p>
<p>IL2CPU is one of the most important pieces of code in Cosmos. It's an AOT (Ahead-Of-Time) compiler.</p>
<p>When you compile your C# (or any other .NET language) program, it is compiled into CIL (common intermediate language). The CIL is then interpreted and executed by a virtual machine when you open your .exe.</p>
<p>Cosmos is written in C# and Visual Studio compiles it into CIL like usual. But a PC does not come with an interpreter for the CIL code, and writing a virtual machine for running an operating system is not ideal.</p>
<p>This is where IL2CPU comes in. IL2CPU takes the CIL code and translates it to processor op-codes. Currently, only x86 opcodes are available at the moment. However, more architectures are planned for the future (ARM, PowerPC, x86-64).</p>
<p>At this point, IL2CPU performs some more magic before finally converting the entire file into a bootable binary file, which can be loaded by a bootloader on any system (Cosmos uses the <a href="https://github.com/limine-bootloader/limine">Limine bootloader</a>.</p>
<p>As you might think, IL2CPU is a fundamental part of the development of Cosmos. IL2CPU is responsible for the final output, which is why most optimizations added are for IL2CPU.</p>
<p><em>Last updated on 24 March 2024.</em></p>
</article>
</div>

Expand Down
1 change: 1 addition & 0 deletions articles/Debugger/DebugCommands.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ <h2 id="vs-to-ds">VS to DS</h2>
</code></pre>
<h2 id="debug-channel">Debug channel</h2>
<p>We support channels, which are prefixed with anything prefixed with 192 and up. 192 is used for a debug view.</p>
<p><em>Last updated on 12 February 2020.</em></p>
</article>
</div>

Expand Down
48 changes: 21 additions & 27 deletions articles/GettingStarted.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,16 @@ <h1 id="getting-started">Getting Started</h1>
<h2 id="introducing-cosmos">Introducing Cosmos</h2>
<p>Cosmos (C# Open Source Managed Operating System) is an operating system
development kit which uses Visual Studio as its development environment.
Despite C# in the name any .NET based language can be used including VB.NET,
Despite C# in the name, any .NET based language can be used, including VB.NET,
Fortran, Delphi Prism, IronPython, F# and more. Cosmos itself and the kernel
routines are primarily written in C#, and thus the Cosmos name. Besides that,
NOSMOS (.NET Open Source Managed Operating System) sounds stupid.</p>
<p>Cosmos is not an operating system in the traditional sense, but instead it is
an &quot;Operating System Kit&quot;, or as I like to say &quot;Operating System Legos&quot;.
Cosmos lets you create operating systems just as Visual Studio and C# normally
let you create applications. Most users can write and boot their own operating
system in just a few minutes, all using Visual Studio. You can debug your operating system directly from Visual
Studio using breakpoints.</p>
<p>Cosmos is available in two distributions, the developer kit (dev kit), and the user kit. The dev kit is designed for users who want to work on Cosmos itself.
The user kit is designed for those who are interested in building their own
operating system and doing some Cosmos work. The dev kit might be thought of
as the Cosmos SDK. Most users should start off with the user kit as it is not
so overwhelming like the dev kit. This article focuses on the user kit.</p>
NOSMOS (.NET Open Source Managed Operating System) sounds silly.</p>
<p>Cosmos diverts from traditional operating systems because it is not an operating system in the conventional sense; rather, it is an &quot;Operating System Kit,&quot; similar to &quot;Operating System Legos&quot;. With Cosmos, you have the flexibility to construct operating systems just as how Visual Studio and C# help you develop applications. Using Visual Studio, most users can swiftly write and boot their own operating system within minutes. Additionally, debugging your operating system directly from Visual Studio is a feature, allowing for efficient troubleshooting through breakpoints.</p>
<p>Cosmos is available in two distributions, the developer kit (abbr. <em>DevKit</em>), and the user kit.
The DevKit was originally designed for those who want to work on Cosmos's core features, but now has superceded the inferior user kit due to having much more technical ability.
The User Kit was designed for those who are interested in building their own operating system and doing some Cosmos work. Since the User Kit is so heavily outdated, it is often recommended to download the DevKit when installing. The documentation will cover both.</p>
<h2 id="writing-your-first-operating-system">Writing your first Operating System</h2>
<p>Create a new project as you would any C# project, but select Cosmos as the project type.</p>
<p>Once you have installed Cosmos (see other docs), you can create a new project as you would any C# project, but select Cosmos as the project type.</p>
<p><img src="images/SNAG-0000.png" alt=""></p>
<p>A starter project will be created. It looks very much like a standard C#
console application.</p>
Expand All @@ -218,31 +211,31 @@ <h2 id="writing-your-first-operating-system">Writing your first Operating System
console window, you will see the following:</p>
<p><img src="images/SNAG-0003.png" alt=""></p>
<p>This is your operating system running in VMware Player! Cosmos can of course
also be booted in VMware Workstation, Hyper-V, Virtual PC, Bochs, or on real
hardware. But by default Cosmos uses VMware Player because it is both free,
also be booted in VMware Workstation, VirtualBox, Bochs, or on real
hardware. But by default, Cosmos uses VMware Player because it is both free,
and reliable. Cosmos can even debug in Visual Studio, even when running on
another machine.</p>
<h2 id="integrated-debugging">Integrated Debugging</h2>
<p>Debugging is a major issue with operating system development. The Cosmos team
was not content enough to simply conquer building and deployment, we want to
make developing operating system as easy as developing Windows applications.
make developing operating systems as easy as developing Windows applications.
Debugging a Cosmos based operating system should feel very familiar to you.
Lets modify our project a little bit to show the effect, and set a breakpoint.
<strong>Note that the debugger only works in Visual Studio, and not Linux</strong></p>
<em>Note that the debugger only works in Visual Studio, and not Linux!</em></p>
<p><img src="images/SNAG-0005.png" alt=""></p>
<p>Now run the project again.</p>
<p><img src="images/SNAG-0007.png" alt=""></p>
<p>Note that the execution stopped at &quot;One&quot;? That is becuase in Visual Studio our
<p>Notice how the execution stopped at &quot;One&quot;? That is becuase in Visual Studio our
project has stopped on a breakpoint. Simply press F5 to continue just as you
would in a normal application!</p>
<p>In addition to breakpoints Cosmos also supports step into (F11) as well. Trace
<p>In addition to breakpoints, Cosmos also supports step into (F11) as well. Trace
over (F10) is not supported yet.</p>
<h2 id="debugger-communication">Debugger Communication</h2>
<p>The debugger uses the serial port to communicate. Because of this, debugging
only works wtih virtualization environments that support serial ports such as
only works within virtualization environments that support serial ports, such as
VMware. QEMU supports serial ports as well, but its serial port implementation
is seriously broken on Windows and makes debugging impossible using QEMU. To
debug on real hardware, you must use a physical serial cable. In the future
debug on real hardware, you must use a physical serial cable. In the future,
Cosmos will also support debugging over Ethernet.</p>
<h2 id="extra-debugging">Extra Debugging</h2>
<p>Cosmos supports some explicit methods that can be used to communicate with the
Expand All @@ -266,7 +259,7 @@ <h2 id="code-based-breakpoints">Code Based Breakpoints</h2>
</code></pre>
<p>Both functions will produce the same result.</p>
<h2 id="debug-output">Debug Output</h2>
<p>Debug strings can be output to the debug window of the host. Because Cosmos
<p>Debug strings can be outputted to the debug window of the host. Because Cosmos
does not support watches yet, this functionality can be very useful for
watching variable values and for performing tracing without breakpoints.</p>
<pre><code>mDebugger.Send(&quot;Hello from Cosmos!&quot;);
Expand All @@ -276,15 +269,16 @@ <h2 id="debug-output">Debug Output</h2>
<p><img src="images/SNAG-0008.png" alt=""></p>
<h2 id="whats-the-catch">What's the catch?</h2>
<p>There really is no catch. Everything we've shown here is functioning as seen.
No mockups were used. However we still have a lot of work to go. Items of
interest that are on our current task list include threads and networking.
No mockups were used. However, we still have a lot of work to do. Items of
interest that are on our current task list include multithreading and x64 systems.
We have prototypes and experiments for each, but none have been rolled into
the mainline Cosmos development as of yet.</p>
<h2 id="obtaining-cosmos">Obtaining Cosmos</h2>
<ul>
<li>Cosmos Website - <a href="http://www.GoCosmos.org">http://www.GoCosmos.org</a></li>
<li>Source Code - Both dev kit and user kit - <a href="http://github.com/CosmosOS/Cosmos/">http://github.com/CosmosOS/Cosmos/</a></li>
<li>Cosmos website - <a href="http://www.GoCosmos.org">http://www.GoCosmos.org</a></li>
<li>Source code - Both DevKit and User Kit - <a href="http://github.com/CosmosOS/Cosmos/">http://github.com/CosmosOS/Cosmos/</a></li>
</ul>
<p><em>Last updated on 24 March 2024.</em></p>
</article>
</div>

Expand Down
44 changes: 23 additions & 21 deletions articles/Installation/DevKit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Dev Kit Installation </title>
<title>DevKit Installation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Dev Kit Installation ">
<meta name="title" content="DevKit Installation ">
<meta name="generator" content="docfx 2.59.4.0">

<link rel="shortcut icon" href="../../favicon.ico">
Expand Down Expand Up @@ -188,18 +188,18 @@
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="">
<h1 id="dev-kit-installation">Dev Kit Installation</h1>
<h1 id="devkit-installation">DevKit Installation</h1>

<h2 id="windows">Windows</h2>
<h3 id="prerequisites">Prerequisites</h3>
<ul>
<li>(Free) source code of Development Kit from <a href="https://github.com/CosmosOS/Cosmos">Cosmos on GitHub</a>
<li>Source code of Development Kit from <a href="https://github.com/CosmosOS/Cosmos">Cosmos on GitHub</a>
<ul>
<li>You must clone the repository using Git. For a detailed walkthrough, <a href="https://help.github.com/articles/fork-a-repo/">see here</a>.</li>
</ul>
</li>
<li>(Free) <a href="https://visualstudio.microsoft.com/vs/">Visual Studio 2022 Community</a></li>
<li>(Free) <a href="http://www.jrsoftware.org/isdl.php#qsp">InnoSetup</a>
<li><a href="https://visualstudio.microsoft.com/vs/">Visual Studio 2022 Community</a></li>
<li><a href="http://www.jrsoftware.org/isdl.php#qsp">InnoSetup</a>
<ul>
<li>This is required to build the setup kit which is used to build and install the Visual Studio integration libaries for Cosmos.</li>
<li>During install it will ask you about optional components to install. Be sure you check &quot;Install Inno Setup Preprocessor&quot;.</li>
Expand All @@ -208,6 +208,7 @@ <h3 id="prerequisites">Prerequisites</h3>
</ul>
<h3 id="installation">Installation</h3>
<ul>
<li>Git clone the current source code of Cosmos or download the source code directly from GitHub. If you downlaod the source code, you will need to rename the folder to simply 'Cosmos'.</li>
<li>Look in the downloaded sources and run <strong>install-VS2022.bat</strong> with admin privileges (UAC will ask for permission), needed for install in system directories.</li>
<li>When the installation is complete, Visual Studio will automatically open and you may begin programming with your new, modified copy of Cosmos.</li>
</ul>
Expand All @@ -221,35 +222,36 @@ <h3 id="prerequisites-1">Prerequisites</h3>
<li>QEMU or any other virtual machine. See <a href="https://cosmosos.github.io/articles/Installation/Running.html">Running</a> for more information.</li>
</ul>
<h3 id="installation-1">Installation</h3>
<p>Run <code>make</code> to build Cosmos. Cosmos will clone all the required repos, build itself, and install it and it's nuget packages to the system automatically.</p>
<p>Git cline the current source code of Cosmos.
Run <code>make</code> to build Cosmos. Cosmos will clone all the required repos, build itself, and install it and its nuget packages to the system automatically.</p>
<h2 id="macos-apple-siliconintel">MacOS (Apple Silicon/Intel)</h2>
<p>There is currently hard to build on Apple Silicon Devices. So are going to build DevKit on Docker (Virtual Environment Service).</p>
<p>It is currently difficult to build Cosmos on Apple Silicon Devices. So, we are going to build DevKit on Docker (Virtual Environment Service).</p>
<h3 id="prerequisites-2">Prerequisites</h3>
<ul>
<li>Docker(<code>brew cask install docker</code>)</li>
<li>Docker (<code>brew cask install docker</code>)</li>
<li>QEMU or any other virtual machine. See <a href="https://cosmosos.github.io/articles/Installation/Running.html">Running</a> for more information.</li>
</ul>
<h3 id="installation-2">Installation</h3>
<p>First we need to set directory to the path of Cosmos source directory and build the Dockerfile:</p>
<p>First, we need to set directory to the path of Cosmos source directory and build the Dockerfile:</p>
<pre><code>cd /path/to/Cosmos/
docker build -t cosmos .
</code></pre>
<p>This will take a while. If there is no error, you successfully installed Cosmos on a Virtual Environment!</p>
<h2 id="notes--faq">notes / FAQ</h2>
<h3 id="custom-cosmos-repos">custom cosmos repos</h3>
<p>if you are using custom cosmos repos you will need to clone them all manually as the installer script will pull from <a href="https://github.com/CosmosOS/">https://github.com/CosmosOS/</a></p>
<h2 id="notes--faq">Notes / FAQ</h2>
<h3 id="custom-cosmos-repos">Custom Cosmos Repos</h3>
<p>If you are using custom Cosmos repos, you will need to clone them all manually, as the installer script will only pull from <a href="https://github.com/CosmosOS/">https://github.com/CosmosOS/</a></p>
<p>A tree diagram of the source should look like the following:</p>
<img src="https://raw.githubusercontent.com/CosmosOS/Cosmos/master/Docs/images/Dir.png" width="200">
<h3 id="get-stuck-pulling-the-git-repos">get stuck pulling the git repos</h3>
<p>check if git is installed and in your path as we use git to pull the repos</p>
<h3 id="i-just-updated-and-my-project-is-sill-using-the-old-version">i just updated and my project is sill using the old version</h3>
<p>you may need to clear you nuget cache try <code>dotnet clean</code> to clear the project level cache</p>
<h3 id="the-project-templates-are-not-showing-in-visual-studio">the project templates are not showing in visual studio</h3>
<p>if you have more then 1 version of visual studio installed this can bug this follow &quot;dotnet Project Templates&quot; should fix it</p>
<h3 id="i-get-stuck-pulling-the-git-repos">I get stuck pulling the git repos!</h3>
<p>Check if <a href="https://git-scm.com/">Git</a> is installed on your machine and within your path. We use Git to pull the repos from GitHub.</p>
<h3 id="i-just-updated-my-devkit-and-my-project-is-still-using-the-older-version">I just updated my DevKit and my project is still using the older version!</h3>
<p>Although Cosmos typically uninstalls previous kits before installing a new one; it is possible that your project can reference an older-version. In the rare case this does occur, you may need to clear the NuGet cache. Try running <code>dotnet clean</code> to clear the project-level cache.</p>
<h3 id="the-project-templates-are-not-showing-in-visual-studio">The project templates are not showing in Visual Studio!</h3>
<p>If you have more than 1 version of Visual Studio <em>(such as both 2022 and 2019)</em>, this bug can occur. Try running <code>dotnet Project Templates</code> to get them back.</p>
<h3 id="dotnet-project-templates">dotnet Project Templates</h3>
<p>If you are using linux or prefer not using Visual Studio for your projects, you can install the dotnet project template using <code>dotnet new --install ./source/templates/csharp/</code> assuming you are currently in the Cosmos base directory.
After installing the template use <code>dotnet new cosmosCSKernel -n {name}</code> to create a new Cosmos Kernel project.
<p>If you are using Linux, or prefer not using Visual Studio for your projects, you can install the dotnet project template using <code>dotnet new --install ./source/templates/csharp/</code> assuming you are currently in the Cosmos base directory. After installing the template, use <code>dotnet new cosmosCSKernel -n {name}</code> to create a new Cosmos Kernel project.
The dotnet template can be removed at a later time using <code>dotnet new --uninstall ./source/templates/csharp/</code>.</p>
<p><em>Last updated on 24 March 2024.</em></p>
</article>
</div>

Expand Down
Loading

0 comments on commit 10fb579

Please sign in to comment.