From patchwork Sat Mar 21 13:52:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1259457 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48l2C82lVSz9sR4 for ; Sun, 22 Mar 2020 00:52:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AADD487734; Sat, 21 Mar 2020 13:52:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a1UdSxZl2DbV; Sat, 21 Mar 2020 13:52:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A15B2877AB; Sat, 21 Mar 2020 13:52:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 5BA6E1BF28C for ; Sat, 21 Mar 2020 13:52:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 55ED820451 for ; Sat, 21 Mar 2020 13:52:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eUNXMofpr3QY for ; Sat, 21 Mar 2020 13:52:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by silver.osuosl.org (Postfix) with ESMTPS id 318B02041D for ; Sat, 21 Mar 2020 13:52:28 +0000 (UTC) X-Originating-IP: 86.210.146.109 Received: from localhost (lfbn-tou-1-915-109.w86-210.abo.wanadoo.fr [86.210.146.109]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id B98F8FF804; Sat, 21 Mar 2020 13:52:24 +0000 (UTC) From: Thomas Petazzoni To: Buildroot List , "Yann E. MORIN" Date: Sat, 21 Mar 2020 14:52:19 +0100 Message-Id: <20200321135220.341529-2-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200321135220.341529-1-thomas.petazzoni@bootlin.com> References: <20200321135220.341529-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH] support/scripts/check-kernel-headers.sh: do not print error for loose checks X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The C program inside check-kernel-headers.sh has two checking mode: a strict and a loose one. In strict mode, we want the kernel headers version declared by the user to match exactly the one of the toolchain. In loose mode, we want the kernel headers version of the toolchain to be greater than or equal to the one declared by the user: this is used when we have a toolchain that has newer headers than the latest version known by Buildroot. However, in loose mode, we continue to show the "Incorrect kernel headers version" message, even though we then return a zero error code. This is very confusing: you see an error displayed on the terminal, but the build goes on. We fix that by first doing the loose check first, and returning 0 if it succeeds. And then we move on with the strict check where we want the version to be identical. Signed-off-by: Thomas Petazzoni --- support/scripts/check-kernel-headers.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh index 841df98b64..4e6dce5487 100755 --- a/support/scripts/check-kernel-headers.sh +++ b/support/scripts/check-kernel-headers.sh @@ -49,18 +49,20 @@ ${HOSTCC} -imacros "${SYSROOT}/usr/include/linux/version.h" \ int main(int argc __attribute__((unused)), char** argv __attribute__((unused))) { - int ret = 0; int l = LINUX_VERSION_CODE & ~0xFF; int h = KERNEL_VERSION(${HDR_M},${HDR_m},0); + if ((l >= h) && !strcmp("${CHECK}", "loose")) + return 0; + if (l != h) { printf("Incorrect selection of kernel headers: "); printf("expected %d.%d.x, got %d.%d.x\n", ${HDR_M}, ${HDR_m}, ((LINUX_VERSION_CODE>>16) & 0xFF), ((LINUX_VERSION_CODE>>8) & 0xFF)); - ret = ((l >= h) && !strcmp("${CHECK}", "loose")) ? 0 : 1; + return 1; } - return ret; + return 0; } _EOF_