public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com>
To: isar-users@googlegroups.com, amikan@ilbers.de
Cc: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>,
	jan.kiszka@siemens.com, kazuhiro3.hayashi@toshiba.co.jp,
	dinesh.kumar@toshiba-tsip.com,
	shivanand.kunijadar@toshiba-tsip.com,
	sai.sathujoda@toshiba-tsip.com
Subject: [PATCH v2 1/1] wic/partition.py: Set hash_seed for empty ext partition
Date: Thu,  4 Jul 2024 16:40:53 +0530	[thread overview]
Message-ID: <20240704111053.1647620-2-Adithya.Balakumar@toshiba-tsip.com> (raw)
In-Reply-To: <20240704111053.1647620-1-Adithya.Balakumar@toshiba-tsip.com>

From: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>

Although setting hash_seed is handled for the rootfs plugin case, but
this is missed when deploying an empty ext partition.

Signed-off-by: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>
---
 scripts/lib/wic/partition.py | 37 ++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 795707ec..bf2c34d5 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -284,19 +284,8 @@ class Partition():
 
         extraopts = self.mkfs_extraopts or "-F -i 8192"
 
-        if os.getenv('SOURCE_DATE_EPOCH'):
-            sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
-            if pseudo:
-                pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
-            else:
-                pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
-
-            # Set hash_seed to generate deterministic directory indexes
-            namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
-            if self.fsuuid:
-                namespace = uuid.UUID(self.fsuuid)
-            hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
-            extraopts += " -E hash_seed=%s" % hash_seed
+        # use hash_seed to generate reproducible ext4 images
+        (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, pseudo)
 
         label_str = ""
         if self.label:
@@ -344,6 +333,23 @@ class Partition():
 
         self.check_for_Y2038_problem(rootfs, native_sysroot)
 
+    def get_hash_seed_ext4(self, extraopts, pseudo):
+        if os.getenv('SOURCE_DATE_EPOCH'):
+            sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
+            if pseudo:
+                pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
+            else:
+                pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
+
+            # Set hash_seed to generate deterministic directory indexes
+            namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
+            if self.fsuuid:
+                namespace = uuid.UUID(self.fsuuid)
+            hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
+            extraopts += " -E hash_seed=%s" % hash_seed
+
+        return (extraopts, pseudo)
+
     def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
                              native_sysroot, pseudo):
         """
@@ -437,13 +443,16 @@ class Partition():
 
         extraopts = self.mkfs_extraopts or "-i 8192"
 
+        # use hash_seed to generate reproducible ext4 images
+        (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, None)
+
         label_str = ""
         if self.label:
             label_str = "-L %s" % self.label
 
         mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \
             (self.fstype, extraopts, label_str, self.fsuuid, rootfs)
-        exec_native_cmd(mkfs_cmd, native_sysroot)
+        exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
 
         self.check_for_Y2038_problem(rootfs, native_sysroot)
 
-- 
2.39.2


-- 
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 on the web visit https://groups.google.com/d/msgid/isar-users/20240704111053.1647620-2-Adithya.Balakumar%40toshiba-tsip.com.

  reply	other threads:[~2024-07-04 11:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 11:10 [PATCH v2 0/1] Set hash-seed " Adithya Balakumar
2024-07-04 11:10 ` Adithya Balakumar [this message]
2024-07-04 11:49   ` [PATCH v2 1/1] wic/partition.py: Set hash_seed " 'MOESSBAUER, Felix' via isar-users
2024-07-05  7:34     ` Adithya.Balakumar
2024-07-05  7:46       ` 'MOESSBAUER, Felix' via isar-users
2024-07-15  4:30   ` Adithya.Balakumar
2024-07-04 15:43 ` [PATCH v2 0/1] Set hash-seed " 'Florian Bezdeka' via isar-users
2024-07-05  7:38   ` Adithya.Balakumar
2024-07-16  9:00 ` 'Jan Kiszka' via isar-users
2024-07-16  9:43   ` Adithya.Balakumar
2024-07-16  9:49   ` Adithya.Balakumar
2024-07-16 10:52     ` 'Jan Kiszka' via isar-users

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=20240704111053.1647620-2-Adithya.Balakumar@toshiba-tsip.com \
    --to=adithya.balakumar@toshiba-tsip.com \
    --cc=amikan@ilbers.de \
    --cc=dinesh.kumar@toshiba-tsip.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kazuhiro3.hayashi@toshiba.co.jp \
    --cc=sai.sathujoda@toshiba-tsip.com \
    --cc=shivanand.kunijadar@toshiba-tsip.com \
    /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