CapROS home
Kernel Development Guide

Building a CapROS System Image


When a CapROS system is booted, the kernel image and system image are loaded. This document describes the system image: what it contains and how it is constructed. Note, a "system image" is not the same as the file produced by mkimage.

A system image consists of either:

  • one preload image containing all the non-persistent objects, or
  • two contigous preload images, the first containing all the non-persistent objects, and the second containing all the initial persistent objects of a big bang. This form is used when a big bang is being set up by preloading the persistent objects into RAM.

Preload Image

A preload image defines a contiguous range of OIDs, and a set of objects in that range to be preloaded. The range of OIDs is divided into five consecutive regions: nodes, nonzero pages, zero pages, submaps, and unallocated frames. These regions are described in detail below.

The first frame of a preload image contains only a structure called NPObjectsDescriptor that defines the starting OID and information about the OID regions. It also tells whether there are one or two preload images, and it defines the OID of the IPL process, the one non-persistent process to be run at boot time. This structure is defined in the file sys/disk/NPODescr.h.

A preload image is produced by running npgen, which takes a mkimage file as input.

Node Frames

Nodes that were allocated in the mkimage file are grouped into node frames and placed in the preload image following the first frame (the one containing the NPObjectsDescriptor structure). They are assigned OIDs from the first OID of the range.

Nonzero Page Frames

Nonzero pages that were allocated in the mkimage file are placed in the preload image following the node frames. They are assigned OIDs following the node frames.

Zero Page Frames

Zero pages that were allocated in the mkimage file are assigned OIDs following the nonzero page frames. They are not stored in the preload image.

Submap Frames

Each preload image can have one prime spacebank that allocates the objects in the corresponding OID range. Allocating space requires a bit map, which itself takes space. To manage this recursive problem, the spacebank calculates the amount of space that it will require, and reserves this region of OIDs for that space.

Unallocated Frames

All the remaining frames in the OID range are unallocated and are not stored in the preload image.

Special Objects

Mkimage recognizes two objects for special purposes.

Volsize Node

This node is called volsize for historical reasons. The following slots of volsize are used. These slots are described in more detail in the file sys/disk/NPODescr.h.

Slots 0 and 1

These slots hold a number cap containing the number of nodes and pages, respectively, allocated by mkimage in this range. If additional object types are defined, slots after 1 will be used for them.

Slot volsize_range

This slot holds a Range capability for the range of OIDs described by this preload image. The spacebank uses this to determine the number of frames in the range.

Slot volsize_nplinkCap

In the persistent volsize node, this slot contains a start capability to the nplink process, which receives non-persistent caps at boot time.

Slot volsize_pvolsize

In the non-persistent volsize node, this slot contains a node capability to the persistent volsize node. This allows the non-persistent world to access the persistent world, in particular the nplink process. The persistent volsize node has a fixed well-known OID.

Threadlist Node

This node is the root of the "threadlist", the list of processes in this OID range to be run.

CapROS Volume Structure

This probably belongs elsewhere.

A CapROS volume is a logical disk. On an EROS-formatted floppy, the volume spans the entire disk. On hard disks things are a bit more complicated. Typically, the system firmware is designed to allow multiple independent operating systems to be loaded onto a single disk. The disk is divided into non-overlapping regions, typically called partitions, and each operating system acts for the most part as if its partition was a single disk. CapROS is no different; it views its partition as a single volume, and largely ignores the rest of the disk.

Every CapROS volume has up to 64 non-overlapping areas. To avoid collision with firmware terminology, we use the term division. Divisions come in several types:

    Unused Empty. Placeholder for unallocated space.
    Boot Contains the system-dependent boot code.
    DivTbl A table describing the division layout.
    Kernel The kernel's code.
    Spare Division containing spare sectors.
    Log A swap area.
    Object Holds CapROS Pages and Nodes.

Every volume has exactly one boot division at sector 0. Every volume has at most one kernel division.

Every disk technology that we know about reserves sector 0 of a partition as the "boot sector." The CapROS boot sector is defined by the VolHdr structure. It contains the following, among other things:

  • A unique system identifier (iplSysId). All the volumes in a single CapROS system will have the same system identifier. If the computer has volumes for more than one independent CapROS system, the iplSysId distinguishes them. Only volumes matching the iplSysId of the booted volume will be mounted.
  • The location of the primary (and optional secondary) division tables.

The division table describes, for each division, the type, the starting sector, and the ending sector. If the division is an Object or Log division, the division table also contains the starting OID or SwapLoc of the division.


SourceForge.net Logo Copyright 1998 by Jonathan Shapiro, Portions copyright 2000 by Charles Landau. Copyright 2005, 2008 by Strawberry Development Group. All rights reserved. For terms of redistribution, see the GNU General Public License This material is based upon work supported by the US Defense Advanced Research Projects Agency under Contract No. W31P4Q-07-C-0070. Approved for public release, distribution unlimited.