Presentation on theme: "Linux Device Driver Development Chris Lydick Spring 2007."— Presentation transcript:
Linux Device Driver Development Chris Lydick Spring 2007
Class Schedule CIS e (π*i) TU10:30 Intro to Device Drivers Lydick PSYCH 012 MWF11:30 My Motivation Lydick EECE 92181 MWF9:30 Reverse Engineering Lydick LAB 0 F2:30p Demonstrations Lydick
Textbook List J. Corbet, A Rubini, G Kroah-Hartman. Linux Device Drivers, 3rd Ed. Available for download online! http://lwn.net/Kernel/LDD3/
Operating Systems 101 Ive not had Operating Systems…but… –Role of Device Drivers Mechanism vs. Policy Black Box Semi/undefined interface (device) -> Well defined interface (Linux API)
Operating Systems 102 Uses C Language Gets complicated very quickly (lots of macros, code) Need to have a sense of... –concurrency, race conditions –interrupts, deferred work –mutual exclusion –kernel and user-space memories –****pointers, structures, … (lots to consider)
Operating Systems 103 Textbook has provided lots of skeletons and demos (Wheew!) My testbed: Fedora Core 4, 2.6.11 (book requested 2.6.10) Should we start with…. Hello World?
Operating Systems 104 OK, easy… So what. Before digging deeper, consider 3 types of device drivers –Character Devices (stream of bytes) –Block Devices (file systems) –Network Interfaces (duh.)
Operating Systems 105 Char devices: –Scull (Simple Character Utility for Loading Localities)… testbed for Char devices. –Scull0..3 : global/persistent memory –Scullpipe0..3 : FIFO pipes demonstrate contention –Scullpriv : private data for each console
Operating Systems Lab Exercises Scull0 demonstration Scullpipe0 demonstration Scullpriv demonstration Short (Temperature Sensor) Shortprint demonstration
Operating Systems… Final Other Areas of Interest: –Snull (network interface skeleton) –USB-Skeleton (yep.) –PCI-Skeleton (ok.) –Sample Disk Driver (cool.) –TTY Drivers, DMA and Memory Mapping, etc.
Motivation My Thesis: Supercomputing Cluster in 031 Rathbone: –USB Connectivity: driver timeouts/overflows in OpenBSD –Communicated with Chris Pascoe (OpenBSD Developer)
Motivation Acer Labs M5632 Bridge Cable –Worked fine using the standard USB 1.0 Driver –Issues arose with the USB 2.0 (EHCI) driver [diff file][diff file] Abused the kernel profiling framework to check at runtime for kernel stack overflows. –Were switching to Linux (no issues), but its good to know how to dig into drivers… right? –Plus, isnt Linux supposed to be better than Windoze?
Reverse Engineering 101 Reverse Engineering: Getting something to work by watching it work when correctly loaded. –Usually occurs within Windows (sorry, we just cant get away from Microsoft!)
Reverse Engineering 102 USB Devices (URB): USB Analyzer/Sniffer (Snoopy, USB Monitor,..) Acts similarly to Ethereal /sys/devices/pci0000:00/000:00:02.0/usb2/ PCI Bus Hardware Sniffers… (much more difficult to analyze!)