aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel-defaults.mk
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-03-24 03:25:28 +0000
committerDaniel Golle <daniel@makrotopia.org>2022-03-27 16:14:00 +0100
commit077e8064b5bbb275a9f36921a009772ee448013a (patch)
treec4499d4315424b6ca70a617ff790466a7c92a54b /include/kernel-defaults.mk
parentbb596031fa461fdd07e0d3a89759bb2060bfe120 (diff)
downloadupstream-077e8064b5bbb275a9f36921a009772ee448013a.tar.gz
upstream-077e8064b5bbb275a9f36921a009772ee448013a.tar.bz2
upstream-077e8064b5bbb275a9f36921a009772ee448013a.zip
kernel: set options to make external initramfs reproducible
Run cpio as well as compressors in such ways that they are generating reproducible output. Signed-off-by: Daniel Golle <daniel@makrotopia.org> (cherry picked from commit 29d7461d1135b91905120a44dc028b786693ecc4)
Diffstat (limited to 'include/kernel-defaults.mk')
-rw-r--r--include/kernel-defaults.mk7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 5a061a5178..af1d59c481 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -174,13 +174,14 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y)
ifneq ($(qstrip $(CONFIG_EXTERNAL_CPIO)),)
$(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio
else
- ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio )
+ ( cd $(TARGET_DIR); find . | LC_ALL=C sort | $(STAGING_DIR_HOST)/bin/cpio --reproducible -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio )
endif
+ $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2)
- $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio)
+ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -n -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma)
# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
- $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
+ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T0 -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio)
# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio)
endif