Drivers and the kernel chapter 12
This presentation is the property of its rightful owner.
Sponsored Links
1 / 21

Drivers and The Kernel Chapter 12 PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Drivers and The Kernel Chapter 12. Presentation by: Kathleen Pensy. Purpose. Assembles : Processes Signals and semaphores Virtual Memory File System Interprocess Communication. Terms.

Download Presentation

Drivers and The Kernel Chapter 12

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Drivers and the kernel chapter 12

Drivers and The KernelChapter 12

Presentation by:

Kathleen Pensy




  • Processes

  • Signals and semaphores

  • Virtual Memory

  • File System

  • Interprocess Communication



  • Device Driver -A program that extends the operating system to support a device such as a disk or tape drive; or a program that enables an application to use a device such as a printer driver. Hardware devices such as sound cards, printers, scanners, and CD-ROM drives must each have the proper driver installed in order to run. Does not actually have to be associated with a device (ie pseudo terminal).

  • Module- a piece of kernel code that can be arbitrarily loaded and unloaded during run time. They can be installed and uninstalled as needed. Modules can be arbitrarily loaded at boot time.

  • Loadable device drivers – a device driver that is implemented as a module.

The kernel

The Kernel

  • Device drivers

    • Automatic detection

    • Load all

  • Location of build directory


    • Solaris /kernel

    • BSD /usr/src/sys/kernel

    • Linux /usr/src/linux/boot/vmlinuz

Configuring the kernel

Configuring the Kernel

  • Why?

    • Unwanted drivers

    • Drivers not loaded

    • New hardware

  • Tailor System –good thing (NOT)

    • Book’s wrong!!!

    • Only if you have a really pathetic system

    • Some exceptions # of tty’s or connections

    • Brian’s Rule – the cost of more memory or disk space is far less expensive and produces a much greater result than that of the cost of time and pain you will spend trying to optimize your current system.

    • I.E reasons I don’t support sound cards, and certain devices.

Solaris kernel

Solaris Kernel

  • Probes and automatically loads

  • Areas

    • /kernel – instructions

    • /platform/platformname (ie Ultra 5)

    • /platform/hardware sun4u

    • /usr/kernel

  • uname - Print certain system information.

  • Directories pg 227

Solaris continued

Solaris continued…

  • /etc/system –very important

    • rootfs – type of root

    • rootdev – root partition

    • forceload – load devices

    • exclude – do not load devices

    • moddir – new path to modules

    • set – set variables

      • pt_cnt – number of available pty’s

      • max_nproc – max num. of proc.

      • maxuprc – max num. of user proc.

  • Examples:

    • Set the number of pty’s when too many users are connecting. Had problems on sunserver1 when too many users were trying to ssh in. TTY will be explained later.

    • Set the number of processes a given user can execute (too many users).

    • Max_nproc bad idea. Generally


Prtconf-general information

Sysdef - prtconf on steroids

Modinfo – dynamically loaded modules


Linux kernel

Linux Kernel

  • Configuration menus

    • make xconfig – graphical configuration

    • make menuconfig curses configuration

    • Make config command line

    • .config contains everything about the kernel.

Linux continued

Linux continued

  • Entries in .config

    • M = enabled as module

    • Y = compiled into kernel

  • Compiling kernel:

    • Cd /usr/src/linux*

    • mrproper (not mentioned in the book)

    • make menuconfig

    • make dep

    • make clean

    • make bzImage

    • make modules

    • make modules_install

Linux continued1

Linux continued …

  • lilo.conf specifies boot process

  • /sbin/lilo – installs boot loader that will be activated next time you boot

  • lilo – linux loader, master boot program or secondar.

  • Always backup your new image

  • Boot dos/windows partitions as well

Linux continued2

Fine tuning /proc/sys/fs













Not remembered across reboots

Try scripts

From program sysctl (not mentioned in the book)

Kat’s #1 Rule – man page is your friend 

Linux continued…

Purpose is to allow run-time kernel modification



  • Similar to linux

  • Location

    • /usr/src/sys = source

    • /usr/src/sys/arch/conf = configuration of kernel

  • Configuration

    • Edit conf

    • Config from conf

    • Make depend

    • Make |& tee error

    • Man –k is your other good friend

Bsd continued

BSD continued…

  • /kernel = the kernel back it up

  • Configuration consists of

    • machine, cpu, ident, maxusers, options, config, controller, disk, tape, device, pseudo-device

    • example including nfs in config

      • options NFS

      • Disk wd0 at wdc0 disk 0

      • Options “CD9660”

      • Controller isa0

  • You can also change configuration on runtime through sysctl as well

Device drivers

Device Drivers

  • Device driver - manages systems interaction w/ a particular piece of hardware.

  • Configuring a driver for more than 20 computers can be painful - This is why kat thinks linux sucks

  • New devices = more pain (haha) a new device driver

  • Never upgrade a driver unless absolutely necessary

  • Solaris =  easier

  • Linux =  (Get the picture?) harder

  • /dev – device files that may link to device drivers

  • ls –l lists the major and minor

    • Major = device type

    • Minor = particular instance of a given device

The frustration caused by trying to configure a device driver with certain OS’s

Device files

Many devices

correspond to device files contained in /dev


Block – written or read as one block

Character – written one byte at a time

Standard interfaces:


ReadTimeoutDump Receive



Configuration files



Linux /usr/src/linux/.config/usr/src/linux/drivers/*


Device files

Standard device files

Standard device files

  • Examples:

    • Pty –pseudo termnials (ssh,xterm, telnet, rlogin)

      • A slave and master the slave is actually controlled by the ssh, etc what have you.

    • Loopback – network interface to local host (send to self)

    • Rmt – tapes

    • Rst – scsi tapes

    • Console device

  • r= stands for the raw device

  • Conventions for each are in the hand out.

    • From Essential Systems Administrators Hand book. ( more clear)

  • Controller this is where disk is pluged device is the number at which it is attached on that controller. Partition is the slice on that disk.

  • Create your own device file:

    • Mknod or makedev



Device Drivers


Static Device Drivers

Loadable device drivers

Solaris specific

Solaris Specific

  • Devices

    • Add

      • add_drv – loads driver into the kernel

      • pkgadd – very easy interface

    • Remove

      • pkgrm – easy

      • rem_drv – unload by hand

  • Modules

    • Add

      • modload – loads into the running file system

    • Remove

      • modunload – unloads it

    • Modules can be linked and removed while the kernel is running

    • Modinfo as seen before shows modules hardwired into the kernel afs, nfs, tcp

Linux specific

Linux Specific

  • Devices

    • Adding Device driver

      • cd /usr/src/linux ; patch –p1 < driver.diff

  • Modules

    • Add

      • insmod /path/to/object.o

      • Modprobe – install or remove into the kernel (can load all modules from a directory)

        • modprobe -a -t boot

    • List

      • lsmod – list modules

    • Remove

      • rmmod – remove modules

    • Modprobe

      • Can generate dynamic /etc/modules.conf



  • Anyone have any questions?

  • Login