Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e4b65cd
Update README.md
darshankharbikar Jun 18, 2026
382c92c
Update ReadMe.md
darshankharbikar Jun 18, 2026
7a1b6e1
Update ReadMe.md
darshankharbikar Jun 18, 2026
284dd77
Create README.md
darshankharbikar Jun 19, 2026
4c8a0c8
Update README.md
darshankharbikar Jun 19, 2026
d2bc027
Update ReadMe.md
darshankharbikar Jun 19, 2026
8424a5f
Update ReadMe.md
darshankharbikar Jun 19, 2026
dc2b2be
Rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
24c4ec6
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
bbb5285
Create README.md
darshankharbikar Jun 19, 2026
fcce26b
Update ReadMe.md
darshankharbikar Jun 19, 2026
ea583ca
Update ReadMe.md
darshankharbikar Jun 19, 2026
81d4b0a
Rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
19ee56e
Update ReadMe.md
darshankharbikar Jun 19, 2026
3901d6e
Update ReadMe.md
darshankharbikar Jun 19, 2026
a610eec
Update ReadMe.md
darshankharbikar Jun 19, 2026
f080004
Update ReadMe.md
darshankharbikar Jun 19, 2026
8f61083
Update ReadMe.md
darshankharbikar Jun 19, 2026
3081ef8
Update ReadMe.md
darshankharbikar Jun 19, 2026
3e415cb
Update ReadMe.md
darshankharbikar Jun 19, 2026
b9d8e33
Update ReadMe.md
darshankharbikar Jun 19, 2026
915741a
Rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
03ee1b8
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
a1092c9
Update README.md
darshankharbikar Jun 19, 2026
a3d3ad4
Create README.md
darshankharbikar Jun 19, 2026
1506762
Update README.md
darshankharbikar Jun 19, 2026
9c1341b
Create README.md
darshankharbikar Jun 19, 2026
f747123
Update ReadMe.md
darshankharbikar Jun 19, 2026
f6e8e19
Update README.md
darshankharbikar Jun 19, 2026
10cbcbc
Update ReadMe.md
darshankharbikar Jun 19, 2026
d106fc7
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
f7a3511
Update README.md
darshankharbikar Jun 19, 2026
8e2d5ab
Update ReadMe.md
darshankharbikar Jun 19, 2026
a9df17b
Rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
478f874
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
0671a7b
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
bd50edb
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
532aac7
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
d5e22de
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
2b3a67c
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
6329738
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
7a7043b
Update README.md
darshankharbikar Jun 19, 2026
d8a4978
Update ReadMe.md
darshankharbikar Jun 19, 2026
bdc213d
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
cc156d7
Update and rename ReadMe.md to README.md
darshankharbikar Jun 19, 2026
b712e48
Update ReadMe.md
darshankharbikar Jun 19, 2026
114ce85
Update README.md
darshankharbikar Jun 19, 2026
0d804a2
Update README.md
darshankharbikar Jun 19, 2026
ee973d0
Update README.md
darshankharbikar Jun 19, 2026
bc145d1
Update README.md
darshankharbikar Jun 23, 2026
e2c9511
Update README.md
darshankharbikar Jun 23, 2026
1e8a0e1
Update README.md
darshankharbikar Jun 23, 2026
1603236
Update README.md
darshankharbikar Jun 23, 2026
d4a2b7e
Update ReadMe.md
darshankharbikar Jun 23, 2026
5859b8e
Update hello_world.c
darshankharbikar Jun 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions Linux/Device_Driver/1 LDD Introduction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Linux Device Driver – Part 1: Introduction
- This repository contains notes and example code for learning the basics of Linux device drivers, focusing on how drivers integrate with the Linux kernel and user space.

## What is a Device Driver?
- A device driver is a piece of software that lets the operating system communicate with hardware devices.
- In Linux, many drivers are built into the kernel or loaded as kernel modules, allowing hardware to be
controlled via standard interfaces.

## Types of Linux Device Drivers

Common categories of Linux device drivers include:

- **Character drivers** – Accessed as streams of bytes (for example `/dev/ttyS0` for serial ports)
- **Block drivers** – Handle data in blocks and are used for storage devices
- **Network drivers** – Interface network hardware with the kernel’s networking stack

This introduction usually starts with character drivers because they are simpler conceptually.

## Kernel Space vs User Space

Linux clearly separates:

- **User space** – Where normal applications run, with restricted access
- **Kernel space** – Where the kernel and drivers run, with full access to hardware and system resources

A device driver typically runs in kernel space and exposes an interface (often via `/dev` files or sysfs) that user-space programs can use.

## Loadable Kernel Modules (LKM)

Instead of compiling every driver into the kernel, Linux supports **loadable kernel modules**:

- Drivers can be compiled as modules
- Modules can be inserted (`insmod`/`modprobe`) and removed (`rmmod`) at runtime
- `dmesg` and `/var/log` can be used to inspect kernel messages from drivers

This introduction often walks through how to build a simple module, load it, and see messages using `dmesg`.

## Basic Steps to Write a Simple Driver Module

Typical steps you will follow in this series:

1. Write a minimal C file that defines `init` and `exit` functions for the module
2. Use `module_init()` and `module_exit()` macros to register these functions
3. Add a `Makefile` that uses the kernel build system to compile the module
4. Build the module against your current kernel headers
5. Load the module and verify its messages in the kernel log
6. Unload the module cleanly

## Prerequisites

Before following along:

- Basic knowledge of C programming
- A Linux environment (for example, Ubuntu) with kernel headers installed
- Ability to use the terminal and run basic compilation commands

REFER:
- https://github.com/darshankharbikar/raspberry-pi-4b
- https://embetronicx.com/tutorials/linux/device-drivers/setup-ubuntu-and-raspberry-pi-linux-device-driver-tutorial/
Loading