Posts

Showing posts with the label Linux Device Drivers

Linux Device Drivers - Part 13 : More on Device Numbers

Image
In this session, we are going to discuss following topics     1. Allocating and freeing Device Numbers     2. Best way to allocate Device Numbers     3. Disadvantage of dynamic assignment of device numbers     4. Allocating device numbers to scull device driver Source code of Linux Device Driver examples of O'reilly can be downloaded from below link http://examples.oreilly.com/linuxdrive3/ Watch video here:

Linux Device Drivers Part -7 : Kernel Modules vs Applications

Image
In this part, we are going to discus about , The difference between Kernel Modules (KM) and Applications (APs) in brief . Before proceeding further, I strongly recommend to watch my earlier videos from "Linux Device Drivers Part -1 to Part 6". Though there are many differences, to keep it simple and to explain in brief , I have hand picked few differences and listed them as topics form, which can be easily remembered and recollected when required We compare below 6 topics between Kernel Modules (KM) and Applications (APs) 1. Initialisation 2. Which are Event Driven KM's or AP’s     3. About Exit Procedure in  KM's or AP’s   4. Ability to unload a module    5. Linking stage    6. Handling faults    This tutorial covers only brief description of all topics listed. This will help us to understand upcoming sessions with ease Lets start with our first topic, 1. Initialisation When we invoke a application, it starts and proceed ahead till end . Mo

Linux Device Drivers Part - 6 : Loading Listing and Unloading Kernel Modules

Image
In this part , we are going to discuss about 1. Loading Kernel modules 2. Listing  kernel modules 3. Unloading kernel modules Before going ahead with these topics, I strongly recommend you to watch my earlier videos on Linux Device Driver Part 1 to 5. Fine, lets start with our first topic 1. Loading Kernel modules  In earlier session " Linux Device Drivers Part-5 ", we learnt how to build a sample helloworld Linux Kernel module. In this session we will see how to load that sample module into the kernel. We have two kernel utilities which does the trick of loading modules into the kernel. We have two utilities to perform this task 1. insmod 2. modprobe In following slides we will discuss about these utilities, their syntax and usage So,What is insmod and what does it do ? Insmod is a kernel utility that installs loadable Kernel modules into kernel.         It actually loads the module code and data into the kernel land, it links any unresolved sym

Linux Device Drivers Part - 5 : Building and Compiling Kernel Moduels

Image
In this part, we will discuss about 5 topics Linux Device Driver Example References Setting up Environment for compiling Kernel modules.  Implementing Helloworld Kernel module and Macros used in it. Creating Makefile to compile Helloworld Kernel module Compilation and Kernel object generation of Helloworld Kernel module 1. Linux Device Driver Example references Before proceeding further, make sure you have watched my earlier videos  on "Linux Device drivers"  Part 1 to Part 4. As mentioned in my earlier videos, most of the concepts  discussed in these sessions are  derived from famous O'Rielly Linux Device Drivers  3rd edition. To demonstrate Kernel programming concepts, I will be using the O'Reilly  sample programs which are available on below site to download. http://examples.oreilly.com/linuxdrive3 Download these files and save it to your harddrive. Compiling, loading and modifying these examples are good way to improve your under

Linux Device Drivers - Part 4 : Linux Kernel Moduels (LKM) and types of LKM's

Image
In this sesssion, we will discuss about Linux Kernel Modules Base Kernel, User Space and Kernel Space Types of Linux Kernel Modules, Which module type to choose while Kernel Programming ? Location of Linux Kernel Modules in a linux PC. What exactly is a module in Linux ? Its a piece of code that can be added to the Base Kernel. We will be discussing about Base kernel in coming slides. If you are planning to add some code to kernel, then it means you are adding a module to Linux Kernel.We can't just add code to Linux without any purpose.  We add code to make a device (like printer,bluetooth dongle etc) to work.We call this piece of code as device drivers in Windows. Assuming many are familiar with Windows, we can draw one conclusion.As we have device drivers in Windows Operating system, we have modules in Linux Operating system.In short, Devices Drivers are called modules in Linux Operating system. Both terms can be used interchangeably. Before knowing about Modu

Linux Device Drivers Part - 3 : Role of Linux Kernel

Image
As a prerequisite, I strongly recommend you to watch Part-1 and Part-2 of Linux Device Drivers from MrTechpathi Tutorials . In this part we will learn about Role of Linux Kernel. Why this topic is choosen ? This topic is choosen to understand the exact role played by Kernel to provide various services. In this part, I will just brief about kernel roles,     eventually we will be discussing them in detail in upcoming parts. In a Linux system, several concurrent processes attend to different tasks. Each process asks for system resources like computing power, memory, "network connectivity", or some other resource. Who will be serving these resources ?  Yes its the Kernel. Kernel  is the big chunk of executable code in charge of handling all these requests. Although distinction between the different kernel tasks isn't always clearly marked, the kernel's role can be split into the following parts. Process management Memory management File Systems

Linux Device Drivers Part - 2 : System Memory, Static Modules and Dynamic Modules

Image
Before proceeding further, I strongly recommend you to watch Part-1 of Linux Device Drivers from MrTechpathi tutorials . In this part we will learn about following topics. System Memory Kernel Space and User Space Kernel Modules : Static Modules and Dynamic Modules So lets start with our first topic 1. System Memory This topic is choosen to completely understand user space and kernel space. Every system has certain amount of memory. This memory consists of RAM (Random Access Memory) cells, whose contents can be accessed (i.e., read and written to) at extremely high speeds but are retained only temporarily (i.e., while in use or, at most, while the power supply remains on). Coming to the purpose of memory, it holds programs and data that are currently in use and thereby serve as a high speed mediumbetween the CPU (central processing unit) and the much slower storages like hard disk drives (HDDs). This System memory in Linux can be divided into two distinct region

Linux Device Drivers Part - 1 : What is Linux Device Driver ?

Image
From today, we  will be discussing about Linux Device Drivers which are very useful for Device Driver programmers. Linux has more future and those who learn more on Linux Kernel and Device drivers will benefit a lot. Linux is one of the best open source operating system which is available to everyone. It is majorly used operating system in smart phones and Embedded Systems these days. Yes all, Android phones have Open source Linux Operating system in it which is customized according to Smartphone vendor needs. So, lets start with Linux Device Driver Programming.. Scope of this Tutorial To gain in depth knowledge on Linux Device Driver. From now on, for your convenience, we will be discussing this topic part by part. In this part we will know about What is a Linux Device Driver ? So What is a Linux Device Driver ? Linux Device drivers are distinct “black boxes” that make a particular piece of hardware respond to a well-defined internal programming interface.They c