0% found this document useful (0 votes)
7 views10 pages

Device Driver Development Guide

This document provides an overview of writing and installing device drivers in Linux. It discusses the tasks involved like building and running modules, and types of device drivers for character, block and network devices. It describes building a device driver module versus an application, compiling and loading modules, and working in kernel space versus user space. It also summarizes implementing a basic "hello world" driver and the Scull driver as an example character device driver.

Uploaded by

Vikkie Kerketta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views10 pages

Device Driver Development Guide

This document provides an overview of writing and installing device drivers in Linux. It discusses the tasks involved like building and running modules, and types of device drivers for character, block and network devices. It describes building a device driver module versus an application, compiling and loading modules, and working in kernel space versus user space. It also summarizes implementing a basic "hello world" driver and the Scull driver as an example character device driver.

Uploaded by

Vikkie Kerketta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

DEVICE DRIVER

VINOD KAMATH
CS691X PROJECT WORK
Introduction
• How to write/install device drivers
• Systems, Kernel Programming
• Character, Block and Network devices
Tasks involved
• Building and Running modules
• Character device drivers
Building device driver
• Module vs. Applications
module
– Appln - single task
– Module - register for future
• Compiling and Loading
– ___KERNEL__, MODULE
– insmod,rmmod
– Global var-Symtab
• Do in Kernel space (not User space)
– response time; block/network devs
Character device drivers
• Scull - Simple Char. Util. for Loading
Localities
– Acts on mem. Area as though it is a device
– Demonstrate interface betn. Kernel and Char
drivers
– n devices for n mem. areas
• Major/Minor no.- (un)register chr_dev
Design and
implementation
• File operations/structure
of Scull
– Device id. By file structure
– Kenerl uses file ops. To access driver’s functions
• Open and Close
– Initialize device, usage count,
• Memory
– Device-memory Link List
• Read and Write
– Transfer data from Kernel-User
• Testing/Debugging
– cp, cat, dd wls-l > dev/scull0
Examples-Hello World

• #define MODULE
• #include <linux/module.h>

• int init_module (void) {printk(“<1>Hello,


World\n”); return 0}
• void cleanup_module
{printk(“<1>Goodbye, cruel World\n”);}
Examples-Scull

• #define MODULE, __KERNEL__


• #include <linux/module.h>….
• Struct file_operations d0_fops = {r,w,o,c }
• int init_module (void) {malloc, reg
do_fops}
• void cleanup_module (unreg, free...);l
Conclusions
• Writing device drivers is not for faint
heart/Adventure
• Very careful with Kernel codes
Future work
• Try Advanced drivers, Scheduling
• Understand principle for multi user

You might also like