public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>,
	isar-users <isar-users@googlegroups.com>
Subject: [PATCH v6 4/5] Provide include file for easy custom module builds
Date: Thu, 15 Feb 2018 08:35:17 +0100	[thread overview]
Message-ID: <59a2a6e6-c4f9-f8d5-cfd5-7c74834a0cd1@siemens.com> (raw)
In-Reply-To: <bdd3215a-b24c-5a45-1454-8c2b622e681c@ilbers.de>

From: Jan Kiszka <jan.kiszka@siemens.com>

This provides an include for custom kernel modules. We choose an include
over a class as we carry a couple of files to debianize the module. The
user just needs to specify the module SRC_URI, and those sources must be
then reside in a separate directory which is - as usual - defined via S.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v6:
 - fix module build on wheezy-arm and (upcoming) stretch-arm64

This allows to keep v5 of patch 5. Sorry for the mess, but I initially
thought it was an issue with old wheezy on special ARM hardware only.
But when it also popped up on stretch-arm64, I finally analyzed it.

 .../linux-module/files/debian/changelog            |  5 +++++
 .../linux-module/files/debian/compat               |  1 +
 .../linux-module/files/debian/control              | 11 ++++++++++
 .../recipes-kernel/linux-module/files/debian/rules | 15 ++++++++++++++
 meta/recipes-kernel/linux-module/module.inc        | 24 ++++++++++++++++++++++
 5 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-kernel/linux-module/files/debian/changelog
 create mode 100644 meta/recipes-kernel/linux-module/files/debian/compat
 create mode 100644 meta/recipes-kernel/linux-module/files/debian/control
 create mode 100755 meta/recipes-kernel/linux-module/files/debian/rules
 create mode 100644 meta/recipes-kernel/linux-module/module.inc

diff --git a/meta/recipes-kernel/linux-module/files/debian/changelog b/meta/recipes-kernel/linux-module/files/debian/changelog
new file mode 100644
index 0000000..c1c3516
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/changelog
@@ -0,0 +1,5 @@
+@PN@ (@PV@) unstable; urgency=low
+
+  * Generated package.
+
+ -- ISAR project <isar-users@googlegroups.com>  Tue, 6 Feb 2018 00:00:00 +0000
diff --git a/meta/recipes-kernel/linux-module/files/debian/compat b/meta/recipes-kernel/linux-module/files/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/meta/recipes-kernel/linux-module/files/debian/control b/meta/recipes-kernel/linux-module/files/debian/control
new file mode 100644
index 0000000..707f857
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/control
@@ -0,0 +1,11 @@
+Source: @PN@
+Section: kernel
+Priority: optional
+Standards-Version: 3.9.6
+Build-Depends: linux-headers-@KERNEL_NAME@
+Maintainer: ISAR project <isar-users@googlegroups.com>
+
+Package: @PN@
+Architecture: any
+Depends: linux-image-@KERNEL_NAME@
+Description: @DESCRIPTION@
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
new file mode 100755
index 0000000..46cf977
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/files/debian/rules
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom kernel module build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+export KDIR=$(shell ls -d /lib/modules/*/build)
+
+export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
+
+%:
+	CFLAGS= LDFLAGS= dh $@ --parallel
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
new file mode 100644
index 0000000..aa232f7
--- /dev/null
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -0,0 +1,24 @@
+# Custom kernel module recipe include
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+FILESPATH =. "${LAYERDIR_core}/recipes-kernel/linux-module/files:"
+
+DESCRIPTION ?= "Custom kernel module ${PN}"
+
+DEPENDS += "linux-headers-${KERNEL_NAME}"
+
+SRC_URI += "file://debian/"
+
+inherit dpkg
+
+dpkg_runbuild_prepend() {
+    cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/
+    sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \
+           -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
+           -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
+        ${WORKDIR}/${S}/debian/changelog ${WORKDIR}/${S}/debian/control
+}
-- 
2.13.6

  reply	other threads:[~2018-02-15  7:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14  9:13 [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
2018-02-14  9:13 ` [PATCH v5 1/5] Make distro kernel replaceable Jan Kiszka
2018-02-14  9:13 ` [PATCH v5 2/5] Provide include for easy custom kernel builds Jan Kiszka
2018-02-14 19:35   ` [PATCH v6 " Jan Kiszka
2018-02-14  9:13 ` [PATCH v5 3/5] Add custom kernel examples Jan Kiszka
2018-02-14  9:13 ` [PATCH v5 4/5] Provide include file for easy custom module builds Jan Kiszka
2018-02-14  9:13 ` [PATCH v5 5/5] Add exemplary kernel module Jan Kiszka
2018-02-14 15:21   ` [PATCH v6 " Jan Kiszka
2018-02-15  7:15     ` Alexander Smirnov
2018-02-15  7:35       ` Jan Kiszka [this message]
2018-02-15  7:54         ` [PATCH v6 4/5] Provide include file for easy custom module builds Alexander Smirnov
2018-02-15  7:54           ` Jan Kiszka
2018-02-15  8:01             ` Alexander Smirnov
2018-02-15 11:24 ` [PATCH v5 0/5] Provide infrastructure and examples for custom kernels and modules Alexander Smirnov
2018-02-15 15:14   ` Jan Kiszka
2018-02-15 14:43 ` Alexander Smirnov
2018-02-15 15:00   ` Jan Kiszka
2018-02-15 15:04     ` Alexander Smirnov
2018-02-15 15:13       ` Jan Kiszka
2018-02-15 15:27         ` Alexander Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59a2a6e6-c4f9-f8d5-cfd5-7c74834a0cd1@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox