SlideShare a Scribd company logo
Linux Device Driver
Agenda

   History & Why Linux kernel?
   Device Driver.
       Purpose & Design
       Kernel mode & User mode
       Development
       Application & API
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.
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
                   )
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.
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
Development

   Linux System Call.
   Device Drivers Development Supporting device
    drivers.
   Kernel Programming Environment.
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
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 system's software.

                       Write a Linux Hardware Device Driver.FreeSoftware Mag.
Device Driver Programming
                                                         % make
#include <linux/init.h>
#include <linux/module.h>                                make[1]: Entering directory `/usr/src/linux-2.6.10'

MODULE_LICENSE("Dual BSD/GPL");                          CC [M] /home/ldd3/src/misc-modules/hello.o

                                                         Building modules, stage 2.
static int hello_init(void)                              MODPOST
{                                                        CC
printk(KERN_ALERT "Hello, worldn");
                                                         /home/ldd3/src/misc-modules/hello.mod.o
return 0;
                                                         LD [M] /home/ldd3/src/misc-modules/hello.ko
}
                                                         make[1]: Leaving directory `/usr/src/linux-2.6.10'

static void hello_exit(void)                             % su

{                                                        root# insmod ./hello.ko
printk(KERN_ALERT "Goodbye, cruel worldn");             Hello, world
}                                                        root# rmmod hello

                                                         Goodbye cruel world
module_init(hello_init);
                                                         root#
module_exit(hello_exit);



                                       Linux kernel in a nutshell,3rd-Greg Kroah-Hartman

More Related Content

PPTX
U-Boot Porting on New Hardware
PDF
Introduction To Linux Kernel Modules
PDF
Uboot startup sequence
PDF
Arm device tree and linux device drivers
PPTX
U-Boot presentation 2013
PDF
Booting Android: bootloaders, fastboot and boot images
PDF
PPT
Linux Crash Dump Capture and Analysis
U-Boot Porting on New Hardware
Introduction To Linux Kernel Modules
Uboot startup sequence
Arm device tree and linux device drivers
U-Boot presentation 2013
Booting Android: bootloaders, fastboot and boot images
Linux Crash Dump Capture and Analysis

What's hot (20)

PPT
Linux Audio Drivers. ALSA
PDF
BeagleBone Black Bootloaders
PDF
Embedded Linux BSP Training (Intro)
PDF
Decompressed vmlinux: linux kernel initialization from page table configurati...
PDF
Linux Porting
PDF
Embedded Android : System Development - Part II (Linux device drivers)
PDF
Embedded Linux Kernel - Build your custom kernel
PPT
Basic Linux Internals
PPTX
Presentation compiler design
PDF
Introduction to Modern U-Boot
PDF
Device Tree for Dummies (ELC 2014)
PDF
U-Boot - An universal bootloader
PDF
Network Drivers
PPT
U boot porting guide for SoC
PDF
Kernel_Crash_Dump_Analysis
PPT
linux device driver
PDF
Linux Internals - Part II
PPTX
The TCP/IP Stack in the Linux Kernel
Linux Audio Drivers. ALSA
BeagleBone Black Bootloaders
Embedded Linux BSP Training (Intro)
Decompressed vmlinux: linux kernel initialization from page table configurati...
Linux Porting
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Linux Kernel - Build your custom kernel
Basic Linux Internals
Presentation compiler design
Introduction to Modern U-Boot
Device Tree for Dummies (ELC 2014)
U-Boot - An universal bootloader
Network Drivers
U boot porting guide for SoC
Kernel_Crash_Dump_Analysis
linux device driver
Linux Internals - Part II
The TCP/IP Stack in the Linux Kernel
Ad

Viewers also liked (9)

PPTX
Embedded systems training India - Linux system programming and kernel intern...
PPTX
Linux Device Driver Training-TutorialsDaddy
PPTX
Linux Device Driver Training
PPT
Linux Device Driver Introduction
PDF
Peek into linux_device_driver_kit
PDF
Linux Kernel and Driver Development Training
PDF
Linux Device Driver parallelism using SMP and Kernel Pre-emption
PPSX
Introduction to embedded linux device driver and firmware
PPT
LINUX Device Drivers
Embedded systems training India - Linux system programming and kernel intern...
Linux Device Driver Training-TutorialsDaddy
Linux Device Driver Training
Linux Device Driver Introduction
Peek into linux_device_driver_kit
Linux Kernel and Driver Development Training
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Introduction to embedded linux device driver and firmware
LINUX Device Drivers
Ad

Similar to Linux device driver (20)

PPTX
Linux Device Driver’s
PDF
Studienarb linux kernel-dev
PDF
brief intro to Linux device drivers
PDF
Linux kernel modules
PPT
lecture_1_introduction.ppt
PPT
lecture_1_introduction_linux_1234567.ppt
PPTX
Device Drivers and Running Modules
PDF
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
PPT
Sysfs filesystem to provide a hierarchi..
PDF
Linux advanced concepts - Part 1
PPTX
LINUX M1 P4 notes.pptxgyfdes e4e4e54v 4
PDF
Linux kernel driver tutorial vorlesung
PDF
Introduction to Linux Kernel Development
PPT
Introduction to Linux Kernel by Quontra Solutions
PDF
Linux kernel modules
PPT
Linux Kernel Development
PPT
lesson03.ppt
PPTX
Introduction Linux Device Drivers
PDF
Part 02 Linux Kernel Module Programming
PPTX
Device Drivers
Linux Device Driver’s
Studienarb linux kernel-dev
brief intro to Linux device drivers
Linux kernel modules
lecture_1_introduction.ppt
lecture_1_introduction_linux_1234567.ppt
Device Drivers and Running Modules
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Sysfs filesystem to provide a hierarchi..
Linux advanced concepts - Part 1
LINUX M1 P4 notes.pptxgyfdes e4e4e54v 4
Linux kernel driver tutorial vorlesung
Introduction to Linux Kernel Development
Introduction to Linux Kernel by Quontra Solutions
Linux kernel modules
Linux Kernel Development
lesson03.ppt
Introduction Linux Device Drivers
Part 02 Linux Kernel Module Programming
Device Drivers

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
A Presentation on Touch Screen Technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
August Patch Tuesday
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Approach and Philosophy of On baking technology
PDF
Hybrid model detection and classification of lung cancer
Encapsulation theory and applications.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
cloud_computing_Infrastucture_as_cloud_p
A Presentation on Touch Screen Technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A comparative study of natural language inference in Swahili using monolingua...
Assigned Numbers - 2025 - Bluetooth® Document
Web App vs Mobile App What Should You Build First.pdf
DP Operators-handbook-extract for the Mautical Institute
Unlocking AI with Model Context Protocol (MCP)
Enhancing emotion recognition model for a student engagement use case through...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Zenith AI: Advanced Artificial Intelligence
August Patch Tuesday
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
OMC Textile Division Presentation 2021.pptx
TLE Review Electricity (Electricity).pptx
Approach and Philosophy of On baking technology
Hybrid model detection and classification of lung cancer

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 system's 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.10' MODULE_LICENSE("Dual BSD/GPL"); CC [M] /home/ldd3/src/misc-modules/hello.o Building modules, stage 2. static int hello_init(void) MODPOST { CC printk(KERN_ALERT "Hello, worldn"); /home/ldd3/src/misc-modules/hello.mod.o return 0; LD [M] /home/ldd3/src/misc-modules/hello.ko } make[1]: Leaving directory `/usr/src/linux-2.6.10' static void hello_exit(void) % su { root# insmod ./hello.ko printk(KERN_ALERT "Goodbye, cruel worldn"); Hello, world } root# rmmod hello Goodbye cruel world module_init(hello_init); root# module_exit(hello_exit); Linux kernel in a nutshell,3rd-Greg Kroah-Hartman