Linux Kernel Programming: Driver Modification Tutorial

Поділитися
Вставка
  • Опубліковано 27 січ 2024
  • 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
  • Наука та технологія

КОМЕНТАРІ • 3

  • @TheWohnJick
    @TheWohnJick Місяць тому

    Awesome tutorial 🫶

  • @luigiprovencher8888
    @luigiprovencher8888 Місяць тому

    If that's the case then how do I convert it for that architecture or do I have to recompile it or something?