Linux device driver
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Linux device driver

on

  • 999 views

Linux kernel and Device Driver( Example in how to make kernel module.)

Linux kernel and Device Driver( Example in how to make kernel module.)

Statistics

Views

Total Views
999
Views on SlideShare
999
Embed Views
0

Actions

Likes
0
Downloads
45
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Linux device driver Presentation Transcript

  • 1. Linux Device Driver
  • 2. Agenda History & Why Linux kernel? Device Driver.  Purpose & Design  Kernel mode & User mode  Development  Application & API
  • 3. History and Why Linux kernel? First developed by Linus Torvals. Linux base on UNIX standard. Workgroup for implement driver & patch with kernel.org. ”Just for fun” - Linux Torvals History.
  • 4. Pupose & Design Connection between Hardware and Software.  Design communicate on logical layer ( Port : ttyS,lp,hd) and physical layer(Handle stardard of communication protocol).  Linux kernel (.ko file type) & Microsoft (.sys file type ) kernel( Monolithic,Micro,Hybird )
  • 5. Linux boot sequence on x86 x86 Real Mode BIOS Bootloader ( GRUB/LILO ) Real Mode Kernel X86 Protected Arch/x86/boot/pm.c Mode Protected Mode kernel The init Process User Processes and Daemons Booting up,Essential Linux Device Drivers-Venkateswaran.
  • 6. User & Kernel mode. Kernel Mode  It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level”.  Most, ”trusted functions of the operating system”. User Mode  In User mode, the executing code has no ability to directly access hardware or reference memory.  Code running in user mode must delegate to system APIs to access hardware or memory. Understanding user & kernel mode,Coding Horror-Jeff Atwood
  • 7. Development Linux System Call. Device Drivers Development Supporting device drivers. Kernel Programming Environment.
  • 8. Linux System Call Executing in kernel mode.  Kernel mode recognize and particular action is require from the device.  Call to device routine which pass user process to device routine.  Device routine may be shared simulataneously by user application
  • 9. Device Drivers Development Supporting device drivers. A set of routines that communicate with a hardware device and provide a uniform interface to the operating system kernel. A self-contained component that can be added to, or removed from, the operating system dynamically. Management of data flow and c ontrol between user programs and a peripheral device. A user-defined section of the kernel that allows a program or a peripheral device to appear as a `` /dev device to the rest of the systems software. Write a Linux Hardware Device Driver.FreeSoftware Mag.
  • 10. Device Driver Programming % make#include <linux/init.h>#include <linux/module.h> make[1]: Entering directory `/usr/src/linux-2.6.10MODULE_LICENSE("Dual BSD/GPL"); CC [M] /home/ldd3/src/misc-modules/hello.o Building modules, stage 2.static int hello_init(void) MODPOST{ CCprintk(KERN_ALERT "Hello, worldn"); /home/ldd3/src/misc-modules/hello.mod.oreturn 0; LD [M] /home/ldd3/src/misc-modules/hello.ko} make[1]: Leaving directory `/usr/src/linux-2.6.10static void hello_exit(void) % su{ root# insmod ./hello.koprintk(KERN_ALERT "Goodbye, cruel worldn"); Hello, world} root# rmmod hello Goodbye cruel worldmodule_init(hello_init); root#module_exit(hello_exit); Linux kernel in a nutshell,3rd-Greg Kroah-Hartman