Posts

Showing posts with the label LDD

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 - 12 : Major and Minor Numbers in Linux Device Driver Programming

Image
In this session we will discuss following topics 1. Books to refer for Linux Device Driver Programming 2. Our mail Goal to achieve in up coming sessions 3. Steps to follow while Linux Device Driver Programming Under this particular topic we will learn about      Gathering information about a Linux Device Driver      Gathering information of SCULL Device Driver      Identifying and defining Major and Minor Number       Representation of Device numbers You can download a softcopy of LDD http://www.oreilly.com/openbook/linuxdrive3/book/ Watch video here :

Linux Device Drivers Part 11: Device Driver Types

Image
In this video session, we will discuss about 1. /dev directory Device Driver types (Character Devices, Block devices and Network Devices) Practical session included at the end. Please subscribe for more videos.

Linux Device Drivers Part 10: Module Parameters

Image
In this video session we will discuss following topics 1.What are Module parameters ? 2.Ways to change these module parameters? 3.Module_param macro 4.Array Module parameters

Linux Device Drivers - Part 8 : Kernel Symbol Tables

Image
In this session we learn about 1. A symbol in Linux 2. How it is exported ? 3. Symbol and Symbol Table relationship 4. Idea behind exporting a Symbol 1. A Symbol in Linux In Linux, symbols are nothing but variables and functions that are needed to implement modularised drivers. Note that each and every symbol has its address in the memory. To make our understanding clear, lets draw a small diagram which shows a Linux Kernel Module with symbols ( Variables and functions ) in it. So in short, symbol is nothing but a variable or function in LKM How Symbols are Exported ? Exporting Kernel Symbols is typically done with  EXPORT_SYMBOL() EXPORT_SYMBOL_GPL() EXPORT_SYMBOL(), which exports a given symbol to all loadable modules  EXPORT_SYMBOL_GPL(), which exports a given symbol to only those modules that have a GPL-compatible license. (The first variation is far more common). GPL here is General Public License is widely used for free software license.

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