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>
This commit is contained in:
Adithya Balakumar 2024-06-13 12:33:00 +05:30 committed by Richard Purdie
parent 7fb8509c5a
commit c79c8ce71c

View File

@ -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)