summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAdithya Balakumar <adithya.balakumar@toshiba-tsip.com>2024-06-13 12:33:00 +0530
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-06-18 08:44:41 +0100
commitc79c8ce71c751518ba21e3a2aac3b231da89b610 (patch)
treee2b95078ba555dfe7d22e0f6335294b00fc96bbe /scripts
parent7fb8509c5aaf3eac926d4f4a1037c6444ddbf202 (diff)
downloadpoky-c79c8ce71c751518ba21e3a2aac3b231da89b610.tar.gz
wic/partition.py: Set hash_seed for empty ext partition
Although setting hash_seed is handled for the rootfs plugin case, but this is missed when deploying an empty ext partition. (From OE-Core rev: 0202fb594fb05098cb8d8b6088e63beb40b5906e) Signed-off-by: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/partition.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 795707ec5d..bf2c34d594 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -284,19 +284,8 @@ class Partition():
284 284
285 extraopts = self.mkfs_extraopts or "-F -i 8192" 285 extraopts = self.mkfs_extraopts or "-F -i 8192"
286 286
287 if os.getenv('SOURCE_DATE_EPOCH'): 287 # use hash_seed to generate reproducible ext4 images
288 sde_time = int(os.getenv('SOURCE_DATE_EPOCH')) 288 (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, pseudo)
289 if pseudo:
290 pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
291 else:
292 pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
293
294 # Set hash_seed to generate deterministic directory indexes
295 namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
296 if self.fsuuid:
297 namespace = uuid.UUID(self.fsuuid)
298 hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
299 extraopts += " -E hash_seed=%s" % hash_seed
300 289
301 label_str = "" 290 label_str = ""
302 if self.label: 291 if self.label:
@@ -344,6 +333,23 @@ class Partition():
344 333
345 self.check_for_Y2038_problem(rootfs, native_sysroot) 334 self.check_for_Y2038_problem(rootfs, native_sysroot)
346 335
336 def get_hash_seed_ext4(self, extraopts, pseudo):
337 if os.getenv('SOURCE_DATE_EPOCH'):
338 sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
339 if pseudo:
340 pseudo = "export E2FSPROGS_FAKE_TIME=%s;%s " % (sde_time, pseudo)
341 else:
342 pseudo = "export E2FSPROGS_FAKE_TIME=%s; " % sde_time
343
344 # Set hash_seed to generate deterministic directory indexes
345 namespace = uuid.UUID("e7429877-e7b3-4a68-a5c9-2f2fdf33d460")
346 if self.fsuuid:
347 namespace = uuid.UUID(self.fsuuid)
348 hash_seed = str(uuid.uuid5(namespace, str(sde_time)))
349 extraopts += " -E hash_seed=%s" % hash_seed
350
351 return (extraopts, pseudo)
352
347 def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir, 353 def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,
348 native_sysroot, pseudo): 354 native_sysroot, pseudo):
349 """ 355 """
@@ -437,13 +443,16 @@ class Partition():
437 443
438 extraopts = self.mkfs_extraopts or "-i 8192" 444 extraopts = self.mkfs_extraopts or "-i 8192"
439 445
446 # use hash_seed to generate reproducible ext4 images
447 (extraopts, pseudo) = self.get_hash_seed_ext4(extraopts, None)
448
440 label_str = "" 449 label_str = ""
441 if self.label: 450 if self.label:
442 label_str = "-L %s" % self.label 451 label_str = "-L %s" % self.label
443 452
444 mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \ 453 mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \
445 (self.fstype, extraopts, label_str, self.fsuuid, rootfs) 454 (self.fstype, extraopts, label_str, self.fsuuid, rootfs)
446 exec_native_cmd(mkfs_cmd, native_sysroot) 455 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
447 456
448 self.check_for_Y2038_problem(rootfs, native_sysroot) 457 self.check_for_Y2038_problem(rootfs, native_sysroot)
449 458