MOSA Project Website Update

December 29, 2009 1 comment

The MOSA Project website ( is no longer hosted at CodePlex.  Instead we are hosing our own website using Redmine, an open-source project management tool. It has more advanced features than CodePlex could provide us; namely support for GIT as our source code repository. We hope you like it better!

Also, if you have not already noticed, we are using a new logo design.

Categories: MOSA

MOSA Booting on Real Hardware

June 14, 2009 Leave a comment

While most of the development and testing of MOSA is done using virtualization software, MOSA does indeed boot on real hardware too. At the moment we support booting MOSA from either a CD or USB key.

Here are the detailed instructions for writing MOSA to a USB Drive:

1. Download the dd utility for windows from

2. Extract the dd.exe executable to the mosa\trunk\Setup\Boot\build directory.

3. Open a command prompt window and change directory to the build directory.

4. Connect the USB key you wish to ERASE and install MOSA onto. (WARNING: Data on the USB drive will be lost!)

5. Determine the device path for the USB key.

Type “dd –list” to display a list all the block devices on your system. Find the one for the USB Key you just connected. Be careful, if you select or mistype the wrong device, you can corrupt your hard drive or other storage devices. Unless you understand these steps completely, do not proceed.

6.Type “dd of=\\?\Device\HarddiskX\PartitionX if=bootimage.img bs=512 –progress” and substitute the of= parameter with the device path found in the previous step.

7. Wait until all the blocks are written to the USB key before disconnecting it.

8. Now boot a PC or laptop with the USB Key connected!

Categories: MOSA

Incorporating the Mono Class Libraries in MOSA – Part I

May 10, 2009 Leave a comment

The first challenge to incorporating the Mono Class Libraries into MOSA is how to replace the external method calls in the class libraries with our own custom implementation. There are two basic approaches to this challenge. In part one of this blog series, we will explore the one used by other managed open source projects and its unique challenges.

The most common approach is to replace the call to the external methods with a call to the another custom method instead. This approach seems to be the simplest and most elegant solution – as you only have to supply the CIL code for the custom method and then have the compiler call the replacement method.

Ideally the replacement method would be implemented similar to this:

namespace InternalSystem
	public class SomeMonoClass
		public int NewMethod()
			return this.X * this.Y;

Of course, this method will not compile because the member variables X and Y do not exist to the C# compiler. One possible solution is to create stubs for these member variables so they will exist while the code is compiled to CIL. Here we add those two member variables:

namespace InternalSystem
	public class SomeMonoClass
		int X;
		int Y;

		public int NewMethod()
			return this.X * this.Y;

Now the code compiles. And given some special CIL to native compiler, the external method call will be redirected to this other method instead. Creating stubs to expose these “hidden” member methods and variables seems like a fair compromise. But look at this example:

namespace InternalSystem
	public class SomeMonoClass
		int x;
		int y;

		public ClassC NewMethod(ClassA b, ClassB b)
			return new ClassC(z, b.X, c.Y);

Now additional stubs are required to represent the ClassA, ClassB, and ClassC classes, and stubs for each of their member methods and variables before this code will compile. Do you see where this is going? Given a rich framework with many dependencies between classes, like the .NET framework, this approach can results in the creation hundreds of stubs!

MOSA will approach this problem in another way, which I will be blogging about next.

Categories: MOSA

Boot Image Creation Tool

May 3, 2009 Leave a comment

For the MOSA project, we needed a tool to create image files for various Virtual machine software, such as for Microsoft Virtual PC and Microsoft Virtual Server, VMware, and VirtualBox, including simulators such as QEMU, and Bochs.

The use of virtualization software would help us facilitate the building and testing of the MOSA AOT/JIT compiler, the reference Operating System, and CIL based runtime libraries.

So we need an virtual disk image tool that could:

1. Create disk images in various virtual disk formats: IMG, VHD and VDI.

2. Create Master Boot Block (MBR) and partition to the disk image.

3. Create FAT12 or FAT16 partitions (or EXT partitions).

4. Incorporate a multi-stage boot loader with support for the Multiboot Specification.

5. Add files to the file system.

6. Execute on Windows or Linux platforms.

After an exhaustive search across various open source operating systems, I was unable to find a single tool that could do all of this. Most projects use a tool set of utilities, such as GRUB, LILO, mkfatfs, fdisk, and Syslinux, and custom scripts to create the single boot image. Unfortunately those tools and their related scripts were always platform specific to either Linux or Windows.

So I decided to roll my boot image creation tool in C# that incorporated all these features. One of the good things about having written parts of the device drivers, driver system, and file system support for MOSA is already having code for creating, reading and writing MBR, partitions, and FAT12/16. Implementing basic support for the virtual disk formats was relatively straightforward after reading the specifications and understanding the Cluster-Head-Sector (CHS) address legacy. The most difficult part was incorporating the Syslinux boot record and boot loader binaries. Those binary executables required very specific in-place modifications based on the virtual disk geometry and file system.

The result is a tool simply called “CreateBootImage.exe”. It run on both Windows and Linux (with Mono), and is now available as part of the MOSA project.

Here’s how to use the tool:

The tool accepts two command line arguments:

CreateBootImage.exe <configuration file> <image file>

The configuration file contains a list of options, one per line, with arguments separated by a tab. The following options are supported:

option Arguments Description
-volume Volume Name Set the volume name for the first partition
-blocks # of Blocks Set the number of 512-byte blocks
-fat12   Use FAT12 file system
-fat16   Use FAT16 file system
-fat32   Use FAT32 file system (untested)
-vhd   Create image in VHD (Virtual PC/Virtual Server) format
-vdi   Create image in VDI (VirtualBox) format
-img   Create image in IMG format
-syslinux   Patch disk image for Syslinux
-mbr Filename Use file for Master Boot Record
-boot Filename Use file for Boot Record
-file Filename, Destination Include file in file system (destination optional)

The tool can create disk images for the following emulators:

Emulator File Format
Virtual PC 2004/2007 .VHD
Virtual Server .VHD
VMware .VHD
VirtualBox .VDI
Raw Image .IMG


Categories: MOSA

Managed Operating System Alliance (MOSA) Framework

April 25, 2009 Leave a comment

Over the past six months, Michael Ruck (aka grover), Simon Wollwage (aka rootnode) and I (aka tgiphil) have been super busy developing a set of tools, specifications and source code to foster the development of managed operating systems based on the Common Intermediate Language. MOSA has partnered with the SharpOS and Ensemble projects to jointly develop a common CIL JIT/AOT Compiler, Device Drivers, and Runtime libraries.

Progress has been slow, but not without achievements. We have the beginnings of an AOT/JIT Compiler (mosacl), a working boot image creation tool, device drive framework and several device drivers. The build framework can compile and boot a simplistic OS kernel (see the screen shot).

Currently we are working to improve the compiler and support all the CIL instructions, and a tool to directly transform the source code of class libraries from Mono Project so we can compile and use it with this project. I’ll blog more about the transform tool later in a future blog.

The MOSA Project is currently hosted at CodePlex. Check it out!

Categories: MOSA

Water on Mars!

July 31, 2008 Leave a comment

Today, NASA’s Phoenix Mars Lander confirms that water exists on Mars!  While the spacecraft had previously photographed evidence of water ice, this is the first time that sensitive instruments on the surface of the planet have detected water in the Martian soil.

Additional tests show that the Martian soil is similar to soil on Earth, except without any biological organics. The tests turned up magnesium, sodium, potassium and chloride, all of which are useful in organic processes. The soil is also alkaline, with a pH balance between 8 and 9. Leading some scientist to conclude that the Martian soil is capable of sustaining plant life.

Now did anyone remember to put some seeds on the spacecraft?

Categories: Space Exploration Tags: , ,

Joined the SharpOS Provisional Government Board

July 29, 2008 Leave a comment

Today, I accepted an invitation to join the Provisional Government Board of the open source SharpOS Project. The SharpOS Project is a community effort to write an operating system based on .NET technology, with a strong sense of security and manageability.


Categories: SharpOS Tags: ,

The Phoenix has landed!

May 26, 2008 Leave a comment

Earlier today, NASA successfully landed the Phoenix spacecraft on the planet Mars!  That is an amazing accomplishment. Mars is roughly 90 million miles from Earth. That’s like making a hole-in-one on another golf course on the other side of the planet. Kudos to NASA and their expert teams of engineers and scientists!

Photo: Phoenix footpad on Mars!

Categories: Space Exploration Tags: , ,

New Operating System – SharpOS

April 1, 2008 Leave a comment

I’ve been busy the last few months participating on a new open source operating system called SharpOS. What makes SharpOS interesting is that is an operating system written almost entirely in C# that provides a Common Language Runtime (CLR) managed environment for applications to run.

What is truly interesting about this type of operating system is that all applications and nearly all of the kernel code will run in a managed environment; meaning there are no memory pointers or explicit memory allocations. A managed environment enforces that applications are verifiably safe.

Since the team reach their first milestone earlier this year — a proof-of-concept implementation with an interactive diagnostics shell, I have actively working on the Floppy Disk and IDE device drivers, FAT file system support, and integration with the Virtual File System (VFS) framework developed by Michael Ruck (aka grover).

Expect more news about SharpOS in the future!

Categories: SharpOS Tags: ,

Animated GIF Encoder for .NET Update

February 20, 2008 8 comments

This is an updated to the “NGif, animated GIF Encoder for .NET” article on the The Code Project web site. NGif is a set of C# classes which can create animated GIF images. Microsoft’s native GDI library does not support the creation of animated GIFs.

My update supports returning the animated GIF as a MemoryStream object instead of a file. This is helpful on webservers where saving temporary files are not allowed.

Download: (361.62 kb)

Update: If you are looking for more information on animated GIFs using C#, check out HOWTO: create an animated GIF using .Net (C#) by Rick van den Bosch.

Categories: Programming Tags: ,