Chapter 13 Configuring the Kernel
13.1 Introduction:
kernel hides the system’s hardware underneath an abstract, high-level programming interface. It is responsible for implementing many of the facilities that users and user-level programs take for granted.
à
device drivers: manage specific pieces of hardwareà
other device-independent stuffs.
à
a process asks the kernel do somethingà
the kernel translate this into a device driver instructionà
the driver further break this command down into sequences of bit patterns to be presented to the device’s control registers.
kernel is written mostly in C, with a little assembly language for low-level processing.
13.2 Differences Between ATT and BSD
BSD kernels ask for guidance in advance, while ATT kernels forge blindly ahead and then beg for forgiveness after something gone horribly wrong.
13.3 when to configure the kernel
à
you should reconfigure the kernel every time you bring up a new machine and every time you upgrade the operating system. Most versions of UNIX come with a "generic" kernel already configred. You will usually be supplied with both a generic configurationfile and the corresponding executable kernel.
à
to add a new type of device to your system, you must include its driver in your kernel. The driver code has to be integrated into the kernel’s data structures and tables.à
several ways of adding device drivers:
à
the kernel runs in constant space. When you boot the system, the kernel figures out the number of process table slots, filesystem buffers, and file table entries to allocate, then goes out and scarfs up the appropriate amount of memory. We can not start more processes or oen or files than the kernel is configured to support. So, if we have too few or two many table entries which makes the system not work properly, we have to reconfigure the kernel.
13.4 Building a BSD kernel
building a kernel is a nine-step process:
à
Before you can configure a kernel, you need to know what devices it must handle. Make a list of all the devices connected to the computer, including:Terminal interfaces
Disk drives and their controllers
Tape drives and their controllers
Network interfaces
Coprocessors(graphics processors, etc)
Frame buffers
Keyboard and mouse
à
Once you know how you want your kernel configured, you must put this information into a form that config can understand. To do this , you create a configuration file in SYS/conf. You can copy the GENERIC configuration and delete the part you don’t want instead of creating the configuration from scratch.
à
cd to your SYS area and run the command mkdir kernel.
à
cd to the SYS/conf directory before running config, because it expects to find the configuration file specified on the command line in the current directory.à
do config < the name of the kernel file >
à
after config finishes, cd to the compilation directory for the new kernel. Now run make depend inside the compilation directory. This will initialize the file dependency information used by make.
à
In the compilation directory, type make kernel, where kernel is the name of one of the configurations you specified with a config keyword inside the configuration file,. This will usually be vmunix.à
For extra protection, have make keep a record of everything that gets sent to your terminal with the tee command.make vmunix | & tee ERRS.LOG
à
Before you boot a new kernel, make sure that you can recover your system if it doesn’t work.
à
Before you reboot the machine, bring it down to single-user mode and use fsck –p to clean the root partition of the disk. Then reboot.à
you can do a ps, and a ls check whether you system is in good shape.
à
Go back to your original SYS/conf/Kernel file and put in copious comments so that you will understand what you have done when you come back to read it six months or a year later.à
send mail to the users of your system describing the changes you have made.