Received: by 10.213.65.68 with SMTP id h4csp881710imn; Tue, 20 Mar 2018 18:49:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELvaGEkokcGnbKx75Pkx2JhKiYIT7hZ4Jr2QotQWK0iV9DaHMtTDD0S6Afg0gqpJhd2EmFwx X-Received: by 2002:a17:902:7c98:: with SMTP id y24-v6mr18867739pll.60.1521596947655; Tue, 20 Mar 2018 18:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521596947; cv=none; d=google.com; s=arc-20160816; b=vauRNeJ+XJSKnwWM+eEIeyn0KAxxpH4TLk3bpLvhRaYPo9tC+5Flz6Wadp09veXXMF IBzkw4JYL3FAlxoyZp5vwlJtoRv7obgklqld66+0Cwtr5nG5XtuI9B/+7KhQSxhSIkBy h0RkVxE2hOJD8BmtvgsICbiDt6kLZeVmHUGXBC3D0ekc0gwZyQcMtAc45zCrduDvwShB p/4XAmZ+84964jB+Lw34jzyVL2hNoEfeABz2P6gBimR6XOza/WSqOJjsYzw/tLl29taI vK2oIMxQyHS9Fv0N8MPoN4D+0F1mTlUu6GORXCS6FMqsm+592UB++TKsNqs1e9nKGwmX IK2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=6vr6Y+rOIYBLq9ex/gh7kBkFvH0LmAgLvkwzDAJWl/o=; b=serL6gfAB6olPd+N05U5DCmOdCDgQeMHmiTK/+CchhWghSExONEtBtENxQLmdNjARH SObp9A9CSvv5bABeuomgT0Tuz133ax5qzwjKeyaans8OZ24g5YoWaP4hzNmF/8QHnSW/ tQZJzD5XHGgq9yM0Qenrr9G6SXrOReQ+4svG1CZeYkxZsvM250vqjcxxMA2z2uUf8iI0 R8QKF/Dbm8iO2ABRL9kM4JZ/zrSnSjAv9BjpxK4MvjYzpvOhWw+7NU/zhYGiOAA6p2JB p4GcySXz+c635mY+tUiWTGDyS/z8+aHD6nnYqegMcWUG5r4H5W12Tm+JC5V7TV8bWFhH +cTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1-v6si2661611plk.597.2018.03.20.18.48.53; Tue, 20 Mar 2018 18:49:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751755AbeCUBqw (ORCPT + 99 others); Tue, 20 Mar 2018 21:46:52 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:38872 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbeCUBqn (ORCPT ); Tue, 20 Mar 2018 21:46:43 -0400 Received: by mail-pl0-f65.google.com with SMTP id m22-v6so2198202pls.5 for ; Tue, 20 Mar 2018 18:46:43 -0700 (PDT) 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:in-reply-to :references; bh=6vr6Y+rOIYBLq9ex/gh7kBkFvH0LmAgLvkwzDAJWl/o=; b=UCAcCpzp8eKzBMlwDg7AbGq0m1v32cBnqivmukZtoRIYLQwvHG8QwTy35efHW56Msx dCGvKRtJLyTH6jRcRdRWb6tUmO/Bv4wXMqZC2A29gPXvhq9+s2lnLRotbQLY6qLTxHHf nVfSWo8tBYDD9LKQLRSTNAmvTvbXznoq+RgUCxwRRmGIJ3ZfAl+wO/BSI+bz5swkl3ek E/8g6Tmm1tXuymw47npG5naIBm1CLzJn+SgHE2tW93gSFdRBdcAEndQItmf/jr43Uzg1 g32b18EdpX8oH64MbMrIkJ2UoUT70i6q3ubjl53TQuNzGMTlTDclwxrynXupZqWEPQL4 Q6dg== X-Gm-Message-State: AElRT7G5qMKatmXY7Ti6XO3JsHMnnZ/29mzcnokDLHnunV34nNvkN8Mi nKp34OPZf4NBDeIPNv3KmwxhJw== X-Received: by 2002:a17:902:51ad:: with SMTP id y42-v6mr15653364plh.314.1521596802573; Tue, 20 Mar 2018 18:46:42 -0700 (PDT) Received: from localhost.net ([2601:602:9802:a8dc::6a4d]) by smtp.gmail.com with ESMTPSA id x4sm6025787pfb.46.2018.03.20.18.46.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Mar 2018 18:46:41 -0700 (PDT) From: Laura Abbott To: Andy Lutomirski , mjw@fedoraproject.org, "H . J . Lu" , Masahiro Yamada Cc: Laura Abbott , Linus Torvalds , X86 ML , linux-kernel@vger.kernel.org, Nick Clifton , Cary Coutant Subject: [RFC PATCH 1/3] kbuild: Introduce build-salt generated header Date: Tue, 20 Mar 2018 18:46:33 -0700 Message-Id: <20180321014635.29113-2-labbott@redhat.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180321014635.29113-1-labbott@redhat.com> References: <20180321014635.29113-1-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The build id generated from --build-id can be generated in several different ways, with the default being the sha1 on the output of the linked file. For distributions, it can be useful to make sure this ID is unique, even if the actual file contents don't change. The easiest way to do this is to insert a comment section with some data. Introduce a header which is generated from an environment varible, BUILD_TAG. If this variable is set, an appropriate .comment section is generated. If the environment variable isn't set, the define is simply empty and there is no change to the build. Suggested-by: Nick Clifton Signed-off-by: Laura Abbott --- Makefile | 9 ++++++++- scripts/gencomment | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 scripts/gencomment diff --git a/Makefile b/Makefile index d65e2e229017..de360625aec5 100644 --- a/Makefile +++ b/Makefile @@ -1087,7 +1087,7 @@ endif prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ - include/config/auto.conf + include/config/auto.conf include/generated/build-salt.h $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts_basic @@ -1175,6 +1175,13 @@ $(version_h): $(srctree)/Makefile FORCE include/generated/utsrelease.h: include/config/kernel.release FORCE $(call filechk,utsrelease.h) +define filechk_build-salt.h + ($(CONFIG_SHELL) $(srctree)/scripts/gencomment) +endef + +include/generated/build-salt.h: $(srctree)/Makefile FORCE + $(call filechk,build-salt.h) + PHONY += headerdep headerdep: $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ diff --git a/scripts/gencomment b/scripts/gencomment new file mode 100755 index 000000000000..13b6e7739ef7 --- /dev/null +++ b/scripts/gencomment @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -z $BUILD_TAG ]; then + echo "#define ID_TAG" + exit 0 +fi + +echo "#define ID_TAG \\" +echo ".comment (INFO) : \\" +echo " { \\" + +_TAG=`echo $BUILD_TAG | sed -e 's/\(.\)/\1 /g'` +for c in $_TAG; do + _HEX=`echo -n $c | od -A n -t x1 | tr -d ' ' ` + echo "BYTE(0x$_HEX); \\" +done +echo "BYTE(0x00); \\" + +echo " } " -- 2.16.2