From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6635976505850593280 X-Received: by 2002:a1c:860f:: with SMTP id i15mr1679743wmd.24.1545058681276; Mon, 17 Dec 2018 06:58:01 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:3581:: with SMTP id c123ls2836468wma.9.gmail; Mon, 17 Dec 2018 06:58:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/VKBbyn3itwWZEPdhLRxriMqervNBpvuUToAh19McJtf984OYC2enLHpameO3PDCT7BkAhe X-Received: by 2002:a7b:ce08:: with SMTP id m8mr1775503wmc.22.1545058680803; Mon, 17 Dec 2018 06:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545058680; cv=none; d=google.com; s=arc-20160816; b=vSJfPzKemqMM002QTwFwm3RSTGbvkQpAXQPrt6f6gkD4moVHOQNQU2AdNy/72q9Zja uaprDtP/BSkR72+15J2u+2akNbWD4LO7+n/0QoD7Xd8+DVVRqz8OKMLRZvslPLJdbMS7 LG+FkSfDTlRNuLJjk0pfFFYDP19jFk9qnRS1C75kLY4QjkUCDYHINTT5are5ybLuae8A psZbFgluoBtVVmnHxX1c7zEjyNhoURHu1OInZoJ8nfur1wgZA2hmRTRkIbtVil3sn1Yh VcnbwGEqYYU0CePJ6+e6PwWqoieA8Hz7Cwi7RdUWSd0gj9WJsps5jqvTsmF28S4SqpWJ wLNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version:user-agent :date:message-id:subject:from:to; bh=nRnCFZef5Qa/Hxn6qDyZXQ33QN4cB1+vLK0c8XgiOiY=; b=byjD8ZZpEm2nl+SWPI5NgKf54Chp7l3G7QSprQPz6iv2OvQswYv/HqMHDnctUq/h7b vKnnH6H0VHrsG7MporN16PatjaWUFpyymJ9NxozHA/W98fYDZOOTbdwRHLvnfNnOPmrx 9Zzs0V40yZHAs2bxiowpLyTPVzq6TvIRxDhJT97bJf5rRmG5xs2rzq3zIXMSVEa2QimS kTBBJ5wHoQ90DEDSS2F4Q/VwOLeHubVAmYSswjTRZ+ysYdB98JJB7pc9bLejj9IYHqbQ lwrGRHNpd5IonawfEbnwxYKxgkaJqDb9m3kjI/RIVIgSYsjbqaQeUmZMCHt7XRbCIiDY 43Yg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id p15si14501wrm.5.2018.12.17.06.58.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 06:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id wBHEw0hh026833 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 17 Dec 2018 15:58:00 +0100 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id wBHEw0AW013330 for ; Mon, 17 Dec 2018 15:58:00 +0100 To: isar-users From: Jan Kiszka Subject: [PATCH] linux-module: Improve KDIR retrieval Message-ID: Date: Mon, 17 Dec 2018 15:57:59 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: uvXsCfrvzgaX 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 --- 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