Presentation is loading. Please wait.

Presentation is loading. Please wait.

Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy.

Similar presentations


Presentation on theme: "Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy."— Presentation transcript:

1

2 Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy

3 Purpose Assembles : Processes Signals and semaphores Virtual Memory File System Interprocess Communication

4 Terms 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.

5 The Kernel Device drivers –Automatic detection –Load all Location of build directory buildkernel –Solaris /kernel –BSD /usr/src/sys/kernel –Linux /usr/src/linux/boot/vmlinuz

6 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.

7 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

8 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

9 Debugging Prtconf -general information Sysdef - prtconf on steroids Modinfo – dynamically loaded modules

10 Linux Kernel Configuration menus –make xconfig – graphical configuration –make menuconfig curses configuration –Make config command line –.config contains everything about the kernel.

11 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

12 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

13 Linux continued… Fine tuning /proc/sys/fs –binfmt_misc –dquot-nr –inode-nr –leases-enable –dentry-state –file-max –inode-state –overflowgid –dir-notify-enable –file-nr –lease-break-time –overflowuid Not remembered across reboots Try scripts From program sysctl (not mentioned in the book) Kat’s #1 Rule – man page is your friend Purpose is to allow run-time kernel modification

14 FreeBSD Similar to linux Location –/–/usr/src/sys = source –/–/usr/src/sys/arch/conf = configuration of kernel Configuration –E–Edit conf –C–Config from conf –M–Make depend –M–Make |& tee error –M–Man –k is your other good friend

15 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

16 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

17 Device files Many devices –correspond to device files contained in /dev Types: –Block – written or read as one block –Character – written one byte at a time Standard interfaces: –AttachPsizeStrategyClose –ReadTimeoutDump Receive –Transmitioctlresizeopen –Writeselectprobestop Configuration files –Solaris/kernel/drv/*conf/kernel/drv/* –HP-UX/stand/system/usr/conf/* –Linux /usr/src/linux/.config/usr/src/linux/drivers/* –FreeBsd/usr/src/sys/i386/conf/kernel/sys/i386/conf/files*

18 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

19 Structure Device Drivers Modules Loadable device drivers Static Device Drivers

20 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

21 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

22 Questions Anyone have any questions?


Download ppt "Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy."

Similar presentations


Ads by Google