Skip to content

The Linux Kernel Module (Character Device Driver) I developed on Raspberry Pi. It includes secure data transfer (Read/Write) between User Space and Kernel Space, the file_operations structure, and the driver registration (major/minor number) mechanisms.

Notifications You must be signed in to change notification settings

omer-acarr/Linux-Character-Device-Driver-Development-for-Raspberry-Pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Linux Character Device Driver (Read/Write)

This repository is a Character Device Driver project I developed to understand and implement the working logic of Embedded Linux systems at the kernel level.

Developed on Raspberry Pi, this project demonstrates the capabilities of dynamically adding/removing modules to the Linux kernel, creating virtual files, and exchanging data between user space and kernel space.

🎯 Project Objectives and Technical Gains

As an engineer, I aimed for and implemented the following in this project:

  • Kernel Space vs User Space: Going beyond standard C code to run code in Kernel Space, the restricted and privileged area of the operating system.
  • LKM (Loadable Kernel Modules): Mechanisms for loading (insmod) and unloading (rmmod) drivers at runtime without recompiling the kernel.
  • Device Driver Architecture: Creating virtual devices under /dev, in line with Linux's “Everything is a file” philosophy.
  • Secure Data Transfer: Using the copy_from_user and copy_to_user functions, which provide secure memory access instead of raw pointer access, when receiving data from the user to the kernel.
  • File Operations (fops): Implementation of how standard open, close, read, write system calls are handled on the driver side (callback functions).

🛠 Technologies and Tools Used

  • Hardware: Raspberry Pi 4 (ARM Architecture)
  • Operating System: Raspberry Pi OS (Linux Kernel 6.x/5.x)
  • Language: C (GNU C Standard)
  • Compilation: Makefile & GCC (Cross-Compilation logic)
  • Kernel Tools: dmesg, insmod, rmmod, lsmod

🚀 Installation and Testing (How to Run)

To test this driver in your own Raspberry Pi environment, follow these steps:

1. Compile

Use Makefile to create the Kernel object (.ko):

make

About

The Linux Kernel Module (Character Device Driver) I developed on Raspberry Pi. It includes secure data transfer (Read/Write) between User Space and Kernel Space, the file_operations structure, and the driver registration (major/minor number) mechanisms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published