From patchwork Tue Sep 24 11:46:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1166528 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rrjgbkHl"; dkim-atps=neutral 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 46cztF6Tm6z9sPJ for ; Tue, 24 Sep 2019 21:46:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5FD8686406; Tue, 24 Sep 2019 11:46:26 +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 Y0VGjThQIN1Z; Tue, 24 Sep 2019 11:46:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id CBA1E84EB0; Tue, 24 Sep 2019 11:46:22 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 732AA1BF31B for ; Tue, 24 Sep 2019 11:46:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 701F884EB0 for ; Tue, 24 Sep 2019 11:46:21 +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 aZV56nkjvtDM for ; Tue, 24 Sep 2019 11:46:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by whitealder.osuosl.org (Postfix) with ESMTPS id 7E65A813F5 for ; Tue, 24 Sep 2019 11:46:20 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id f16so1380626qkl.9 for ; Tue, 24 Sep 2019 04:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6G5OODjcwzoUGTVLbL4U81PUgcb+r2h8V7hfldbj3zY=; b=rrjgbkHlow2OuJo3YDRytzqYofI53Pw9T/vW0ZU5TO0gWdqAUxxEdygS6t4RCR0v+y 5P3kzwa0xL6EmsmssLJIFHqYEpDRX6eGuyFrV5jd+8FoRAfJTgQCCDP9A8M6cTHNzgkN 7bET5tXQo/uKbkU1KPVVG3r/AY1tTYc/MekTTomly8JXsICtUSX05XqJ5oP2UerUTMSJ NHI5kw6VZ+mVc+Q8GGSCM59Ef+zRKxNP01+zzcIj595kb0IrdsEXbflvZZ1qCfJb6UlO 7OtvSk810QpYIWQIK5zQczSXuVnA7BXyyO2Jyl/36SA36pA3FBhCnaEBw5DMjiDyOQEt cGjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6G5OODjcwzoUGTVLbL4U81PUgcb+r2h8V7hfldbj3zY=; b=N3FMoUsQev5K7XVpz4QPpsWsSXILPYr3cJQbwl9451jctQNwiSv90JFnj/8+i8aQcp sCCotT186RxW1GlQeikEtlyt0k+29+qxtEoLr/Z3y6QVQROhN9tTcrV7Uh5ub5IsIXT3 QHwzhoRrfyy4fYu0GcIHmmj2C74+zAW7wqgJ2ajCFYmaQP+HobjBzKL+AqvwX+Tuk7RJ qGrU2BTL3ks3yI3NfBVkJeamQ6eF2jSb9Usw88ZEH4TMSdUtjnvqNMba5c7A8879XB/x LtHYjmdpaXiygHi0fk9IBL22uO7z6CjSW9VrOZbWcz59hWImTAbEukmKtJ1PFHYAN3sz 0tKA== X-Gm-Message-State: APjAAAV/90+IPq//ox3awIGZ7fw5RERadEZDTCNDnF8DMKd6xbZ5Yer7 61Ch5txJmIlNDMPFTcjaLaDt4JU5kxU= X-Google-Smtp-Source: APXvYqyzVuAJoiG6cG+pRYNggTcXD0fmB0r/IHPNNapQHlIYxsPR1bGzeZWB4Q662c35opEHv3HB1w== X-Received: by 2002:a37:aa02:: with SMTP id t2mr1880694qke.154.1569325579394; Tue, 24 Sep 2019 04:46:19 -0700 (PDT) Received: from casantos.remote.csb (201.86.247.132.dynamic.adsl.gvt.net.br. [201.86.247.132]) by smtp.gmail.com with ESMTPSA id p22sm731667qkk.92.2019.09.24.04.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 04:46:18 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Tue, 24 Sep 2019 08:46:11 -0300 Message-Id: <20190924114611.2863-1-unixmania@gmail.com> X-Mailer: git-send-email 2.18.1 Subject: [Buildroot] [PATCH v3] toolchain: generate check-headers program under $(BUILD_DIR) 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: Carlos Santos , Cerem Cem ASLAN , Thomas De Schampheleire , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos Some installations mount /tmp with the 'noexec' option, which prevents running the program generated there to check the kernel headers. Avoid the problem by generating the program under $(BUILD_DIR), passed as the first argument to check-kernel-headers.sh. We could globally export a TMPDIR environment variable with some path under $(BUILD_DIR) but such solution would be too intrusive, depriving the user from the freedom to set TMPDIR at his will (or needs). Fixes: https://bugs.busybox.net/show_bug.cgi?id=12241 Signed-off-by: Carlos Santos --- CC: Cerem Cem ASLAN CC: Thomas Petazzoni --- Changes v1->v2: - Move the change that introduces a trap to remove the temporary file to a separate patch. - Improve the commit message. Changes v2->v3: - Move the SOB line above the cut line. --- package/linux-headers/linux-headers.mk | 1 + support/scripts/check-kernel-headers.sh | 7 ++++--- toolchain/helpers.mk | 9 ++++----- toolchain/toolchain-external/pkg-toolchain-external.mk | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package/linux-headers/linux-headers.mk b/package/linux-headers/linux-headers.mk index 46f270a0e1..676c8c44ea 100644 --- a/package/linux-headers/linux-headers.mk +++ b/package/linux-headers/linux-headers.mk @@ -133,6 +133,7 @@ endef ifeq ($(BR2_KERNEL_HEADERS_VERSION)$(BR2_KERNEL_HEADERS_AS_KERNEL)$(BR2_KERNEL_HEADERS_CUSTOM_TARBALL)$(BR2_KERNEL_HEADERS_CUSTOM_GIT),y) define LINUX_HEADERS_CHECK_VERSION $(call check_kernel_headers_version,\ + $(BUILD_DIR),\ $(STAGING_DIR),\ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))) endef diff --git a/support/scripts/check-kernel-headers.sh b/support/scripts/check-kernel-headers.sh index a8cca78b27..a8b94f6a02 100755 --- a/support/scripts/check-kernel-headers.sh +++ b/support/scripts/check-kernel-headers.sh @@ -1,14 +1,15 @@ #!/bin/sh -SYSROOT="${1}" +BUILDDIR="${1}" +SYSROOT="${2}" # Make sure we have enough version components -HDR_VER="${2}.0.0" +HDR_VER="${3}.0.0" HDR_M="${HDR_VER%%.*}" HDR_V="${HDR_VER#*.}" HDR_m="${HDR_V%%.*}" -EXEC="$(mktemp -t check-headers.XXXXXX)" +EXEC="$(mktemp -p "${BUILDDIR}" -t .check-headers.XXXXXX)" # We do not want to account for the patch-level, since headers are # not supposed to change for different patchlevels, so we mask it out. diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 86d945a5b1..6a4f7223c8 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -158,13 +158,12 @@ copy_toolchain_sysroot = \ # Check the specified kernel headers version actually matches the # version in the toolchain. # -# $1: sysroot directory -# $2: kernel version string, in the form: X.Y +# $1: build directory +# $2: sysroot directory +# $3: kernel version string, in the form: X.Y # check_kernel_headers_version = \ - if ! support/scripts/check-kernel-headers.sh $(1) $(2); then \ - exit 1; \ - fi + support/scripts/check-kernel-headers.sh $(1) $(2) $(3) # # Check the specific gcc version actually matches the version in the diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk index c3ddff263f..c00211d59c 100644 --- a/toolchain/toolchain-external/pkg-toolchain-external.mk +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk @@ -531,6 +531,7 @@ define $(2)_CONFIGURE_CMDS $$(Q)$$(call check_unusable_toolchain,$$(TOOLCHAIN_EXTERNAL_CC)) $$(Q)SYSROOT_DIR="$$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC))" ; \ $$(call check_kernel_headers_version,\ + $$(BUILD_DIR)\ $$(call toolchain_find_sysroot,$$(TOOLCHAIN_EXTERNAL_CC)),\ $$(call qstrip,$$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \ $$(call check_gcc_version,$$(TOOLCHAIN_EXTERNAL_CC),\