GithubHelp home page GithubHelp logo

nbulischeck / skeleton-tree Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 13 KB

Skeleton Repository for Out-of-Tree Kernel Module Development

License: GNU General Public License v3.0

Makefile 56.73% C++ 7.53% Shell 7.38% C 28.36%

skeleton-tree's Introduction

Skeleton Tree

Skeleton repository to quickly create kernel modules that integrate with the Out-of-Tree development tool.

Project Structure

  • /src - C source code (*.c) files
  • /include - C header (*.h) files
  • /out-of-tree - Out-of-Tree configuration and testing files
  • Makefile - Standard kernel module makefile
  • .travis.yml - Default Travis CI config file

Necessary Changes for a New Project

Makefile

  • Change the TARGET from blank_module to the name of your project.

out-of-tree/.out-of-tree.toml

  • Change the name from blank_module to the name of your project.

Makefile Additions

Changing the Project Name

To change the project name (the name of the finished kernel module), edit the TARGET line.

For example, if we were to change the project name from blank_module to hello_world, we would change the following from

TARGET := blank_module

to

TARGET := hello_world

Add C source files

To add C source files to your makefile, all you need to do is add an additional line specifying a new resultant object file.

For example, if we were to add a new file called new_file.c, we would change the following from

obj-m := $(TARGET).o
$(TARGET)-y += $(SRCDIR)/core.o

to

obj-m := $(TARGET).o
$(TARGET)-y += $(SRCDIR)/core.o
$(TARGET)-y += $(SRCDIR)/new_file.o

Add Compilation Flags (CCFLAGS)

To add compilation flags to the build process of your kernel module, append the desired flags to the ccflags-y += line.

For example, to append the pedantic flag to our build process, we can change the default line from

ccflags-y += -Wall

to

ccflags-y += -Wall -Wpedantic

Project Recommendations

  1. Add all of your C source code into the /src directory making additional subdirectories where necessary.
  2. Do not edit the Travis CI configuration file unless you are very confident you can fix it if it breaks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.