@@ -92,6 +92,12 @@ oe_mkext234fs () {
extra_imagecmd=$@
fi
+ # mke2fs reads SOURCE_DATE_EPOCH itself and clamps every inode time to it,
+ # so give it the time the rootfs files carry, as oe_mksquashfs does.
+ if [ -n "$SOURCE_DATE_EPOCH" ]; then
+ export SOURCE_DATE_EPOCH=$(stat -c '%Y' ${IMAGE_ROOTFS})
+ fi
+
# For reproducible builds, make mke2fs/e2fsck deterministic: a fixed time and
# directory hash seed (the fsck "-D" pass reorders directories using it).
# This mirrors what wic does for its ext4 partitions.
mke2fs reads SOURCE_DATE_EPOCH from the environment and clamps the time of every inode it creates to it. bitbake exports the image's SOURCE_DATE_EPOCH, which is older than the REPRODUCIBLE_TIMESTAMP_ROOTFS that reproducible_final_image_task gives every file, so an ext image carries different mtimes from a tar or squashfs image of the same rootfs, and anything recorded against the rootfs mtimes, such as the fontconfig caches, is wrong in it. Give mke2fs the rootfs mtime instead, as oe_mksquashfs does for mksquashfs. It is just as fixed, so the image stays reproducible. This changes the times stamped into an ext image. Every inode's atime, ctime, mtime and crtime, and the superblock's created, last write and last checked times, move from the image's SOURCE_DATE_EPOCH to REPRODUCIBLE_TIMESTAMP_ROOTFS. An image recipe has no source of its own, so its SOURCE_DATE_EPOCH is SOURCE_DATE_EPOCH_FALLBACK; with the bitbake.conf defaults for that and REPRODUCIBLE_TIMESTAMP_ROOTFS, the times move from 1302044400 (2011-04-05) to 1520598896 (2018-03-09). Where a distro sets REPRODUCIBLE_TIMESTAMP_ROOTFS earlier than SOURCE_DATE_EPOCH the inode times were not clamped and only the superblock times change. The directory hash seed is still derived from SOURCE_DATE_EPOCH and does not change. An ext image therefore differs from one built before this change. AI-Generated: Claude Opus 5.5 (Claude Code) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> --- meta/classes-recipe/image_types.bbclass | 6 ++++++ 1 file changed, 6 insertions(+)