Posts

Showing posts with the label Device Drivers

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 - 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 - 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