From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH] linux-module: Improve KDIR retrieval
Date: Mon, 17 Dec 2018 15:57:59 +0100 [thread overview]
Message-ID: <ba09a8df-2c35-72ed-3312-8751d8c36632@siemens.com> (raw)
There might be multiple kernels installed in the buildchroot. Ensure
that we pick the one that is currently selected for the target.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/recipes-kernel/linux-module/files/debian/rules | 2 --
meta/recipes-kernel/linux-module/module.inc | 14 ++++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules b/meta/recipes-kernel/linux-module/files/debian/rules
index 49788da..5c1d8be 100755
--- a/meta/recipes-kernel/linux-module/files/debian/rules
+++ b/meta/recipes-kernel/linux-module/files/debian/rules
@@ -7,8 +7,6 @@
#
# SPDX-License-Identifier: MIT
-export KDIR=$(shell ls -d /lib/modules/*/build)
-
export DEB_BUILD_OPTIONS=parallel=$(shell nproc)
export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 509dd96..5d85200 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -30,3 +30,17 @@ do_prepare_build() {
echo "echo $module >> /etc/modules" >> ${S}/debian/postinst
done
}
+
+dpkg_runbuild_prepend() {
+ # Custom kernels contain the build folder directly.
+ export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} linux-headers-${KERNEL_NAME} | \
+ grep "/lib/modules/.*/build")
+ if [ -z "$KDIR" ]; then
+ # Debian kernels install that folder indirectly via a dependency.
+ KERNEL_DEP=$(dpkg -s --root=${BUILDCHROOT_DIR} linux-headers-${KERNEL_NAME} | \
+ grep "^Depends: .*linux-headers-" | \
+ sed 's/.*\(linux-headers-[^,]*\).*/\1/')
+ export KDIR=$(dpkg -L --root=${BUILDCHROOT_DIR} ${KERNEL_DEP} | \
+ grep "/lib/modules/.*/build")
+ fi
+}
--
2.16.4
next reply other threads:[~2018-12-17 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 14:57 Jan Kiszka [this message]
2018-12-19 11:44 ` Maxim Yu. Osipov
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=ba09a8df-2c35-72ed-3312-8751d8c36632@siemens.com \
--to=jan.kiszka@siemens.com \
--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