public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD
@ 2024-11-29 12:50 Adithya Balakumar
  2024-11-29 12:50 ` [PATCH v1 1/1] imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD Adithya Balakumar
  2024-12-06  7:29 ` [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Uladzimir Bely
  0 siblings, 2 replies; 3+ messages in thread
From: Adithya Balakumar @ 2024-11-29 12:50 UTC (permalink / raw)
  To: isar-users
  Cc: jan.kiszka, kazuhiro3.hayashi, dinesh.kumar, shivanand.kunijadar,
	sai.sathujoda, adithya.balakumar

e2fsprogs v1.47.1 supports generating reproducible ext4 images out of the box
but this version of e2fsprogs is available for debian trixie onwards.
e2fsprogs added support for timestamp clamping to SOURCE_DATE_EPOCH in v1.47.1

Additionally, a deterministic uuid and a hash seed must be set to generate a
reproducible image.

Adithya Balakumar (1):
  imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD

 meta/classes/imagetypes.bbclass | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

-- 
2.39.5


-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241129125040.1231947-1-Adithya.Balakumar%40toshiba-tsip.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 1/1] imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD
  2024-11-29 12:50 [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Adithya Balakumar
@ 2024-11-29 12:50 ` Adithya Balakumar
  2024-12-06  7:29 ` [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Uladzimir Bely
  1 sibling, 0 replies; 3+ messages in thread
From: Adithya Balakumar @ 2024-11-29 12:50 UTC (permalink / raw)
  To: isar-users
  Cc: jan.kiszka, kazuhiro3.hayashi, dinesh.kumar, shivanand.kunijadar,
	sai.sathujoda, adithya.balakumar

e2fsprogs v1.47.1 added support for timestamp clamping to SOURCE_DATE_EPOCH
to generate reproducible ext4 images.

Along with the above, a deterministic uuid and hash_seed also needs to be set.

Signed-off-by: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com>
---
 meta/classes/imagetypes.bbclass | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass
index a3be0a1d..f802c11c 100644
--- a/meta/classes/imagetypes.bbclass
+++ b/meta/classes/imagetypes.bbclass
@@ -14,9 +14,30 @@ IMAGE_CMD:tar() {
 
 # image type: ext4
 IMAGER_INSTALL:ext4 += "e2fsprogs"
-MKE2FS_ARGS ?=  "-t ext4"
 
+# NOTE: Creating reproducible ext4 images requires timestamp clamping to SOURCE_DATE_EPOCH and deterministic uuid, hash_seed to be set.
+# Timestamp clamping to SOURCE_DATE_EPOCH is only available from e2fsprogs v1.47.1 onwards. Older versions cannot generate reproducible ext4 images.
+python set_mke2fs_args () {
+    import uuid
+
+    mke2fs_args = "-t ext4"
+    sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
+
+    # set uuid
+    fsuuid = uuid.UUID(int=sde_time)
+    mke2fs_args += " -U " + str(fsuuid)
+
+    # set hash_seed
+    hash_seed = str(uuid.uuid5(fsuuid, str(sde_time)))
+    mke2fs_args += " -E hash_seed=" + hash_seed
+
+    d.setVar("MKE2FS_ARGS", mke2fs_args)
+}
+
+do_image_ext4[prefuncs] = "set_mke2fs_args"
 IMAGE_CMD:ext4() {
+    export E2FSPROGS_FAKE_TIME="${SOURCE_DATE_EPOCH}"
+
     truncate -s ${ROOTFS_SIZE}K '${IMAGE_FILE_HOST}'
 
     ${SUDO_CHROOT} /sbin/mke2fs ${MKE2FS_ARGS} \
-- 
2.39.5


-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241129125040.1231947-2-Adithya.Balakumar%40toshiba-tsip.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD
  2024-11-29 12:50 [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Adithya Balakumar
  2024-11-29 12:50 ` [PATCH v1 1/1] imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD Adithya Balakumar
@ 2024-12-06  7:29 ` Uladzimir Bely
  1 sibling, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2024-12-06  7:29 UTC (permalink / raw)
  To: Adithya Balakumar, isar-users

On Fri, 2024-11-29 at 18:20 +0530, Adithya Balakumar wrote:
> e2fsprogs v1.47.1 supports generating reproducible ext4 images out of
> the box
> but this version of e2fsprogs is available for debian trixie onwards.
> e2fsprogs added support for timestamp clamping to SOURCE_DATE_EPOCH
> in v1.47.1
> 
> Additionally, a deterministic uuid and a hash seed must be set to
> generate a
> reproducible image.
> 
> Adithya Balakumar (1):
>   imagetypes.bbclass: Generate reproducible ext4 images using
> IMAGE_CMD
> 
>  meta/classes/imagetypes.bbclass | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> -- 
> 2.39.5
> 
> 

Applied to next, thanks.

-- 
Best regards,
Uladzimir.



-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/0fdbfd37e900c039613190a0f299185342274722.camel%40ilbers.de.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-06  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-29 12:50 [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Adithya Balakumar
2024-11-29 12:50 ` [PATCH v1 1/1] imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD Adithya Balakumar
2024-12-06  7:29 ` [PATCH v1 0/1] Generate reproducible ext4 images with IMAGE_CMD Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox