Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mail.openembedded.org (Postfix) with ESMTP id AD58772F5A for ; Tue, 25 Apr 2017 18:14:22 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2017 11:14:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,250,1488873600"; d="scan'208";a="960974567" Received: from juro-precision-t5610.jf.intel.com ([10.7.198.53]) by orsmga003.jf.intel.com with ESMTP; 25 Apr 2017 11:14:13 -0700 From: Juro Bystricky To: openembedded-core@lists.openembedded.org Date: Tue, 25 Apr 2017 11:14:07 -0700 Message-Id: <1493144048-12455-4-git-send-email-juro.bystricky@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493144048-12455-1-git-send-email-juro.bystricky@intel.com> References: <1493144048-12455-1-git-send-email-juro.bystricky@intel.com> Cc: jurobystricky@hotmail.com Subject: [PATCH 3/4] image-preling.bbclass: support binary reproducibility X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 18:14:22 -0000 Conditionally support binary reproducibility in built images. If BUILD_REPRODUCIBLE_BINARIES = 1 then: 1. Do not randomize library addresses 2. Set/export PRELINK_TIMESTAMP to a reproducible value. The value is derived from the top git commit. Signed-off-by: Juro Bystricky --- meta/classes/image-prelink.bbclass | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass index 4157df0..78ef65a 100644 --- a/meta/classes/image-prelink.bbclass +++ b/meta/classes/image-prelink.bbclass @@ -36,7 +36,14 @@ prelink_image () { dynamic_loader=$(linuxloader) # prelink! - ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader + if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then + bbnote " prelink: BUILD_REPRODUCIBLE_BINARIES..." + # SOURCE_DATE_EPOCH is 0 (no soure files), so get the timestamp from GIT repo... + export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct ` + ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader + else + ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader + fi # Remove the prelink.conf if we had to add it. if [ "$dummy_prelink_conf" = "true" ]; then -- 2.7.4