Posts

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 9 - More about Symbol tables

Image
In this part we will discuss about following topics About undefined symbol error and steps to solve it Is it mandatory to export the symbols ? Location of symbol table About system.map file in Linux 1. About undefined symbol error and steps to solve it The most common and most frustrating failure in loading an LKM is unresolved symbol, like this: insmod: error inserting 'helloworld.ko': -1 Unknown symbol in module To debug this error, 1. Use nm utility 2. Know symbol definitions (in next slide) Lets say my module is helloworld.ko In order to display symbol table, we use following command. $nm helloworld.ko. Output of this command is 00000000 r ____versions 0000002c r __mod_author22 00000000 r __mod_description24 00000020 r __mod_license23 00000040 r __mod_srcversion30 00000080 r __mod_vermagic5 00000063 r __module_depends 00000000 D __this_module 00000000 r _rheldata 00000000 T cleanup_module 00000000 B g_valu

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