sanos home

Sanos FAQ


What is Sanos?


Sanos is a minimalistic 32-bit x86 OS kernel for network server appliances running on standard PC hardware. The kernel implements basic operating system services like booting, memory management, thread scheduling, local and remote file systems, TCP/IP networking and DLL loading and linking. You can use Sanos as a small kernel for embedded server applications written in C or as a JeOS (Just enough Operating System). Sanos has a fairly standard POSIX-based API and an ANSI Standard C library.

The kernel was developed as part of an experiment on investigating the feasibility of running java server applications without a traditional host operating system only using a simple kernel.


What does "Sanos" stand for?


Sanos is an abbreviation of Server Appliance Network Operating System. It is also the Spanish word for healthy. Sanos tries to stay healthy by being simple and not implement unnecessary features to avoid feature bloat. It is focused on being a server appliance operating system. Sanos does not come with a huge array of standard applications. It only provides the kernel which supports the basic operating system features. This allows you to write server applications which execute in a controlled and predictable environment.

The basic idea is that using a minimalistic operating system kernel, only implementing the most basic services, will reduce the total system complexity. This allows you to build more robust and predictable systems. These systems will be easier to deploy, install and maintain. A Sanos-based web server can be installed in just a few minutes, and does not require a lot of configuration.


What does Sanos run on?


The Sanos kernel runs on standard PC hardware. For a list of supported hardware see here. Hopefully, it will work on any standard PC. Sanos does not support SCSI disks, so it only runs on machines with IDE disks.

Network drivers are another problem. You can use Sanos without network, but in most cases, a network server appliance is no good without network support. The most common network cards are supported by Sanos, but there are many different types of network boards.

If Sanos does not recognize your network card it may be because the network card is not supported by any of the network drivers in Sanos. It might also be because its PCI ID is not listed in the [bindings] section in krnl.ini. If you have a network card that should be supported by one on the network driver but is not recognized by Sanos you can try to find the PCI ID for the network card. Use the 'more /proc/units' command on the shell prompt to find the PCI ID and add it to the [bindings] section in krnl.ini.

If you network card is not supported by Sanos you will either have to write a driver or buy a new network card. You can buy a RTL8139 based 10/100 Mbps PCI network card for less than $10, so this may be the simplest solution.

Most of the network card drivers in Sanos have been ported from Linux. The rtl8139, sis900, and eepro100 driver are ported Linux drivers. It is a relatively easy process to port these drivers. It takes 1 or 2 days to port a driver. Please contact me if you need help on porting a driver.


What features does Sanos have?


The Sanos kernel implements the basic operating system kernel services like:

Please see here for a more complete list of features in Sanos.


How do I get Sanos?


You can get the latest version of Sanos from the download page. Both source and binaries are available.


Can I only run Java applications on Sanos?


No. There is a native Sanos API. You can develop applications in C using Microsoft Visual Studio. The native Sanos API resembles the standard POSIX Unix API, with functions like open(), close() etc. There is also an implementation of the ANSI Standard C library routines. See here for a brief guide to building a simple hello world application in C for Sanos.


Do I need Microsoft Visual Studio version 7 for building Sanos?


The source code distribution of Sanos comes with project and solution files for Microsoft Visual Studio version 7. You can build with other versions of Visual Studio by specifying the version as an argument to nmake:

If you do not have Microsoft Visual Studio installed you can use the sanos crosstools to build sanos under Windows. See here for instructions.

You can also cross-compile Sanos under Linux. You'll need to have GCC installed. When building under Linux, GCC is used for compiling the Sanos build tools (cc, as, ar, mkdfs) as Linux binaries and these are then used for building Sanos. You can build a Sanos VMDK image with this command:

make -f Makefile.linux sanos vmdk


How do I use remote debugging with Sanos?


You can use windbg (in Debugging Tools for Windows) to debug Sanos. It can be downloaded from Microsoft. You need a null modem cable between you target system (running Sanos) and you development system (running Windows). Build Sanos in debug configuration and install it on the target system.

To use the remote debugger you need the remote debugging gateway (dbggw.exe). This tool can be found in the Sanos tools directory. You can find the source code for dbggw in the utils directory. Start the dbggw program from a command line on the development system:

c:\sanos\tools> dbggw com1

When Sanos hits a breakpoint the remote debugger is activated. You can use several methods for generating a breakpoint exception:

After Sanos has hit a breakpoint (or any other exception) you can start the debugger (windbg):

c:\Program Files\Debugging Tools for Windows> windbg.exe -premote tcp:server=,port=24502 -n -p 1

The first time you use the debugger you must configure your paths. Set you symbol path to c:\sanos\dbg\symbols (in File->Symbol File Path) and source path to c:\sanos\src (in File->Source File Path). You can now inspect the call stack, local and global symbols etc.

The dbggw utility is based on a reverse engineering of the DRPC protocol. Only a subset of the protocol is yet handled by the dbggw utlity, so please be careful when debugging. Not all commands in the debugger can be used. Single stepping does not always seems to work correctly. I mostly use the debugger for analyzing snapshots situations. I have used windbg version 4.0.0018.0 for debugging. If you cannot find windbg 4.0.0018.0 elsewhere you can download it from here.


Can Sanos be licensed under GPL?


Most of the source code for Sanos is under a BSD license. However, some of the network drivers, which have been ported from Linux, are under a GNU public license. The Sanos kernel supports dual licensing mode. Because the BSD license is GPL compatible, BSD code can be re-licensed under GPL without problems. This means that the kernel as a whole can be re-licensed under GPL. If you re-license the kernel under GPL you must comply with the GPL conditions, including source code availability etc.

This dual licensing is necessary in order to use the Linux based network drivers, because they explicitly requires that the kernel is GPL, even though the network drivers are separate modules. These network drivers checks the kernel licensing mode at runtime and issues a license violation warning if the kernel license is not compatible to the driver licensing requirements.

The kernel license mode can be set by setting compile time defines (-D GPL or -D BSD). If the kernel is compiled with GPL license the /proc/copyright changes the copyright notice to the standard GPL copyright (i.e. copyleft) notice.

It is my hope that this dual licensing mode will give maximum flexibility in using the code while still complying with the license conditions for the original source code.


What is Sanos-on-Windows?


Sanos programs calls the OS API through the exported functions in os.dll. These implement the basic operating system services needed by Sanos programs. Sanos programs are normal PE files (i.e. EXE file format), but they depend on os.dll, where normal Windows programs depend on kernel32.dll. Since Sanos programs are standard PE files, you can load them under Windows, but since they depend on os.dll you will normally get an error when trying to run Sanos programs under Windows:

Unable To Locate Component: This application has failed to start because os.dll was not found.

The Sanos-on-Windows (SOW) component is a version of os.dll implemented on top of Win32 so it can be used on Windows. You can find the SOW component in \sanos\utils\sow. If you place the SOW-version of os.dll in the same directory as the Sanos program you can run it under Windows. This allows you to run exactly the same binary program both under Sanos and Windows. Please notice that the SOW-version of os.dll only implements a subset of the Sanos OS API, so not all Sanos programs can be run under Windows.