Skip to content

Linux kernel compatibility helper to add version guards for an out-of-tree modules.

License

Notifications You must be signed in to change notification settings

tkc17/linux-kernel-compat-helper

Repository files navigation

linux-kernel-compat-helper

Linux kernel compatibility helper to add version guards for an out-of-tree modules or to get the tag information for a particular commit.

Build and Coverage status

Build Status codecov

Introduction

For maintaining an out-of-tree module it is important to support multiple kernel version compatibility using Linux kernel version guards, we can get the exact commit for the fix by using git blame or git bisect etc, but the main problem is to figure out the version number which the fix is present first.

The problem statement

Clone Linus's linux.git

If you have clone Linus tovarlds linux.git then we can use below command to figure out the tag in which the commit first appeared. But cloning this repo and keeping it up-to-date is inconvinient.

$ git describe --contains <commit_sha>

Solution

Github Linus's linux.git

This repo is kept up-to-date and we can use the Github API to query commits and tags without cloning the repo and maintaining it. This module uses this approach and does a simple binary search based on commit and tag date.

Usage (clone)

Prerequisites

  • Github API token with proper permissions
  • pipenv installed
  • Tested on Ubuntu Distribution, but should work in others.

Running

  • Create and Install the virtual environment

    • pipenv install
  • Run the application, below command will display the usage.

    • pipenv run lk-get-tag -h

Example commands

$ export GITHUB_API_TOKEN=<token>
$ pipenv install
$ pipenv run lk-get-tag -c <commit_sha>

Usage (pip)

This package can also be directly installed using pip and then can be run, see below steps

Prerequisites

  • Github API token with proper permissions
  • pip installed (preferably the latest version)
  • Tested on Ubuntu Distribution, but should work in others.

Running

  • Create and Install the package from pypi

    • pip install linux-kernel-compat-helper
  • Run the application, below command will display the usage.

    • lk-get-tag -h

    Note: pip installation path bin directory should be in the $PATH for this command to work.

About

Linux kernel compatibility helper to add version guards for an out-of-tree modules.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages