Describing the process from C# sourcecode to a bootable operating system.
This document gives a brief explanation of how Cosmos works, and it's intended audience are new developers.
All who develop on Cosmos, being kernel developers or userkit developers, should have an understanding of how the .NET code is transformed into a bootable machine.
The six-step process below describes how your sourcecode is turned into a bootable operating system. Do not be intimidated by the six steps, it's actually just the first step where you do your work. Once you complete the first step Cosmos will do all the conversion, building and linking automatically for you.1. Compile to IL
This step is where you, the developer, do all your work. It is here that you write your C# code, and the step is completed when you tell Visual Studio to compile.
When Visual Studio has compiled your project, and it's referenced projects, it will start the Main method in your project. The sole purpose of the Main method is to start the BuildOptions Window. In the Build Options window opened by the Main method you can choose various options used by the upcoming build.

When you click Build you can sit back and relax - Cosmos will take care of the next steps for you!
2. Convert IL to ASM
This step is where IL2CPU comes to play. Your compiled IL code is now converted to assembler code. When the Build button is clicked the conversion from .NET Intermediate Language (IL) to Assembler (ASM) begins.
The IL2CPU engine uses the executing .exe file
as the starting point for converting IL to ASM. The engine then parses
all referenced .NET assemblies, i.e. the .dll files in the same
directory, and convert those to separate .asm files. If your project uses unsupported keywords or .NET classes the Build Window will halt with an error message.
All the .asm files are put into the Build\Tools\Asm folder.
3. Nasm
The .asm files generated are assembled together into an ELF binary file called output.obj.
4. LD
Next the output.obj file is linked using ld.exe, and outputs output.bin, a binary file almost ready to be executed. The output.bin file contains an entrypoint, all your code, and all required underlying Cosmos code.
5. Making an ISO
If you have choosen a build type in the Build Options window which requires an .iso file makeisofs.exe will be used to create cosmos.iso.
6. Booting
When the entire build process has been completed your operating system is ready to be booted. Depending on the choices you made in the Build Options window in Step 1 a virtual machine will boot your .iso image, a physical machine can boot using PXE or a USB memory stick is made bootable.