sanos home

Configuration


 

Sanos uses two main configuration files. These are located in the /etc directory. The main configuration file for sanos is /etc/os.ini. This file contains all the configuration options except for kernel level configuration options. The kernel uses the /boot/krnl.ini configuration file. These two configuration files use the .ini file format.

In addition to these two configurations files a few options can be specified in the kernel option string. These are basic kernel boot options with can be set by the os loader.

 

INI file format

 

A .ini file is an ASCII text file with a list of sections. Each section starts with a section header with the section name in brackets (e.g. [os]). Each section header is specified on its own line. Each section has a list of properties with name/value pairs. Names and values are separated by equal sign ('=') or colon (':'). The value part is optional. A line starting with a semicolon (';') or a number sign ('#') is a comment . Empty lines are ignored. Control characters and reserved characters can be specified using a caret followed by two hexadecimal digits (e.g. ^0A is a newline). This a sample .ini file:

# OS configuration

[os]
libpath=/bin
init=/bin/sh.exe
loglevel=3

; Environment variables
[env]
tmp=/tmp

The routines in inifile.c can be used for parsing and querying sections and properties in .ini files.

 

OS configuration

 

The os configuration is located in /etc/os.ini. This file is read during startup and controls most aspect of sanos.

[os]  
libpath=/bin Semicolon separated list of directory paths. These paths are used by the user mode module loader to search for .exe and .dll files.  This property has the same meaning as the PATH environment variable known from Windows and Unix.
rc=/etc/rc Startup script. This script is executed at the end of the boot sequence and can be used to start daemons.
init=/bin/sh The initial program. This program is loaded and executed after sanos has finished initializing.
hostname=localhost Hostname for computer. If no hostname has been configured, sanos tries to find the hostname for the computer by making a DNS query on the primary IP address.
loglevel=[0-7] Default logging level for syslog. Log messages above the log level are discarded by syslog. Default log level is 7 (i.e. no messages are discarded). Allowed values are:
  • 0=EMERG (system is unusable)
  • 1=ALERT (action must be taken immediately)
  • 2=CRIT (critical conditions)
  • 3=ERR (error conditions)
  • 4=WARNING (warning conditions)
  • 5=NOTICE (normal but significant condition)
  • 6=INFO (informational)
  • 7=DEBUG (debug-level messages)
logfile=<filename> Logging file. Log messages logged using syslog() are written to this file. Default is no log file.
loghost=<hostname> Logging host. Log messages logged using syslog() are send to the logging host using the BSD syslog protocol (RFC 3164).
rndfile=<filename> File for random seed. If a filename is specified, sanos reads this file during startup and initialize the random number generator with this seed (see srandom()). During shutdown a new seed is written to the random seed file.
debug=[0|1] Enable debugging mode. When debugging is enabled a debug breakpoint signal enters the debugger. Debugging is default enabled for debug builds of sanos.
[env] Properties in the [env] section acts as environment variables. The environment variables can be accessed using getenv().
[dns]  
domain=<domain> Domain name for computer. If no domain name is specified, the domain name is set from the domain name returned by DHCP.
primary=<ipaddr> Primary domain server. Domain servers returned by DHCP are also added to the domain server search list.
secondary=<ipaddr> Secondary domain server.
[netif] The [netif] section is used to configure network interfaces. The property name is the network interface name (eth0, eth1, lo, etc.). The property value is a comma separated option string specifying the network interface options:
  • ip=<ipaddr> (IP address of interface)
  • gw=<ipaddr> (Default gateway address for interface)
  • mask=<ipaddr> (Subnet mask used for the interface, e.g. 255.255.255.0)
  • broadcast=<ipaddr> (Broadcast address for interface. If the broadcast address is missing it is computed from the IP address and the subnet mask)

For instance, to configure the primary network adapter to IP address 192.168.0.5 with the default gateway on 192.168.0.1:

  [netif]
  eth0:ip=192.168.0.1,gw=192.168.0.1,mask=255.255.255.0

In order to configure the network interface using DHCP just specify the network interface name on a separate line:

  [netif]
  eth0
