Skip to content

ShadowThree/linux_driver_wsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

说明

  1. 通过WSL ubuntu学习Linux驱动开发;
  2. 由于WSL和正式发布的Linux使用的内核不一样,所以需要微软的内核源码; 通过uname -r查看WSL内核版本,然后在WSL2-Linux-Kernel下载相应版本的内核源码(不是最新版本)到本工程,并进行解压;
  3. 源码配置:
sudo apt update
sudo apt install build-essential flex bison libssl-dev libelf-dev bc
cd ~/linux_driver/WSL2-Linux-Kernel-linux-msft-wsl-5.15.167.4
cp Microsoft/config-wsl .config
make oldconfig  # 一直回车即可
make prepare
make scripts
make modules_prepare
  1. hello驱动编译:
cd ~/linux_driver/00_hello
make

ls -l hello.ko  # check if the build is successful
sudo insmod hello.ko    # install module
lsmod | grep hello
dmesg | tail
sudo rmmod hello

modinfo hello.ko
journalctl -f

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published