CS 134

Building the Kernel

The OS/161 kernel uses a fairly complex but powerful build system. It uses a configuration file to specify which parts of the kernel need to be built, and provides separate build areas for each configuration.

Our first step in building a kernel is to configure the build using a configuration file. Make sure your current directory is ~/cs134/hw1, and then run:

cd src/kern/conf
mkdir ../compile
./config DUMBVM

Now that the kernel is configured, we can build it. Type:

cd ../compile/DUMBVM
bmake depend
bmake
bmake install

Once it's built, change directory to your virtual root directory and test the kernel, as follows:

cd ~/cs134/hw1/root
sys161 kernel

You can't do much with the kernel at this point. Two things you can do are initiate a kernel panic with the panic command, and run a user level program that performs the "reboot" system call by typing p /sbin/reboot. Try both of these now.

You can also use gdb. Open another terminal window, and ensure both are in the directory ~/cs134/hw1/root. Then,

First Window

Second Window

First Window

Run the command

sys161 -w kernel

The system should pause with the message that it is waiting for a message from the debugger.

Second Window

Run the command

os161-gdb kernel

and once gdb has started, type the following commands into gdb:

connect
break panic
continue

First Window

OS/161 should now start up. Enter the command

panic

Second Window

GDB should have now stopped at the breakpoint you set for panic. Type the following commands:

backtrace
continue

Quit gdb.

First Window

Execution should resume, and the kernel should exit with its panic message and shut down the machine.

To Complete This Part of the Assignment…

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)