From: Atharva Lele <itsatharva@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] fs/cpio: make cpio rootfs reproducible
Date: Sun, 14 Jul 2019 21:53:35 +0530 [thread overview]
Message-ID: <20190714162335.12684-2-itsatharva@gmail.com> (raw)
In-Reply-To: <20190714162335.12684-1-itsatharva@gmail.com>
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 <itsatharva@gmail.com>
---
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)
---
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..521418f950 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
+CPIO_OPTS = --reproducible
+endif
+
define ROOTFS_CPIO_CMD
- cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
+ cd $(TARGET_DIR) && find . | cpio $(CPIO_OPTS) --quiet -o -H newc > $@
endef
ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
--
2.22.0
next prev parent reply other threads:[~2019-07-14 16:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-14 16:23 [Buildroot] [PATCH 1/2] package/cpio: add host version Atharva Lele
2019-07-14 16:23 ` Atharva Lele [this message]
2019-07-14 16:47 ` [Buildroot] [PATCH 2/2] fs/cpio: make cpio rootfs reproducible Yann E. MORIN
2019-07-14 17:21 ` Yann E. MORIN
2019-07-16 12:15 ` Atharva Lele
2019-07-14 16:39 ` [Buildroot] [PATCH 1/2] package/cpio: add host version Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190714162335.12684-2-itsatharva@gmail.com \
--to=itsatharva@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox