COMPUTER AND NETWORK
SYSTEM ADINISTRATION
CIS 5406-01
Summer 1999 - Lesson 5

Configuring Kernels

 
 
The UNIX kernel
 
   - In one sense, the kernel is the operating system
 
   - Manages the hardware
 
   - Provides low level interface to the hardware (through
     system calls)
 
   - Contents vary - usually performs:
 
      - process management
      - memory management 
      - secondary storage management (free-space, storage
        allocation, disk scheduling)
      - I/O system management (device drivers)
      - file system implementation
      - interrupt handler
      - protection mechanism
      - networking
 
   - Microkernel approach
 
      - microkernel contains bare minimum
      - acts as a message passer or arbitrator for other
        modules
      - many functions are implemented modularly outside of the
        kernel
      - example: CMU Mach microkernel, with a UNIX macrokernel above it
        Another example is the MkLinux project, a Linux port with
        a microkernel underneath.  A popular port is to the 
        Macintosh PowerPC platform.
 
Differences between BSD and AT&T
 
   1. Original BSD systems 
 
      - Require that kernel be configured and recompiled before use
 
   2. AT&T (System V) systems 
 
      - Attempt to load parts of kernel at boot time depending on:
 
        + hints given in system file
        + hardware actually located when kernel probes the system

Chapter 15 of ESA contains details on UNIX-specific kernel configurations.
We will look at Solaris & Linux in particular.
 
Solaris 2.x (SunOS 5.x) configuration
 
   1. Intro
      
      - BSD loads all modules defined in the configuration file
      - AT&T only loads drivers for devices that it finds when probing
        the system
      - Loads other modules at first reference
      - Can override this and can dynamically load modules
      - How can you tell current configuration?
 
   2. sysdef - tells you more than you want to know :)
 
      - lists all loadable modules
 
        part of output:
 
        Node 'options', unit #0
        Node 'aliases', unit #-1 (no driver)
        Node 'memory', unit #-1 (no driver)
        Node 'virtual-memory', unit #-1 (no driver)
        Node 'TI,TMS390S10', unit #-1 (no driver)
        Node 'openprom', unit #-1 (no driver)
        Node 'iommu', unit #0
          Node 'sbus', unit #0
            Node 'espdma', unit #0
              Node 'esp', unit #0
                Node 'sd', unit #-1 (no driver)
                Node 'st', unit #-1 (no driver)
                Node 'sd', unit #0 (no driver)
                Node 'sd', unit #1 (no driver)
                Node 'sd', unit #2 (no driver)
                Node 'sd', unit #3
                Node 'sd', unit #4 (no driver)
                Node 'sd', unit #5 (no driver)
                Node 'sd', unit #6 (no driver)
            Node 'audio', unit #-1 (no driver)
            Node 'SUNW,bpp', unit #-1 (no driver)
            Node 'ledma', unit #0
            Node 'le', unit #0
            Node 'cgthree', unit #0
        Node 'obio', unit #0
          Node 'zs', unit #0
          Node 'zs', unit #1
 
      - also lists all loadable modules
 
      Similar info from "prtconf"
 
   3. /usr/sbin/modinfo - currently loaded modules
 
       Id Loadaddr  Size Info Rev Module Name
        1 fc045000  3ba0   1   1  specfs (filesystem for specfs)
        2 fc04c000  1340   -   1  swapgeneric (root and swap configuration)
        3 fc058000  1a56   1   1  TS (time sharing sched class)
        4 fc04a000   49c   -   1  TS_DPTBL (Time sharing dispatch table)
        5 fc05d000 15248   2   1  ufs (filesystem for ufs)
        6 fc055000   ad4   1   1  rootnex (sun4m root nexus)
       ...
       15 fc0b4000  c4f0  61   1  esp (ESP SCSI Host Bus Adapter Drive)
       ...
       76 fc535000  6fdd  36   1  fd (Floppy Driver)
       77 fc46a800  17a4   -   1  klmmod (KLM misc module)
 
    "modinfo displays information about the loaded modules.   The
     format of the information is as follows:
 
          Id  Loadaddr  Size  Info  Rev  Module Name
 
     where Id is the module ID, Loadaddr  is  the  starting  text
     address,  size  is the size of text, data, and bss in bytes,
     Info is module specific info, Rev is  the  revision  of  the
     loadable modules system, and Module Name is the filename and
     description of the module.
 
     The module specific information is the block  and  character
     major numbers for drivers, the system call number for system
     calls, or, for  other  module  types,  the  index  into  the
     appropriate kernel table:"
 
       < the "Info" field is driver specific
 
         - the character major numbers for drivers
         - the system call number for system calls
         - for other module types, the index into the appropriate kernel table
 
   4. /usr/sbin/modload - can use this command to load a module into a 
      running kernel
 
   5. /etc/system  ("man -s 4 system")
 
      - this file is used for customizing the operation of the kernel
      - allows you to override the dynamic loads
      - make a backup (can use boot -a to access backup file)
 
      - /etc/system key words:
 
        moddir:    Set the search path for modules
        rootfs:    Set the filesystem type of the root
        rootdev:   Set the root device
        exclude:   Exclude this module - do NOT load
        forceload: Loaded at boot time rather than at first reference
        set:       Set an integer variable in the kernel or a module to a 
                   new value. ** Be careful **
 
