Udemy
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Development
Web Development Data Science Mobile Development Programming Languages Game Development Database Design & Development Software Testing Software Engineering Development Tools No-Code Development
Business
Entrepreneurship Communications Management Sales Business Strategy Operations Project Management Business Law Business Analytics & Intelligence Human Resources Industry E-Commerce Media Real Estate Other Business
Finance & Accounting
Accounting & Bookkeeping Compliance Cryptocurrency & Blockchain Economics Finance Finance Cert & Exam Prep Financial Modeling & Analysis Investing & Trading Money Management Tools Taxes Other Finance & Accounting
IT & Software
IT Certification Network & Security Hardware Operating Systems Other IT & Software
Office Productivity
Microsoft Apple Google SAP Oracle Other Office Productivity
Personal Development
Personal Transformation Personal Productivity Leadership Career Development Parenting & Relationships Happiness Esoteric Practices Religion & Spirituality Personal Brand Building Creativity Influence Self Esteem & Confidence Stress Management Memory & Study Skills Motivation Other Personal Development
Design
Web Design Graphic Design & Illustration Design Tools User Experience Design Game Design Design Thinking 3D & Animation Fashion Design Architectural Design Interior Design Other Design
Marketing
Digital Marketing Search Engine Optimization Social Media Marketing Branding Marketing Fundamentals Marketing Analytics & Automation Public Relations Advertising Video & Mobile Marketing Content Marketing Growth Hacking Affiliate Marketing Product Marketing Other Marketing
Lifestyle
Arts & Crafts Beauty & Makeup Esoteric Practices Food & Beverage Gaming Home Improvement Pet Care & Training Travel Other Lifestyle
Photography & Video
Digital Photography Photography Portrait Photography Photography Tools Commercial Photography Video Design Other Photography & Video
Health & Fitness
Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other Health & Fitness
Music
Instruments Music Production Music Fundamentals Vocal Music Techniques Music Software Other Music
Teaching & Academics
Engineering Humanities Math Science Online Education Social Science Language Teacher Training Test Prep Other Teaching & Academics
AWS Certification Microsoft Certification AWS Certified Solutions Architect - Associate AWS Certified Cloud Practitioner CompTIA A+ Cisco CCNA Amazon AWS CompTIA Security+ Microsoft AZ-900
Graphic Design Photoshop Adobe Illustrator Drawing Digital Painting InDesign Character Design Canva Figure Drawing
Life Coach Training Neuro-Linguistic Programming Personal Development Mindfulness Personal Transformation Life Purpose Meditation CBT Emotional Intelligence
Web Development JavaScript React CSS Angular PHP Node.Js WordPress Vue JS
Google Flutter Android Development iOS Development React Native Swift Dart Programming Language Mobile Development Kotlin SwiftUI
Digital Marketing Google Ads (Adwords) Social Media Marketing Google Ads (AdWords) Certification Marketing Strategy Internet Marketing YouTube Marketing Email Marketing Retargeting
Microsoft Power BI SQL Tableau Business Analysis Data Modeling Business Intelligence MySQL Data Analysis Blockchain
Business Fundamentals Entrepreneurship Fundamentals Business Strategy Business Plan Startup Online Business Freelancing Blogging Home Business
Unity Game Development Fundamentals Unreal Engine C# 3D Game Development C++ 2D Game Development Unreal Engine Blueprints Blender
30-Day Money-Back Guarantee
IT & Software Operating Systems Linux Kernel

Character Device Drivers in deep

Linux Kernel Programming - Character Device Drivers
Rating: 4.2 out of 54.2 (7 ratings)
104 students
Created by Linux Trainer
Last updated 10/2020
English
English [Auto]
30-Day Money-Back Guarantee

What you'll learn

  • Write character device driver from scratch
  • Understand the various file operations provided by character driver

Requirements

  • Should be able to write/compile/load/unload Hello World Linux Kernel Modules

Description

Updated on Oct 10: Added Downloads section

What will you learn from this course?

  • Introduction to character drivers

  • What is device number and device file

  • Allocating device number - statically and dynamically

  • Creating device file - Manually(mknod) and automatically (udev)

  • Registering character device and its file operation with Kernel

  • Copying data from user space to kernel space and vice versa

  • Understanding the various structures - struct file and struct inode

  • Implementation of open, release, read, write, llseek, ioctl file operations

  • How to create multiple device nodes and add support for private data

  • Flow of write system call from kernel system call entry point to driver write file operations

  • Handling all the error cases in ioctl implementation

  • Sending a signal to user space from kernel space

  • Various access control mechanisms and capabilities

  • Misc Driver

API's covered in this course:

  • MAJOR

  • MINOR

  • MKDEV

  • register_chrdev_region

  • alloc_chrdev_region

  • class_create

  • device_create

  • class_destroy

  • device_destroy

  • unregister_chrdev_region

  • imajor

  • iminor

  • copy_from_user

  • copy_to_user

  • put_user

  • get_user

  • print_dev_t

  • format_dev_t

  • strnlen_user

  • container_of

  • access_ok

Commands used in this course:

  • mknod

  • udevadm monitor

Who this course is for:

  • Developers interested in learning Linux Kernel Programming

Course content

