Tuesday, December 18, 2007

Device Driver Programming

Device Driver Programming Some useful Links

LINK 1

LINK 2

Kernel Re compilation techs

$apt-get install kernel-package
$apt-get install linux-source-2.6.18 (will save the source on /usr/src)

untar this source
$tar -xjvf linux-source-2.6.18.tar.bz2

copy the config file to new one
$cp /boot/config-2.6.18-4-686 /usr/src/linux-source-2.6.18/.config

create a link to the folder
$ln -s linux-source-2.6.18 linux

change to linux dir
$cd /usr/src/linux

confirm the copied config file
$make menuconfig

Make the kernel
$make

THAT'S IT.............

Compile the program using a makefile
change the directory to /usr/src/linux

$gcc -c

inserting the module
$insmod ./

To display the messages generated by module
$dmesg

removing the module
$rmmod ./