next up previous
Next: The libraries Up: Introduction Previous: Library Structure

Compiling and Using

The OSLib code is distributed as source code in a ZIP or tarball archive. The tarball contains the source to be compiled in a Unix system (only chr(10) at the end of each line), while the ZIP archive can be decompressed in MSDOS (chr(13)+chr(10)) or Unix source using the -a option of UNZIP.

In order to decompress the source tree, use tar -xvzf llxxx.tgz or unzip -La; this command will create the tree shown in Figure 1.1.

Figure 1.1: The OSLib source tree.
oslib--\=------ll--\=------i386 \\
\> ...
...---examples \\
\> \vert \\
\> \vert---mk \\

The ll directory contains the header files with the definitions of the OSLib structures and the prototypes for the OSLib calls. It is organized in two subdirectories: the i386 directory, containing the include files for the hardware support library, and the sys/ll directory, containing the headers for the OS support library.

The lib directory is the place where all the libraries will be put once compiled. Depending on the distribution, the lib directory is in the archive or will be created at compilation time by the make command.

The xlib directory contains the sources for the hardware support library; the libm directory is used to compile a modified version of the FreeBSD math library provided with OSLib; the libc directory contains the sources for the minimal C library, while the kl directory is the place where the Kernel support library source code resides.

The examples directory contains some examples showing how to use all the functionalities provided by OSLib.

The mk library contains some configuration files, used to compile the libraries in different host OSs: currently, the files to compile under MDSOS (using DJGPP V1 & V2) and the file to compile under Linux are provided. Moreover, a file to compile the H4 (S.Ha.R.K.) kernel is provided.

In order to compile the system, proceed as follows

A program compiled using the OSLib code can be run using the DOS eXtender, or using GRUB. In order to use the extender, boot MSDOS (or a 16 bit DOS compatible OS, such as FreeDOS), then copy X.EXE in the path, and finally use it: X <program name> (for example, try X schedtest.xtn). Once the program execution is terminated, it will nicely return to DOS.

In order to run a program through GRUB, put it in a GRUB accessible partition, then boot GRUB and enter the command prompt pressing `c'. Now, specify the compiled program as a kernel: assuming that you want to run schedtest.xtn, residing in the /oslib/examples directory on the first partition of your first hard drive, you have to type kernel=(hd0,0)/oslib/examples/schedtest.xtn. Finally, you can run the program typing boot. Once the program finishes, the system is halted and you must reboot it.

The OSLib code can be used including the adequate headers from the include directory, and linking the libraries from the lib directory. The compiler and linker options are set in the file: look at the makefile in the examples directory to see how to use it. The examples directory contains some simple programs to be browsed in order to learn how to use OSLib.

next up previous
Next: The libraries Up: Introduction Previous: Library Structure
Luca Abeni 2001-01-18