Linux Kernel Programming: Driver Modification Tutorial

Published: 28 January 2024
on channel: The EV Engineer
7,970
265

In this video, we dive into modifying and compiling a Linux kernel driver, focusing on the pcnet32 driver. The tutorial covers key aspects such as ABI compatibility and module loading. This video is the first of many aimed at advancing practical knowledge in kernel development.

Commands:
Step 1: Install Necessary Tools
sudo apt update
sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev

Step 2: Install the Kernel Source Package
cd /usr/src/
sudo apt install linux-source-{version} # replace version
sudo tar -xjf linux-source-{version}.tar.bz2 # replace version
cd linux-source-{version} # replace version
sudo chown -R {user}:{user} /usr/src/linux-source-{version} # replace version

Step 3: Modify the pcnet driver
nvim drivers/net/ethernet/amd/pcnet32.c

Step 4: Configure the Kernel
cp /boot/config-$(uname -r) .config
make oldconfig

Step 5: Compile
make modules_prepare
cd drivers/net/ethernet/amd
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules

Step 6: Unload and Reload new module
lsmod | grep pcnet32
sudo rmmod pcnet32
lsmod | grep pcnet32
sudo insmod ./pcnet32.ko
lsmod | grep pcnet32
sudo dmesg | less


On this page of the site you can watch the video online Linux Kernel Programming: Driver Modification Tutorial with a duration of hours minute second in good quality, which was uploaded by the user The EV Engineer 28 January 2024, share the link with friends and acquaintances, this video has already been watched 7,970 times on youtube and it was liked by 265 viewers. Enjoy your viewing!