Go to the previous, next section.

Development Environment

We developed our system using the Linux operating system; a free Unix- like operating system for PCs. The main reason we chose Linux was that it already has many of the tools we needed to build our system. For example, a 32-bit C compiler (GCC), 16 and 32 bit assemblers, linkers and so on.

System Tools

Although Linux contains many of the tools we needed (including gcc, gas, ld, as86 and ld86) we had to produce a number of small utility programs to be used in the process of building the system. Descriptions of these tools make up the following table.

mld [-v] [-v] [-o dest-file] source-file
This program translates an a.out OMAGIC object file to the format required by the kernel's module loader (basically, a header, a single hunk containing the module's text and data, plus a table of relocations to perform).

It also performs a number of consistency checks; for example the object file may not contain any unresolved external references. Common data symbols (global bss objects) are resolved as they are loaded from the a.out file.

Each -v argument increases the verbosity of the program.

mstrip [-v] [-v] object-file {-s symbol-to-keep} [-o dest-file]
This is used on a.out OMAGIC format module files to strip all symbols except _kernel and _foo_module (where foo is the name of the module). This is necessary since modules can be statically linked into the kernel. If two separate modules defined a symbol with a particular name there would be trouble.

Each -v argument increases the verbosity of the program, the file called object-file is the a.out object to strip all symbols but those specified by the -s switches. If a dest-file is specified the stripped object is written to this file, otherwise the source is overwritten.

mdump module-file
Prints header information about the module stored in the file module-file.

bbin source-file dest-file
Strips the header from the file of 16 bit code in Minix format (created by ld86) source-file, and copies the 512 bytes of code in the file to dest-file. Only a code segment may be present in source-file and this code segment must be exactly 512 bytes in length. This is used to create images of boot blocks.

bbin16 source-file dest-file
Similar to bbin except that a multiple of 512 bytes of code is copied from source-file to dest-file. Only a code segment may be present in source-file. This is used to create a binary image of the 16 bit startup code.

bsc bootsect-image bootsect-header
This program translates the binary bootsector image in the file bootsect-image to a C header file containing an array of 480 characters called bootsect_code. A file of this type stored in the file `src/fs/bootsect.h' defines the standard system boot sector. Only 480 bytes of code are produced because the rest of the boot block is initialised by the mkfs portion of the file system.

btoa array-name <source-file >dest-file
A filter to translate a binary file source-file into a C array of characters called array-name in the file dest-file. As well as the array the output will also include an integer global variable called array-name_length containing the length of the array. This program is used to include files of 16 bit code into the 32 bit code emitted by the compiler.

e2b source-file dest-file
This program translates an a.out executable file (in either QMAGIC or ZMAGIC format) to a binary image file. No relocation information should be present in source-file.

makeimage bootsect-image start16-image kernel-image device-name >image-file
Combines the three binary files bootsect-image, start16-image and kernel-image into a single file image-file suitable for dd'ing to a diskette to create a bootable system disk.

device-name is the name of the system's boot device, for example `fd0:' or `hda1'.

sbb boot-file
Prints out the information coded into the boot block stored in the file boot-file.

sysdisk start16-image kernel-image device-name system-file
Combines the two binary files of the system's startup (16 bit) and kernel (32 bit), and installs this system onto the device represented by the file system-file. The argument device-name names the device which is being booted from (for example `hda4:').

Compiling The System

Since the system is fairly large we have split the source code into easily manageable sections, each section being stored in a separate directory. Each module is considered a section, the kernel is also split into sections. Each directory is given a `Makefile' whose default target is to build the contents of that directory (i.e. to create a module file or part of the kernel). The top-level `Makefile' can be used to recurse through the source hierarchy compiling each section in turn. This allows the whole system to be built by simply typing `make' in the root of the source tree.

The top-level `Makefile' also contains a number of phony targets, each of which performs some useful operation. These targets include the following:

`image'
Create an image file called `image' suitable to be copied to a disk to create a bootable system disk.

`sys'
Copy the system to the filing system which has been set up to contain it. (See below.)

`disk'
Copy the `image' file to the floppy disk drive.

`root'
Create a root filing system for the system.

`getlog'
Copy the system log from the root filing system to the file `log' in the current directory of the Unix filing system.

`install'
Copy all modules to the `/lib' directory on the system's root filing system.

`realclean'
Totally clean the source tree.

To use these targets the following environment variables must be set to suitable values:

VMM_ROOT
The name of the device used to store the system's root filing system. For example `hda1:'.

VMM_ROOT_SIZE
The size, in kilobytes, of the device named in the variable VMM_ROOT.

VMM_BOOT
The name of the device used to boot the system from. Often this will be the same as the value of the VMM_ROOT variable.

VMM_CFLAGS
Any special flags which should be passed to GCC as it compiles the system's source files.

LD_DOES_QMAGIC
Define this to something if your copy of the ld program can produce QMAGIC format executables.

Go to the previous, next section.