+ All Categories
Home > Documents > Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy.

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

Date post: 29-Dec-2015
Category:
Upload: merry-lewis
View: 221 times
Download: 2 times
Share this document with a friend
Popular Tags:
21
Drivers and The Kernel Drivers and The Kernel Chapter 12 Chapter 12 Presentation by: Kathleen Pensy
Transcript
Page 1: Drivers and The Kernel Chapter 12 Presentation by: Kathleen Pensy.

Drivers and The KernelDrivers and The KernelChapter 12Chapter 12

Presentation by:

Kathleen Pensy

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

Purpose

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

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

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.

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

The Kernel

• Device drivers– Automatic detection– Load all

• Location of build directory build kernel

– Solaris /kernel– BSD /usr/src/sys /kernel– Linux /usr/src/linux /boot/vmlinuz

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

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.

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

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

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

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

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

Debugging

• Prtconf-general information

• Sysdef - prtconf on steroids

• Modinfo – dynamically loaded modules

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

Linux Kernel

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

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

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

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

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

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

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

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

FreeBSD

• 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

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

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

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

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

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

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:– Attach Psize Strategy Close– Read Timeout Dump Receive– Transmitioctl resize open– Write select probe stop

• 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*

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

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

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

Structure

Device Drivers

Modules

Loadable device drivers

Static Device Drivers

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

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

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

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

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

Questions

• Anyone have any questions?


Recommended