[mount] During startup the file system root is mounted on the boot device. Additional mount points can be specified in the [mount] section. A mount point is specified using a property of the following form:
  [mount]
  <mountto>=<dev>[,<fstype>[,<options>]

If no file system type is specified the dfs file system is used as default. For instance, to mount the first partition of the primary harddisk on /usr:

  [mount] 
  /usr=hd0a

To mount ram disk 0 on /tmp (format option formats the device before mounting):

  [mount] 
  /tmp=rd0,dfs,format

To mount the floppy on /mnt/floppy (the /mnt/floppy directory must exist before the mount):

  [mount]
  /mnt/floppy=fd0

To mount a remote file share on /usr using SMB (i.e. Windows file sharing protocol):

  [mount]
  /usr=//filesrv01/files,smbfs,user=scott,password=tiger

To mount the CD-ROM drive on /mnt/cdrom:

  [mount] 
  /mnt/cdrom=cd0,cdfs
[ntp] On startup sanos sets the real time clock from the BIOS. However sanos can also synchronize the real time clock with an external server using the Network Time Protocol (RFC 1305). Sanos uses the NTP server(s) returned from the DHCP server, but additional NTP servers can be specified in the [ntp] section. NTP servers are specified one server per line:
  [ntp]
  dk.pool.ntp.org
  se.pool.ntp.org
[modaliases] Module alias list for user mode modules, e.g.
  [modaliases]
  ws2_32.dll=wsock32.dll
[java] The jinit program uses the configuration in the [java] section to initialize the java VM and running java programs. Another section name for the java configuration can be specified on the jinit command line. See also Running java applications on sanos.
jvm=jvm.dll Name and location of Java VM.
mainclass=
  sanos.os.Shell
The main class of the java program.
mainargs= Arguments to the main class
classpaths=

  java.classpaths

Section name for class paths for the Java VM. Each line in the section contains one line with a directory or a jar file, e.g.
  [java.classpaths]
  c:\usr\java\lib\tools.jar
  c:\usr\tomcat\lib\webserver.jar
  c:\usr\tomcat\lib\servlet.jar
  c:\usr\tomcat\lib\parser.jar
  c:\usr\tomcat\lib\jaxp.jar
  c:\usr\tomcat\lib\jasper.jar
options=

  java.options

Section name for options to the Java VM, e.g.
  [java.options]
  -Xmx32M
properties=

  java.properties

Section name for system properties for the java application. These are the properties you normally specify with the -D option to java.exe, e.g.
  [java.properties]
  user.timezone=Europe/Copenhagen
  tomcat.home=c:\usr\tomcat
[shell]  
prompt=%s$ Prompt for the shell in printf format. The %s parameter specifies the current directory.
echo=[0|1] If the echo property is set to 1 each command is written to standard output before being executed.
[telnetd]  
port=23 Port number for telnet daemon.
pgm=login Application launched for each new telnet client.
[ftpd]  
port=21 Port number for ftp daemon.
[win32]  
sysdir=c:\bin System directory reported by GetSystemDirectory().
windir=c:\bin Windows directory reported by GetWindowsDirectory().
tmpdir=c:\tmp Temporary directory reported by GetTempPath().
locale=1030 Thread locale reported by GetThreadLocale().
[httpd]  
port=80 Port number for httpd web server library.
workerthreads=1 Number of worker threads for httpd daemon.
minhdrsize=1024 Minimum allocation size for HTTP header buffer.
maxhdrsize=16384 Maximum allocation size for HTTP header buffer.
requestbuffer=4096 Initial size for HTTP request buffer.
responsebuffer=4096 Initial size for HTTP response buffer.
backlog=5 The backlog used for listen() in the httpd daemon.
indexname=index.htm If directory browsing is not enabled, a request on a directory is redirected to the index file.
swname=sanos/1.3.3 Name returned in the Server: HTTP header.
alllowdirbrowse=[0|1] Set to 1 to allow browsing directories. If directory browsing is not allowed a request on a directory is redirected to the index file.
logdir=

Web log directory for httpd. One log file per day named webYYYYMMDD.log is produced. The log is in W3C Extended Log File Format.

logcolumns= Space separated list of column to log to the log file. The following column fields are supported:
  • date
  • time
  • time-taken
  • c-ip
  • s-ip
  • s-port
  • cs-uri
  • cs-uri-stem
  • cs-uri-query
  • cs-method
  • cs-bytes
  • cs(user-agent)
  • cs(referer)
  • cs(cookie)
  • cs(host)
  • cs-username
  • cs-protocol
  • sc-bytes
  • sc-status

The log columns defaults to date time c-ip cs-username s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status cs(user-agent)

mimemap=mimetypes Section name for list of MIME type mapping.
[mimetypes] List of file extension to MIME type mapping, e.g.
  [mimetypes]
  txt=text/plain
  html=text/html

Kernel configuration

 

The kernel uses the /boor/krnl.ini configuration file.

[kernel]  
keyboard=[us|uk|dk] Keyboard mapping table.
libpath=/bin Comma separated list of directory paths. These paths are used by the kernel mode module loader to search for kernel modules.
onpanic=<action> Action taken by sanos on panic:
  • halt (halt the cpu)
  • reboot (reboot the computer)
  • debug (enter debugger)
  • poweroff (power off computer)
pathsep=[/|\] Primary path separator. Although sanos allows both / and \ in file names the primary path separator is used when sanos constructs file names (e.g. getcwd()).
[modaliases] Module alias list for kernel mode modules
[bindings] Sanos uses the binding list to select an appropriate driver for a device. During startup sanos enumerates all PCI and ISA PnP devices. For each device the binding list is scanned. If any bindings match the device the device driver is initialized with the information for the device. Each binding has the following syntax:
  [pci|isa] [class|unit] <mask>=<module name>[!<entry point>][:<options>]

The property name contains a bus type (pci or isa), a binding type (binding by class code or unit number) and a mask. The asterisk ('*') can be used as a wildcard for matching the unit code or class to the mask. If a match is found the property value is used to select the driver for the device. If the property value just contains a module name the module is loaded and the install entry point is called with the device unit information. An alternative entry point name can be specified with an exclamation point ('!') and a entry point name after the module name. Options can be specified using a colon (':') followed by an option string.

Example:

  [bindings]
  pci class 060100=krnl.dll!isapnp
  isa class 0700**=krnl.dll!serial
  isa unit 6D08D041=ne2000.sys
  isa unit 19808C4A=ne2000.sys
  pci unit 10222000=pcnet32.sys
The kernel contains a number of standard device drivers which can be used in the binding list:
  • serial - COM port driver
  • isapnp - ISA PnP bus driver
[drivers] Sanos can load a number of device drivers which does not require or support binding. These drivers can be specified in the [drivers] section. Each line has the following syntax:
  <module name>[!<entry point>][:<options>]

Each driver is loaded and initialized during startup. The driver entry point is called without any unit information. The kernel contains a number of standard device drivers:

  • console - Console driver
  • klog - Kernel logging driver
  • null - Null driver
  • nvram - Non-volatile BIOS RAM driver
  • ramdisk - RAM disk driver
  • random - Random number driver
  • apm - Advanced Power Management (APM) driver
  • smbios - System Management BIOS (SMBIOS) driver

Example:

  [drivers]
  krnl.dll!null
  krnl.dll!console
  krnl.dll!klog
  krnl.dll!nvram
  krnl.dll!apm:engage=1
  krnl.dll!ramdisk:size=2048

Kernel options

 

A few configuration parameters must be specified as kernel options. Kernel options kan be specified using the -K option to the mkdsf utility. The kernel options are put into a special data area in the os loader (osldr.dll). Kernel options are used for configuration parameters that are needed before the kernel configuration file (/boot/krnl.ini) is loaded.

[kernel]  
silent=0 Controls kernel log messages:
  • If silent=0 kernel log messages are printed to the console.
  • if silent=1 kernel log messages are NOT printed to the console.
ideprobe=1 The IDE driver uses this option to control probing for disks devices.
  • If ideprobe=0 the IDE driver uses the BIOS setting for the number of disk devices. This prevents resetting the IDE controller which can sometimes prevent the IDE controller from working. If sanos cannot recognize your hard disk try setting ideprobe=0.
  • If ideprobe=1 the IDE driver resets the IDE controller and probe for master and slave devices on the controller.This is needed to recognize a CD-ROM drive.
console= Console device. This is by default set to /dev/console, but can be configured to be another device, e.g. /dev/com1 to use a serial port for the console.
rootdev=fd0 Device for root file system. This is by default set to the boot device, but can be configured to be another device.
rootfs=dfs File system type for the root device. By default the root file system is mounted as a DFS file system. The root file system must be a built-in filesystem in krnl.dll.
rootfsopts Options for mounting root file system.
config=/boot/krnl.ini Kernel configuration file.