Although Sanos can be build under Sanos itself, you need to cross-compile it on another
system first. To build sanos from source you first need to download sanos-src-x.x.x.zip
from
the download page and unzip it into a directory (e.g. c:\sanos
or
~/sanos
).
The source code for sanos can be compiled under Windows or Linux. I use Microsoft Visual C version 7 (i.e. Visual Studio.NET 2002) to compile the source code. The boot sector is made using NASM.
For the various ways to build sanos see the following sections:
You can build sanos from a command line using the Makefile
in the root directory of the sanos distribution. If your Visual Studio
is not placed in its default location you need to have your path setup for
Visual Studio. This is most easily done by running vsvars32.bat
.
This file is usually located in C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin.
The Makefile
compiles and links all the code and builds
a boot floppy image in win\img\sanos.flp
. See here
for booting and installing this image.
The root directory of the sanos source distribution contains a Makefile
, that can
be used to build sanos. After running vsvars32.bat
you can build sanos by
running:
c:\sanos> nmake sanos
Makefile
first builds the sanos specific win32 based tools:
mkdfs
- File system creation toolsmkfloppy
- Raw floppy writer utilitymkpart
- Partition utilitydbggw
- Remote debugger gatewaysow
- Sanos-on-Windows libraryThese tools are placed in the win\tools
directory. Next,
all the sanos executable files are compiled, linked, and placed in the
win\install
directory. The following components are built:
boot
)osldr.dll
)krnl.dll
)*.sys
)os.dll
)libc.lib
)*.exe
)*.dll
)The only expected build warning is in osldr
:
LINK : warning LNK4096: /BASE value '0x10000' is invalid for Windows 95 and Windows 98; image may not run
You can then build different install medias from these files:
nmake bootdisk
win\img\sanos.flp
)nmake boothd
win\img\sanos.vmdk
). This image can be used to boot from
in PC emulators supporting vmdk format (VMware and Qemu).nmake bootcd
win\img\sanos.iso
).
This requires mkisofs
to be installed in the tools
directory.nmake netbootimg
win\img\sanos.0
).
This image can be used for making sanos boot over the network using PXE.nmake sdkdisk
win\img\sanos.vmdk
).
This image contains sanos, the SDK for building applications under sanos, and the source
code for sanos.nmake minimal
win\img\minimal.flp
)
with a minimal configuration of Sanos.
You can use the following versions of Visual Studio for building sanos:
nmake MSVC=7 sanos
).nmake MSVC=8 sanos
).nmake MSVC=9 sanos
).nmake MSVC=10 sanos
).nmake MSVC=11 sanos
).You can also use the Express (i.e. "free") versions of Visual Studio.
If you do not have Microsoft Visual Studio installed you can build sanos using the
cross-compile toolchain in the bin
directory. These are the sanos executables
for the compiler, assembler, and other build tools. The bin
directory also
contains a SOW version of os.dll
, which
allows the build tools to be run under Windows. This way you can build sanos without
needing any other tools than the crosstools distributed together with the sanos source
distribution. You can build a Sanos VMDK image with this command:
bin\make -f Makefile.cross
This will produce a virtual disk image in cross/img/sanos.vmdk
that can be used for
running Sanos on a PC emulator.
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
This will produce a virtual disk image in linux/img/sanos.vmdk
that can be used for
running Sanos on a PC emulator.
Sanos is self-contained in the sense that is can build itself. After the initial bootstrap build it no longer relies on Windows or Linux for building.
The Sanos C compiler (TCC) has been extended with a number of MSVC extensions, for example inline assembler with MASM syntax, so it can compile all the sanos code. The sanos SDK contains all the code and all the tools needed to build sanos from scratch and makefiles for building the various components.
The master makefile for building sanos is located in /usr/src
.
You can re-build all the sanos components with the following commands:
/$ cd /usr/src /usr/src$ make install ... /usr/src$ reboot
This will build the following components:
After rebooting sanos will no longer contain any code from the original build under Windows or Linux.