Embedded Linux Device Driver
Most embedded hardware requires some type of software initialization and management. The software that directly interfaces with and controls this hardware is called a device driver. It is used to control a particular type of device which is connected to a system.
The Device drivers takes a special role in the Linux kernel. It is the interface between the hardware device and the application or the operating system.When we connect a device to a Linux system then we need to install the driver for that particular device to be operational. Some drivers will automatically load as soon as we connect that device to the system.
Most of the Linux device drivers can be loaded into the kernel on demand when they are needed and unloaded when they are no longer being used. There is no need to restart the system after driver is loaded or unloaded.
There are various types of drivers present in Linux such as Character, Block, Network and USB drivers. Furthermore, these bus device drivers can be of various types depending on the buses like USB drivers, PCI drivers, SBus drivers, HDMI drivers, I2C drivers, Uart drivers and a lot more.
The Spoken Tutorial Effort for Embedded Linux Device Driver has been contributed by Mayuri Panchakshari and Usha Viswanathan from FOSSEE team and Nirmala Venkat from Spoken tutorial team. The domain review of this series is done by Prof.Kumar Appaiah from IIT Bombay.
Learners: BE/BTech students from Computer science, Information Technology, Electronics, Electronics and communication department and professionals from embedded system and Linux OS system programming.
Contents
Basic Level
- Installation of Linux kernel packages
- Installation of gcc compiler
- How to check gcc compiler installation?
- How to check the kernel version of the system?
- Install the kernel header files
- uname -r command
- Various details of the kernel headers
- Check the kernal version
- lsmod command
- Commands that shows the kernel’s modules
- About character device, block devices, network devices
- Simple Loadable Module
- What is a kernal module?
- Sample program for a module
- About the header files used in the module
- About GNU Public License
- About the functions, macros used in the module
- How to compile the code?
- Create a Makefile
- Clean the generated object file
- Various information about a module
- Compilation of the module
- Loading and Unloading a Module
- Loading a module using insmod tool
- Check the loaded module in the kernel
- Pipe command
- dmesg command
- How to unload a module from the kernel
- Check the unloaded module in the kernel
- depmod command
- modprobe command
- About ELF file
- objdump command
- Exporting Symbols from a Module
- What is Symbol?
- Program to Export the symbols from a module
- Program to Import the symbols in a module
- About EXPORT_SYMBOL and EXPORT_SYMBOL_GPL macros
- About Makefile to compile the export and import modules
- depmod command to recognize the newly added module
- Load the modules into the kernel
- Checking the successful loading
- Unload the modules from the kernel
- Checking the successful unloading
- Passing Parameters to a Module
- About moduleparam.h file
- module_param() macro and its parameters
- module file permissions in S_I format
- module_param_array macro
- Working of the above macros
- About Makefile
- Compile the module
- Load the module to see the output
- Display the parameter passed to a module
- Unload the module from the kernel