6 sections • 88 lectures • 4h 20m total length

  • Preview03:36
  • Preview02:28
  • Preview00:41
  • Preview03:32
  • How to choose a device number
    01:58
  • Data type for device number dev_t
    00:50
  • Example of MAJOR,MINOR,MKDEV macros
    03:27
  • /proc/devices file
    01:03
  • Static Allocation of Device Numbers
    01:36
  • Example of static allocation of device numbers
    02:26
  • Test cases on Previous Example
    01:58
  • Preview01:39
  • What happens if i try to register same name
    01:36
  • Registering Maximum Minor Numbers
    03:27
  • Preview03:02
  • Dynamic Allocation of Device Number
    00:48
  • Example of dynamic allocation of device number
    01:54
  • Calling alloc_chrdev_region in loop
    04:12
  • Manual Device Node Creation
    03:54
  • Automatic Device Node Creation - class_create
    04:02
  • Automatic Device Node Creation - device_create
    02:48
  • Example of automatic device node creation
    01:54
  • Quiz 1
    11 questions

  • Introduction
    01:46
  • Registering file_operations with Linux Kernel
    01:44
  • cdev_init vs cdev_alloc
    01:27
  • Linux Kernel Module example of file operations registrations - cdev_alloc
    03:14
  • Linux Kernel Module example of file operations registrations - cdev_init
    02:33
  • Preview04:25
  • Walkthrough of drivers/char/mem.c
    02:42
  • How many times open and release will be called in case of fork
    04:16
  • How many times open and release will be called in case of multiple processes
    01:27
  • struct file
    03:14
  • Example of struct file
    02:27
  • struct inode
    03:12
  • Example of struct inode
    02:33
  • Example of struct inode vs struct file
    03:28
  • What happens when i print user space buffer in write function
    05:27
  • Accessing user space buffer in Kernel space
    02:26
  • copy_from_user
    02:58
  • What happens when i pass NULL ptr in write system call
    01:19
  • copy_to_user
    01:41
  • put_user
    04:11
  • get_user
    02:14
  • Passing structure from user space to kernel space and vice versa
    02:47
  • Can i pass user variables on heap to kernel driver
    01:52
  • Passing structure with one member from stack and other in heap
    02:29
  • Kernel utility to print dev_t - print_dev_t, format_dev_t
    03:53
  • Can i use strlen in kernel space
    04:14
  • strnlen_user
    02:30
  • Solution to passing structure with one member in stack and other in heap
    03:16
  • Problem in character driver when we read character by character
    02:33
  • Adding offset support in read and write implementation
    05:44
  • Updated logic to read/write bytes less than requested/available
    03:51
  • Adding lseek support
    02:17
  • Creating multiple device nodes
    03:52
  • Preview03:32
  • Adding support for private data
    02:25
  • What happens when i call write from user space
    04:26

  • Introduction
    03:54
  • Ioctl example - BLKGETSIZE
    03:13
  • Ioctl example - BLKGETSIZE64
    01:16
  • Ioctl driver method - unlocked_ioctl
    03:26
  • Adding three ioctls in kernel driver
    03:24
  • Symbolic names to ioctls commands
    01:58
  • Defining ioctl commands
    06:07
  • C Example of ioctl macros
    01:52
  • Macros to decode information from ioctl command
    01:59
  • Updated driver code using ioctl macros
    01:59
  • What should be the return value if unsupported command is sent from user space
    01:34
  • access_ok macro
    02:25
  • Updated driver code using access_ok macro
    02:32
  • Fail scenarios of access_ok
    02:23
  • What happens when we pass a different size in ioctl command
    02:41
  • compat_ioctl
    06:05
  • Issues when 32-bit process trying to perform ioctl command
    06:21
  • Sending a signal from module to process
    03:39

  • How many times a device driver is being used by application
    02:34
  • Allow only one process to use the device file at a time
    04:59
  • Restricting access to a single user at a time
    05:59
  • Capabilities
    05:19
  • Example of using capabilities - cap_dac_override
    03:15
  • Example of using capabilities - cap_sys_module
    03:14
  • Example of using capabilities - cap_sys_admin
    02:55
  • Open Flags
    05:11
  • What happens if I don't call close and process terminates
    01:47

  • Introduction
    05:07
  • Example of Misc Driver
    02:05

  • Downloads
    00:01

Instructor

Linux Trainer
Trainer at Linux Weekend Learning
Linux Trainer
  • 4.1 Instructor Rating
  • 565 Reviews
  • 7,586 Students
  • 17 Courses

I have been working on Linux for more than 7 years. I have seen many people still lack their skills on Linux. So, i am working on courses for Linux which will make them Learn Linux in an easy way. The agenda of my courses will be more practical and less theoretical. Show more examples and you will easily grab the concepts.

Order of Learning

1. Learn Linux User Space Debugging

2. Learn Linux Kernel Programming

3. Character Device Drivers in Deep

4. Memory management in Linux Kernel

5. Synchronization in Linux Kernel Programming

6. Linux Kernel Development Model and Compilation

7. Linux Device Drivers - Communicating with Hardware

8. Interrupts and Bottom Halves in Linux Kernel

9. System calls in deep

10. Timing Subsystem in deep

11. Embedded Linux using Yocto

12. Embedded Linux using Yocto Part 2

13. Embedded Linux using Yocto Part 3

14. Embedded Linux using Yocto Part 4

15. Testing Linux Kernel

16. Debugging Linux kernel in deep - Part 1

17. Debugging Linux kernel in deep - Part 2

  • Udemy for Business
  • Teach on Udemy
  • Get the app
  • About us
  • Contact us
  • Careers
  • Blog
  • Help and Support
  • Affiliate
  • Impressum Kontakt
  • Terms
  • Privacy policy
  • Cookie settings
  • Sitemap
  • Featured courses
Udemy
© 2021 Udemy, Inc.