Introduce DKMS support for DEB packages

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2020-11-02 18:51:55 +01:00
parent edc729bed8
commit 3060aaf95f
8 changed files with 47 additions and 11 deletions

View File

@ -2,9 +2,9 @@
# Copyright(c) 2012-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
# If KERNELRELEASE is defined, we've been invoked from the
# If $(M) is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
ifneq ($(M),)
include $(M)/config.mk
@ -16,8 +16,9 @@ obj-y += cas_disk/
else
OCFDIR=$(PWD)/../ocf
KERNEL_DIR ?= "/lib/modules/$(shell uname -r)/build"
PWD=$(shell pwd)
KERNEL_VERSION ?= "$(shell uname -r)"
KERNEL_DIR ?= "/lib/modules/$(KERNEL_VERSION)/build"
MODULES_DIR=/lib/modules/$(shell uname -r)/extra
DISK_MODULE = cas_disk

View File

@ -2,7 +2,7 @@
# Copyright(c) 2012-2020 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
ifneq ($(KERNELRELEASE),)
ifneq ($(M),)
ifeq ($(CAS_EXT_EXP),1)
EXTRA_CFLAGS += -DWI_AVAILABLE

View File

@ -32,7 +32,7 @@ DEPENDENCIES_TAR=(tar)
DEPENDENCIES_ZIP=(zip)
DEPENDENCIES_RPM=(rpmbuild tar)
DEPENDENCIES_SRPM=("${DEPENDENCIES_RPM[@]}")
DEPENDENCIES_DEB=(debuild dh fakeroot tar)
DEPENDENCIES_DEB=(debuild dh fakeroot tar dkms)
DEPENDENCIES_DSC=("${DEPENDENCIES_DEB[@]}")
# List of relative submodule directories:
SUBMODULES=(

View File

@ -0,0 +1,11 @@
PACKAGE_NAME="<CAS_NAME>-modules"
PACKAGE_VERSION="#MODULE_VERSION#"
BUILT_MODULE_NAME[0]="cas_disk"
BUILT_MODULE_NAME[1]="cas_cache"
BUILT_MODULE_LOCATION[0]="modules/cas_disk/"
BUILT_MODULE_LOCATION[1]="modules/cas_cache/"
DEST_MODULE_LOCATION[0]="/extra"
DEST_MODULE_LOCATION[1]="/extra"
PRE_BUILD="./configure"
MAKE[0]="make -j -C modules/ KERNEL_VERSION=$kernelver"
AUTOINSTALL=yes

View File

@ -1 +1,9 @@
lib/modules/
./.metadata/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/.metadata/
./modules/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/modules/
./ocf/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/ocf/
./utils/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/utils/
./configure.d/* usr/src/<CAS_NAME>-modules-<CAS_VERSION>/configure.d/
./configure usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./Makefile usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./LICENSE usr/src/<CAS_NAME>-modules-<CAS_VERSION>/
./version usr/src/<CAS_NAME>-modules-<CAS_VERSION>/

View File

@ -4,6 +4,12 @@
-- <PACKAGE_MAINTAINER> <PACKAGE_DATE>
open-cas-linux (20.03.3.0303-1) trusty; urgency=medium
* Add DKMS support
-- Robert Baldyga <robert.baldyga@intel.com> Mon, 02 Nov 2020 18:47:04 +0200
open-cas-linux (20.03.2.0295-1) trusty; urgency=medium
* Initial OpenCAS DEB package release

View File

@ -2,7 +2,7 @@ Source: <CAS_NAME>
Section: utils
Priority: optional
Maintainer: <PACKAGE_MAINTAINER>
Build-Depends: debhelper (>= 11), gawk, libelf-dev, linux-headers-generic
Build-Depends: debhelper (>= 11), gawk, libelf-dev, linux-headers-generic, dkms
Standards-Version: 4.1.2
Homepage: <CAS_HOMEPAGE>
Vcs-Git: <CAS_GIT>
@ -21,7 +21,7 @@ Description: Open Cache Acceleration Software
Package: <CAS_NAME>-modules
Architecture: amd64
Depends: ${misc:Depends}
Depends: ${misc:Depends}, debhelper (>= 9), dkms
Description: Open Cache Acceleration Software kernel modules (${kver})
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.

View File

@ -4,13 +4,23 @@
#export DH_VERBOSE = 1
%:
dh $@
dh $@ --with dkms
override_dh_auto_configure :
./configure
override_dh_auto_build :
(cd utils/; ./cas_version_gen build)
make -C casadm
override_dh_auto_install :
make install_files DESTDIR="$(shell pwd)/debian/tmp"
make -C casadm install_files DESTDIR="$(shell pwd)/debian/tmp"
make -C utils install_files DESTDIR="$(shell pwd)/debian/tmp"
# clean and generate version again before installing sources for DKMS
make distclean
(cd utils/; ./cas_version_gen)
override_dh_dkms :
dh_dkms -V $(DEB_VERSION_UPSTREAM)
override_dh_installsystemd :
dh_installsystemd --no-start