Skip to content

AndreiCherniaev/cmake_helloworldDriver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmake_helloworldDriver

example of cmake for driver (linux)

A simple hello world kernel module, that can be build with cmake. Utilize Kbuild through cmake, and do it in a build directory.

Usage:

  1. got clone
  2. create a folder: mkdir build
  3. navigate into build: cd build
  4. run cmake: cmake ../
  5. build it: make

Expected behavior:

cmake ../ shall do:

$ cmake ../
-- The C compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
my kerneldir path is "/lib/modules/5.15.0-56-generic/build"
-- Configuring done
-- Generating done
-- Build files have been written to: /home/a/Downloads/upd1553lin407a/test2/cmake-kernel-module/build

make shall do:

make
[100%] Generating hello.ko
[100%] Built target driver

Among others the hello.ko is now present.

See also about linux driver for beginner https://habr.com/ru/post/342668/ https://habr.com/ru/company/timeweb/blog/680850/ https://habr.com/ru/company/otus/blog/597993/

Thoughts and comments are welcome.

About

example of cmake for dummy linux driver

Topics

Resources

License

Stars

Watchers

Forks