next up previous

Kernel Configuration

This contains links to information used in the lectures.

The Unix Kernel provides interfaces to the following

The kernel contains device drivers and the rest is mainly device independent. Kernel is written in C. Originally under 500K, now for example 1845730 on SunOS, 2383872 on HP-UX 9.XX, 6278372 on HP-UX 10.XX.

ATT v BSD

When to Configure

Building A BSD kernel - SunOS

The files for building the kernel are in /usr/sys :
conf.common/    net/            sbusdev/        sun4m/          sys/
debug/          netinet/        scsi/           sundev/         ufs/
krpc/           nfs/            sparc/          sunif/          vm/
lofs/           os/             specfs/         sunwindow/
mon/            rpc/            sun/            sunwindowdev/
The sun4m directory is the architecture specific directory:
NIMITZ/         cpu.h           intreg.h        openprom_xxx.c  seg_kmem.h
OBJ/            dbx_machdep.c   iocache.h       param.h         setjmp.h
a.out.h         debug/          iommu.h         pcb.h           trap.h
asm_linkage.h   devaddr.h       libprom.a*      psl.h           vm_hat.h
async.h         devr.h          llib-lprom.ln*  pte.h           vmparam.h
auxio.h         eeprom.h        machine@        reg.h
buserr.h        enable.h        memerr.h        romvec.h
clock.h         fpu@            mmu.h           sas_simdef.h
conf/           frame.h         module.h        scb.h
Note that Steps in building a kernel: Steps in building a kernel:

Creating a BSD Configuration file - SunOS


Configuration files are lists of control phrases - one per line. Comments are begun with a # character, and end at the next NEWLINE. Lines beginning with TAB characters are considered continuations of the previous line. Lines of the configura- tion file can be one of two basic types. First, there are lines which describe general things about your system:
machine "type"
This is system is to run on the machine type specified. Only one machine type can appear in the config file. The legal types for a Sun system are sun3, sun3x, sun4, sun4c, sun4m, and sun386. Note: the double quotes around type are part of t he syntax, and must be included.

cpu "type"
This system is to run on the CPU type specified. More than one CPU type can appear in the config file.
ident name
Give the system identifier - a name for the machine or machines that run this kernel. Note: name must be enclosed in double quotes if it contains both letters and digits. Also, note that if name is GENERIC, you need not include the `options GENERIC' clause in order to specify `swap generic'.
maxusers number
The maximum expected number of simultaneously active user on this system is number. This number is used to size several system data structures.
options optlist
Compile the listed options into the system. Options in this list are separated by commas. A line of the form:
options FUNNY,HAHA

yields
-DFUNNY -DHAHA
to the C compiler. An option may be given a value, by following its name with = (equal sign) then the value enclosed in (double) quotes. None of the standard options use such a value. In addition, options can be used to bring in additional files if the option is listed in the files files. All options should be listed in upper case. In this case, no corresponding option.h will be created as it would be using the corresponding pseudo-device method.
config sysname config_clauses...
Generate a system with name sysname and configuration as specified in config-clauses. The sysname is used to name the resultant binary image and per-system swap configuration files. The config_clauses indicate th e location for the root file system, one or more disk partitions for swapping and paging, and a disk partition to which system dumps should be made. All but the root device specification may be omitted; config will assign default values as described below.
root
A root device specification is of the form:

root on xy0d

If a specific partition is omitted - for example, if only root on xy0 is specified - the `a' partition is assumed. When a generic system is being built, no root specification should be given; the root device will be defined at boot time by prompting the console.

swap
To specify a primary swap partition, use a clause of the form:
swap on partition
Swapping areas may be almost any size. Partitions used for swapping are sized at boot time by the system; to override dynamic sizing of a swap area the number of sectors in the swap area can be specified in the config file. For example, swap on xy0b size 99999 would configure a swap partition with 99999 sectors. If swap generic or no partition is specified with on, partition b on the root device is used. For dataless clients, use:
swap on type nfs
dumps
The location to which system dumps are sent may be specified with a clause of the form:
dumps on xy1
If no dump device is specified, the first swap partition specified is used. If a device is specified without a particular partition, the `b' partition is assumed. If a generic configuration is to be built, no dump device should be specified; the dump devi ce will be assigned to the swap device dynamically configured at boot time. Dumps are placed at the end of the partition specified. Their size and location is recorded in global kernel variables dumpsize and dumplo, respectively, for use by savecore(8).

Device names specified in configuration clauses are mapped to block device major numbers with the file devices.machine, where machine is the machine type previously specified in the configuration file. If a device name to block device major number mapping must be overridden, a device specification may be given in the form:

major x minor y
The second group of lines in the configuration file describe which devices your system has and what they are connected to (for example, an IPI Channel Adaptor on the VMEbus). These lines have the following format: dev_type dev_name at con_dev more_info

dev_type is either controller, disk, tape, device, devicedriver, or pseudo-device. These types have the following meanings:

controller
A disk or tape controller.

disk or tape
Devices connected to a controller.

device
Something "attached" to the main system bus, like a cartridge tape interface.

device-driver
This declares support for a device of name dev_name. For most devices on desktop SPARCsystems, this is all that is required.
pseudo-device
A software subsystem or driver treated like a device driver, but without any associated hardware. Current examples are the pseudo-tty driver and various network subsystems. For pseudo-devices, more_info may be specified as an integer, that gives the value of the symbol defined in the header file created for that device, and is generally used to indicate the number of instances of the pseudo-device to create.
dev_name is the standard device name and unit number (if the device is not a pseudo-device) of the device you are specifying. For example, idc0 is the dev_name for the first IPI disk controller in a system; st0 names the first SCSI tape controller.

con_dev is what the device you are specifying is connected to. It is either nexus?, a bus type, or a controller. There are several bus types which are used by config and the kernel.

The possible bus types are:

obmem
On board memory
obio
On board io vme16d16 (vme16) 16 bit VMEbus/ 16 bit data vme24d16 (vme24) 24 bit VMEbus/ 16 bit data
vme32d16
32 bit VMEbus/ 16 bit data
vme16d32
16 bit VMEbus/ 32 bit data
vme24d32
24 bit VMEbus/ 32 bit data vme32d32 (vme32) 32 bit VMEbus/ 32 bit data
ipi
IPI pseudo bus (sun4 system only)

All of these bus types are declared to be connected to nexus. The devices are hung off these buses. If the bus is wildcarded, then the autoconfiguation code will determine if it is appropriate to probe for the device on the machine that it is running on. If the bus is numbered, then the autoconfiguation code will only look for that device on machine type N. In general, the VMEbus bus types are always wildcarded.

more_info is a sequence of the following:

csr address
Specify the address of the csr (command and status registers) for a device. The csr addresses specified for the device are the addresses within the bus type specified.

The csr address must be specified for all controllers, and for all devices connected to a main system bus.

drive number
For a disk or tape, specify which drive this is.

flags number
These flags are made available to the device driver, and are usually read at system initialization time.

priority level
For devices which interrupt, specify the interrupt level at which the device operates.

vector intr number [ intr number . . . ]
For devices which use vectored interrupts on VMEbus systems, intr specify the vectored interrupt routine and number the corresponding vector to be used (0x40-0xFF). A ? may be substituted for a number in two places and the system will figure out what to fill in for the ? when it boots. You can put question marks on a con_dev (for example, at virtual `?'), or on a drive number (for example, drive `?'). T his allows redundancy, as a single system can be built which will boot on different hardware configurations.
The easiest way to understand config files it to look at a working one and modify it to suit your system.



next up previous


Paul A. Farrell
Thu Mar 7 15:10:34 EST 1996