From patchwork Sat Aug 1 10:32:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 502809 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 67EEB1402D1 for ; Sat, 1 Aug 2015 23:08:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=GZebzLNJ; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9952E4BB7C; Sat, 1 Aug 2015 15:08:28 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bF8rGj20yT53; Sat, 1 Aug 2015 15:08:28 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4EB504BBA9; Sat, 1 Aug 2015 15:08:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E7D814B6C3 for ; Sat, 1 Aug 2015 12:33:13 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OhqJ6N2oY4S9 for ; Sat, 1 Aug 2015 12:33:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by theia.denx.de (Postfix) with ESMTPS id 704C34B699 for ; Sat, 1 Aug 2015 12:33:10 +0200 (CEST) Received: by pachj5 with SMTP id hj5so55009868pac.3 for ; Sat, 01 Aug 2015 03:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rOAGyhcAk2a+V/R/VK+TmOPKOM9jFrFp06pV1dOKnuM=; b=GZebzLNJ2IX9s+iZlYOMQHNC183+EbBb/zCg5WU626rTHprAQEYgaMgJaZXyTxyh2X 5Wr3Lmu7HaevPXE2jb5UNOnwZAN0ft6P5kR9zvkD97FW6GpFYc8zG9wa34qar60r76Hp y3/tt+0hjSbUEZC7UpbmquIqn255IIxUm3U2HXoec4U5Edm8ETH+p1AMpSfKnU7fwKSd fksshK9q3hFb+1dPbjVeYO3vWxdSTOriQKkALzDqzRi3mX+XXI03wZtU6gj1cZTTfgxr fn6N4h1FRLmJEADZm+F21DGBh1AWWVLHR9Mpvl/R1lDjZr/tgGfYQdz2uw6T8kcBaYxX YB3w== X-Received: by 10.68.195.231 with SMTP id ih7mr4821981pbc.26.1438425188162; Sat, 01 Aug 2015 03:33:08 -0700 (PDT) Received: from chrisp-dl.ws.atlnz.lc (2-163-36-202-static.alliedtelesis.co.nz. [202.36.163.2]) by smtp.gmail.com with ESMTPSA id hl6sm11259304pdb.28.2015.08.01.03.33.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Aug 2015 03:33:07 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Sat, 1 Aug 2015 22:32:49 +1200 Message-Id: <1438425169-13978-1-git-send-email-judge.packham@gmail.com> X-Mailer: git-send-email 2.5.0.rc0 In-Reply-To: <55BB4BA6.8090400@pwned.gg> References: <55BB4BA6.8090400@pwned.gg> X-Mailman-Approved-At: Sat, 01 Aug 2015 15:08:19 +0200 Cc: Thierry Reding , Tom Rini , Joe Hershberger , reproducible-builds@lists.alioth.debian.org, Stefan Roese , Chris Packham , York Sun , infinity0@pwned.gg Subject: [U-Boot] [RFC PATCH] Makefile: Add SOURCE_DATE_TZ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Along with SOURCE_DATE_EPOCH SOURCE_DATE_TZ can be used to recreate a build with a specific date timestamp. This allows the verification of source supplied with a pre-compiled binary. If SOURCE_DATE_EPOCH is supplied SOURCE_DATE_TZ can be used to specify what will appear in the output of the version command. If SOURCE_DATE_TZ is not specified UTC will be used. SOURCE_DATE_TZ on it's own will not have an affect. Signed-off-by: Chris Packham --- This is a quick proof of concept that allows some control of how the timezone is displayed. Makefile | 7 ++++--- README | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f75c730..5102a9c 100644 --- a/Makefile +++ b/Makefile @@ -1232,9 +1232,10 @@ endef define filechk_timestamp.h (if test -n "$${SOURCE_DATE_EPOCH}"; then \ SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \ - LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \ - LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ - LC_ALL=C date -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ + SOURCE_TZ="$${SOURCE_DATE_TZ:-UTC}"; \ + TZ="$${SOURCE_TZ}" LC_ALL=C date -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \ + TZ="$${SOURCE_TZ}" LC_ALL=C date -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ + TZ="$${SOURCE_TZ}" LC_ALL=C date -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ else \ LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ diff --git a/README b/README index 1bcb63c..d2e3e94 100644 --- a/README +++ b/README @@ -5087,11 +5087,14 @@ Reproducible builds In order to achieve reproducible builds, timestamps used in the U-Boot build process have to be set to a fixed value. -This is done using the SOURCE_DATE_EPOCH environment variable. -SOURCE_DATE_EPOCH is to be set on the build host's shell, not as a configuration -option for U-Boot or an environment variable in U-Boot. +This is done using the SOURCE_DATE_EPOCH and SOURCE_DATE_TZ environment +variables. These are to be set on the build host's shell, not as a +configuration option for U-Boot or an environment variable in U-Boot. SOURCE_DATE_EPOCH should be set to a number of seconds since the epoch, in UTC. +SOURCE_DATE_TZ will default to UTC but can be set to another timezone and is +used to determine how the date is displayed (tzselect(1) can be used to +determine an appropriate value). Building the Software: ======================