1 / 20

Linux Device Driver Development

Linux Device Driver Development. Chris Lydick Spring 2007. CIS e (π*i). TU. 10:30. Intro to Device Drivers. Lydick. PSYCH 012. MWF. 11:30. My Motivation. Lydick. EECE 92181. MWF. 9:30. Reverse Engineering. Lydick. LAB 0. F. 2:30p. Demonstrations. Lydick. Class Schedule.

jase
Télécharger la présentation

Linux Device Driver Development

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. Linux Device Driver Development Chris Lydick Spring 2007

  2. CIS e(π*i) TU 10:30 Intro to Device Drivers Lydick PSYCH 012 MWF 11:30 My Motivation Lydick EECE 92181 MWF 9:30 Reverse Engineering Lydick LAB 0 F 2:30p Demonstrations Lydick Class Schedule

  3. Textbook List J. Corbet, A Rubini, G Kroah-Hartman. Linux Device Drivers, 3rd Ed. Available for download online! http://lwn.net/Kernel/LDD3/

  4. Operating Systems 101 • I’ve not had Operating Systems…but… • Role of Device Drivers • Mechanism vs. Policy • Black Box • Semi/undefined interface (device) -> Well defined interface (Linux API)

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

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

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

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

  9. Operating Systems Lab Exercises • Scull0 demonstration • Scullpipe0 demonstration • Scullpriv demonstration • Short (Temperature Sensor) • Shortprint demonstration

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

  11. Motivation • My Thesis: Supercomputing Cluster in 031 Rathbone: • USB Connectivity: driver timeouts/overflows in OpenBSD • Communicated with Chris Pascoe (OpenBSD Developer)

  12. 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] • “Abused” the kernel profiling framework to check at runtime for kernel stack overflows. • We’re switching to Linux (no issues), but it’s good to know how to dig into drivers… right? • Plus, isn’t Linux supposed to be better than Windoze?

  13. Reverse Engineering 101 • Reverse Engineering: Getting something to work by watching it work when correctly loaded. • Usually occurs within Windows (sorry, we just can’t get away from Microsoft!)

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

  15. Conclusions • GET THE BOOK! It’s very helpful and is a great reference! • Examples are available for download • Book is freely available (wget it before it’s gone!) • Next step: USB!

More Related