Linux Kernel Programming: Driver Modification Tutorial

Publié le: 28 janvier 2024
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne Linux Kernel Programming: Driver Modification Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur The EV Engineer 28 janvier 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 7,970 fois et il a aimé 265 téléspectateurs. Bon visionnage!