Build OS161
Conventions
This document assumes you are working on OS/161 in a
directory
Configure the tree
The first step is to run the configure script in the top-level directory of the source tree. This sets things up to work with the OS you are working on and tells the makefiles what to do with certain things.
Use the
cd ~/os161/src ./configure --ostree=$HOME/os161/root
Note that you need
The script creates a file
Rerun this step if you move your source tree to a different computer that is running a different OS.
Build userland
To build the C library and user programs (including the test programs and
everything else) just type
You can compile a single program by typing bmake in its source directory;
typing
The makefiles support the other conventional make rules; bmake depend updates the header file depend information, bmake clean erases the compiled objects, and bmake distclean returns the tree to a fully pristine state. You can also run bmake includes from the top level (or from the kernel or any library) to update the header files used by the build process.
If you are on a multiprocessor or multicore machine, you can speed the build
by doing a parallel make. Use the
If you are working on NetBSD, type
All the build results are created in the build directory under the top level
of the source tree. This can be placed elsewhere if desired, such as on a RAM
disk, or a local disk if your working tree is a network volume. Read the file
Rerun this step if you change any of the kernel headers exported to userland
(the ones in
Configure a kernel
Historically, most Unix systems would run kernels that had been customized for a particular piece of hardware. Such kernels would have only the device drivers needed for that system, and would include only the kernel features that were going to be used. (Leaving out everything else saves memory.) They would also sometimes have custom tuned settings for things like scheduler or pageout behavior.
OS/161 has a similar mechanism. The kernel configurations are kept in the directory src/kern/conf and are by convention named with all caps. You can copy one of the configs and edit it to remove drivers that you aren't using, in the traditional way; however, with System/161's simple hardware there's not much point to that, so you will probably just use the standard configurations. Choose the one you currently want to build. (The one you will use when first starting off is probably called either DUMBVM or ASST0.)
Now run the OS/161 config program. This is a shell and awk script, and it lives in the same directory as the config files. Assuming you mean to configure DUMBVM you run:
./config DUMBVM
Note the
Rerun this step if you change the kernel config, add new source files to the build, or add new build options.
Compile a kernel
To compile a kernel, first move to its compile directory:
cd src/kern/compile/DUMBVM
Then run first
Remember to install your newly built kernel before trying to test it. (The reason builds are numbered and the kernel prints the build number when booted is so you can easily tell if the kernel you just ran is really the one you just compiled.)
The conventional
Rerun bmake depend if/when you change header file inclusions, or after re-running config. Otherwise, there is no need to repeat it. Rerun bmake to recompile as needed.