Linux kernel configuration walk-through
 
   1. look in /linux or /usr/src/linux; details in README file.  You
      may need to run the steps in the section named "INSTALLING the kernel".
 
   2. make menuconfig - configures new kernel
                  - this runs the script: Configure
                  - the completed configuration is in a file
                       named .config (shell script variables)
                  - a backup is in .config.old
 
   3. make dep    - sets up dependences for compilation
 
   4. make clean  - remove any old object files
 
   5. make zdisk  - creates bootable floopy
                  - actually, this command will execute
                    #2 above if you don't have a current
                    .config file
 
      Another popular variation is "make zlilo", which will install your
      new kernel in a known place and run "lilo".
 
   6. keep a backup boot disk!
 
      Linux also has loadable modules!  Consult
      /usr/src/linux/README.modules for details.  In particular,
      note the "mod" commands - depmod, insmod, lsmod, modprobe,
      and rmmod.
 
Configuring the Windows NT Kernel  
Configuring Windows NT does not mean having to rebuild the kernel, since the source code is not available. NT does make extensive use of Dynamic Loadable Libraries -- DLL files, which provides a convenient way to extend the kernel's capabilities.   As for tuning parameters, one place is in the Settings/System dialog box.   One tab, named "Performance", allows you to modify the priority of the foreground application and modify the paging disk space, as well as the size of the Registry file. Other tabs allow you to modify other system parameters, such as the "Environment" (system and user variables), "Hardware Profiles" (Control Sets that describe different hardware configurations), "User Profiles" (per user desktop settings), "General" (read-only machine characteristics) and "Startup/Shutdown" (set BOOT.INI parameters, set recovery options).   Another place where system parameters are viewed and modified is the Registry. Reference page 18 in EWNTSA for details. Note that the Registry is a common database for hardware and software configuration information. It supercedes the older DOS/WIN config files CONFIG.SYS, AUTOEXEC.BAT, SYSTEM.INI, WIN.INI and PROTOCOL.INI. Refer to the Windows NT Registry Nuts & Bolts "Job Aid" (pocket book) that came with your bookset.   Two GUI-based Registry editors are available: REGEDIT.EXE (16-bit) and REGEDT32.EXE (32-bit). Use the latter, as it understands more of the native data types (see page 19 in EWNTSA).   The Registry Editor uses the same Explorer paradigm for viewing a database tree with five roots:   HKEY_LOCAL_MACHINE - configuration information particular to the computer (for any user).   HKEY_LOCAL_MACHINE\HARDWARE - binary info about the machine; easier to view info via Windows NT Diagnostics tool   HKEY_LOCAL_MACHINE\SAM - Security Account Manager (SAM) database; user and group account info. Note that passwords are stored here, in an encrypted form.   HKEY_LOCAL_MACHINE\SECURITY - user rights, group membership and passwords (encrypted)   HKEY_LOCAL_MACHINE\SOFTWARE - Installed software configuration   HKEY_LOCAL_MACHINE\SYSTEM - Startup process   HKEY_CLASSES_ROOT - window is a subkey of HKEY_LOCAL_MACHINE\Software. The information stored here is used to open the correct application when a file is opened using the Windows NT Explorer and for Object Linking & Embedding (OLE) -- for backward compatability.   HKEY_CURRENT_USER - root of the configuration information for the user who is currently logged on. The user's folders, screen colors, and Control Panel settings are stored here. This information is referred to as a user's profile. HKEY_CURRENT_USER is a subkey of HKEY_USERS.   HKEY_USERS - root of all user profiles on the computer.   HKEY_CURRENT_CONFIG - hardware profile used by the local computer at system startup.   Registry entries contain keys with values. The values are native data types, containing binary and string data.   Hive - A single file (with ".LOG" ending; in \WINNT\SYSTEM32\CONFIG) that contains keys, subkeys and values.