1 / 21

Drivers and The Kernel Chapter 12

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

Télécharger la présentation

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Drivers and The KernelChapter 12 Presentation by: Kathleen Pensy

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

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

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

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

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

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

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

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

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

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

  12. 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  Linux continued… Purpose is to allow run-time kernel modification

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

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

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

  16. 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 Transmit ioctl 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* Device files

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

  18. Structure Device Drivers Modules Static Device Drivers Loadable device drivers

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

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

  21. Questions • Anyone have any questions?

More Related