* [PATCH] linux-module: Improve KDIR retrieval
@ 2018-12-17 14:57 Jan Kiszka
2018-12-19 11:44 ` Maxim Yu. Osipov
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2018-12-17 14:57 UTC (permalink / raw)
To: isar-users
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] linux-module: Improve KDIR retrieval
2018-12-17 14:57 [PATCH] linux-module: Improve KDIR retrieval Jan Kiszka
@ 2018-12-19 11:44 ` Maxim Yu. Osipov
0 siblings, 0 replies; 2+ messages in thread
From: Maxim Yu. Osipov @ 2018-12-19 11:44 UTC (permalink / raw)
To: Jan Kiszka, isar-users
On 12/17/18 5:57 PM, Jan Kiszka wrote:
> There might be multiple kernels installed in the buildchroot. Ensure
> that we pick the one that is currently selected for the target.
Applied to the 'next',
Thanks,
Maxim.
>
> 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
> +}
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-19 11:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17 14:57 [PATCH] linux-module: Improve KDIR retrieval Jan Kiszka
2018-12-19 11:44 ` Maxim Yu. Osipov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox