From patchwork Tue Jul 16 17:35:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atharva Lele X-Patchwork-Id: 1132888 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="N4BFpqSo"; 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 45p6xT4sctz9s7T for ; Wed, 17 Jul 2019 03:35:41 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B88D4869EA; Tue, 16 Jul 2019 17:35:39 +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 NhZjj5AqX2Sk; Tue, 16 Jul 2019 17:35:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id C312F86A02; Tue, 16 Jul 2019 17:35:38 +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 9E9261BF414 for ; Tue, 16 Jul 2019 17:35:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9C22C204D6 for ; Tue, 16 Jul 2019 17:35:37 +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 OaEwHTOoPJie for ; Tue, 16 Jul 2019 17:35:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by silver.osuosl.org (Postfix) with ESMTPS id C75DB1FD43 for ; Tue, 16 Jul 2019 17:35:36 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id y8so10456682plr.12 for ; Tue, 16 Jul 2019 10:35:36 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=SZ92qdRVQjsOLSTkXD1xFGmQH3vpQEdCJXEgRQcS4Hc=; b=N4BFpqSoDnzz0rb0YFqiHoIMZvnis/13/tShDdd/1SfKP8AE3co8EmxiL2YA0FAKk4 w64sSNSwv9EuMn5cq8n2JUkIx1y7ZQ7cjtEdRn1xayuQgvdbj/F8D3CsNxCDwbPUr7GR LIw+ksy+PGx/yZ0VxfAaFwYh/FLTooLmeMztRGOz0wGM3gxrqQ7VVYOPrlsEU3ChU5gV xV3GXs/ibAecVMeeJIr5i4kshrV/9UtIcMqdW1CCP5AYBKVWWdxN9CCZ0szoL7h7Sl96 m5sW1WJTLo3Dhn4Gzhh9KC48VwcOnmW+8BCSwT9N3lnyDKrtntMYwcwCIQnOfBbdiGTC xofg== 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:mime-version:content-transfer-encoding; bh=SZ92qdRVQjsOLSTkXD1xFGmQH3vpQEdCJXEgRQcS4Hc=; b=EpCjqz6mSDu+EKJzfoB8mdI3diFss2X+m8/mOEhYhA6SsMzHhWs38glXeafc/cWQyp eLZw0MmKEYyHt0gvhoGe2TqqlpAyDGY+ggSFsyX2ImUlPwx6YUAvfmQaTPVXy2kZS20p vXF9e1E0OTVbIvg8VIfimR4gCXsxli/J3UpskMZlqJ7oUzcwtRxLH5mGpNe3EQTRyvun 3PWW9ouiVxSmU34pWQ+PnlLCR0g2hqjYDRe+Nd4Fq79QPb9lmxmCd7bm23Utw51zKy4o R98popDMvHjsujV6laMFtjZ807IuoFH+rvq3pbhcnKRK3ed81BoY7Fb9cAFULiSe0w7M eCfA== X-Gm-Message-State: APjAAAVm4dKXjaBwv+LUUgqkMi3c91IVkRRfKBZfCsnFTK0K4XMpHvny qGSCn1yGe7w+mXHSYo9nD+HTCyRv7zs= X-Google-Smtp-Source: APXvYqzNF01ZwlNzD4Yxmalz/CdOUBMeAyvebEEiOCf+9Vo5uFA3xLBjng2E8ssBmthslxPHbnYtww== X-Received: by 2002:a17:902:2aea:: with SMTP id j97mr25956118plb.153.1563298536006; Tue, 16 Jul 2019 10:35:36 -0700 (PDT) Received: from localhost.localdomain ([123.201.194.59]) by smtp.gmail.com with ESMTPSA id a3sm22830647pfi.63.2019.07.16.10.35.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 10:35:35 -0700 (PDT) From: Atharva Lele To: buildroot@buildroot.org Date: Tue, 16 Jul 2019 23:05:18 +0530 Message-Id: <20190716173518.11081-2-itsatharva@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190716173518.11081-1-itsatharva@gmail.com> References: <20190716173518.11081-1-itsatharva@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible 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: Atharva Lele , yann.morin.1998@free.fr Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Pass the recommended argument in the CPIO manual to make cpio archives reproducible. Reference: https://www.gnu.org/software/cpio/manual/cpio.html#Copy_002dpass-mode Pre-patch diffoscope output: https://gitlab.com/snippets/1874745 Post-patch: https://gitlab.com/snippets/1874746 We can see that post-patch, the archive related differences are removed. The differences are arising from utils/bin/getconf. This will have to be investigated further. However, that is unrelated to cpio. Signed-off-by: Atharva Lele Reviewed-by: Yann E. MORIN --- Changes v1 -> v2: - Added comment - Build host-cpio if we are reproducible, reason is --reproducible option does not exist prior to cpio 2.12. (suggested by Yann, Arnout) - Changed pure assignment to append-assignment - CPIO_OPTS -> ROOTFS_CPIO_OPTS to prevent clash with cpio package's options if added in future --- fs/cpio/cpio.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk index 1f0cafe62f..275064d9cb 100644 --- a/fs/cpio/cpio.mk +++ b/fs/cpio/cpio.mk @@ -29,8 +29,16 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT +# --repoducible option was not introduced until cpio v2.12. Some distros +# like Ubuntu 16.04 or Debian oldstable which package v2.11. Hence build +# host-cpio. +ifeq ($(BR2_REPRODUCIBLE), y) +ROOTFS_CPIO_DEPENDENCIES += host-cpio +ROOTFS_CPIO_OPTS += --reproducible +endif + define ROOTFS_CPIO_CMD - cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@ + cd $(TARGET_DIR) && find . | cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc > $@ endef ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)