diff options
| author | Paul Spooren | 2026-09-23 10:40:35 +0000 |
|---|---|---|
| committer | Paul Spooren | 2026-10-03 18:56:05 +0000 |
| commit | e77f27eda82334a9fc0f496a3f2e560cfb734c43 (patch) | |
| tree | 0b919f87643d145ca1f194323dc37a8a58976dc8 | |
| parent | ab8d38d99b7c336389d9ab336a16d49f3da4f321 (diff) | |
gemini: make the DNS-313 factory image reproducible
The boot partition of the DNS-313 factory image differs between builds:
-Linux rev 1.0 ext2 filesystem data, UUID=9f7d7721-0bf7-4483-bd56-b539d195f181
+Linux rev 1.0 ext2 filesystem data, UUID=d3ca4870-378b-48dd-9b05-760812dfeb81
-drwxr-xr-x ... 2026-09-23 07:37:23.000000 ./.boot/
+drwxr-xr-x ... 2026-09-23 09:38:09.000000 ./.boot/
genext2fs copies the mtimes of the staged files from the host and adds
them in readdir() order, which also decides their inode numbers and
blocks. It leaves the UUID empty, so e2fsck fills in a random one, and
e2fsck stamps the last check with the current time.
Pass genext2fs a name sorted tarball with mtimes clamped to
SOURCE_DATE_EPOCH and group/other write bits cleared, derive the UUID
from IMG_PART_DISKGUID and run e2fsck with E2FSCK_TIME set to
SOURCE_DATE_EPOCH.
Link: https://github.com/openwrt/openwrt/pull/25358
Signed-off-by: Paul Spooren <mail@aparcar.org>
| -rw-r--r-- | target/linux/gemini/image/Makefile | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index e6ba8a1f55..137210a84e 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -49,21 +49,29 @@ define Build/dns313-images rm $@.tmp/dummyfile + $(TAR) -C $@.tmp -cf $@.tmp.tar --sort=name --numeric-owner \ + --owner=0 --group=0 --mode=go-w \ + $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)" --clamp-mtime) \ + .boot + genext2fs --block-size $(BLOCKSIZE:%k=%Ki) \ --size-in-blocks $$((1024 * $(CONFIG_TARGET_KERNEL_PARTSIZE))) \ --squash-uids \ - --root $@.tmp $@.tmp-boot + --tarball $@.tmp.tar $@.tmp-boot # The device firmware needs revision 1 of EXT2 - $(STAGING_DIR_HOST)/bin/tune2fs -O filetype $@.tmp-boot + $(STAGING_DIR_HOST)/bin/tune2fs -O filetype \ + -U $(patsubst %00,%01,$(IMG_PART_DISKGUID)) \ + $@.tmp-boot # Ignore errors because file system was intentionally broken with tune2fs - -$(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.tmp-boot > /dev/null + -$(if $(SOURCE_DATE_EPOCH),E2FSCK_TIME=$(SOURCE_DATE_EPOCH)) \ + $(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.tmp-boot > /dev/null ./dns313_gen_hdd_img.sh $@ $@.tmp-boot $(IMAGE_ROOTFS) \ $(CONFIG_TARGET_KERNEL_PARTSIZE) \ $(CONFIG_TARGET_ROOTFS_PARTSIZE) - rm -rf $@.tmp + rm -rf $@.tmp $@.tmp.tar endef define Build/wiligear-image |