Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

VictorRodriguez/linux_device_drivers_tutorial

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Device Drivers Tutorial

Hi, this is a compendium of multiple didactic Linux Kernel modules, I am doing this due to the fact that many times somebody says that the LDD book is too complicated, well here is a series of examples that might be helpful.

In my opinion a really good start for really newbies Linux Modules Developers WAS (past time on purpose) The Linux Kernel Module Programming Guide (http://www.tldp.org/LDP/lkmpg/2.6/html/). However, this guide is based on the Kernel 2.6.. which has many deprecated parts in relationship with the 3.~ kernel

Well this project tries to update the source code of that guide to the latest a version of the kernel (please update and improve as possible), hopefully, if many folks agree the guide will be updated, just as its authors wanted.

SET UP:

  • Fedora

Download all the kernel dev packages (in case of Fedora):

https://fedoraproject.org/wiki/Building_a_custom_kernel

You might have some problems with the livna.repo, please temporary remove it

  • CentOS

In case of CentOS:

yum -y groupinstall "Development Tools"
yum -y install ncurses-devel \
	hmaccalc \
	zlib-devel \
	binutils-devel \
	elfutils-libelf-devel \
	bc \
	openssl-devel \
	kernel-devel \
	kernel-headers

BUILD KERNEL

If you want to build the kernel we have a Dockerfile image, just run:

make iamge
docker run build_kernel:latest

Is important to customize a shared volume to copy the kernel uimage, the build_kernel docker image just build the upstream kernel (adjust the git clone to your needs)

BUILD MODULES:

1) make MODULE="<name_of_module>" // DO NOT add the .c, just the name of
the module. If no name is passed the makefile will build the basic hello
world module

2)  make clean: will clean the module

INSTALL MODULES:

insmod module.ko
modprobe module.ko

REMOVE:

rmmod module

Check printk message:

dmesg
or
cat /var/log/syslog

About

Linux Device Drivers Tutorial

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.