Message ID | 20240704111053.1647620-2-Adithya.Balakumar@toshiba-tsip.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | Set hash-seed for empty ext partition | expand |
On Thu, 2024-07-04 at 16:40 +0530, Adithya Balakumar wrote: > 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'): Hi, isn't that always true since we (and OE) nowadays always set this variable? Why do we need special handling in this case? Felix > + 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 > >
Hi Felix, Thanks for the feedback. You are right, there is no need for a check for existence of the SOURCE_DATE_EPOCH environment variable since it is always available. I see this check in quite a few places in the wic source code upstream (OE) as well. Probably this could be addressed in a separate patch to upstream and then subsequently to isar as well. What do you think? Thanks and Regards, Adithya Balakumar -----Original Message----- From: MOESSBAUER, Felix <felix.moessbauer@siemens.com> Sent: Thursday, July 4, 2024 5:19 PM To: balakumar adithya(TSIP TEUR) <Adithya.Balakumar@toshiba-tsip.com>; isar-users@googlegroups.com; amikan@ilbers.de Cc: kunijadar shivanand(TSIP TMIEC ODG Porting) <Shivanand.Kunijadar@toshiba-tsip.com>; ashrith sai(TSIP) <Sai.Sathujoda@toshiba-tsip.com>; Kiszka, Jan <jan.kiszka@siemens.com>; hayashi kazuhiro(林 和宏 DME ○DIG□MPS○MP4) <kazuhiro3.hayashi@toshiba.co.jp>; dinesh kumar(TSIP TMIEC ODG Porting) <dinesh.kumar@toshiba-tsip.com> Subject: Re: [PATCH v2 1/1] wic/partition.py: Set hash_seed for empty ext partition On Thu, 2024-07-04 at 16:40 +0530, Adithya Balakumar wrote: > 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'): Hi, isn't that always true since we (and OE) nowadays always set this variable? Why do we need special handling in this case? Felix > + 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 > > -- Siemens AG, Technology Linux Expert Center
On Fri, 2024-07-05 at 07:34 +0000, Adithya.Balakumar@toshiba-tsip.com wrote: > Hi Felix, > > Thanks for the feedback. You are right, there is no need for a check > for existence of the SOURCE_DATE_EPOCH environment variable since it > is always available. I see this check in quite a few places in the > wic source code upstream (OE) as well. > > Probably this could be addressed in a separate patch to upstream and > then subsequently to isar as well. What do you think? Ok, fine for me. Felix > > Thanks and Regards, > Adithya Balakumar > > -----Original Message----- > From: MOESSBAUER, Felix <felix.moessbauer@siemens.com> > Sent: Thursday, July 4, 2024 5:19 PM > To: balakumar adithya(TSIP TEUR) > <Adithya.Balakumar@toshiba-tsip.com>; isar-users@googlegroups.com; > amikan@ilbers.de > Cc: kunijadar shivanand(TSIP TMIEC ODG Porting) > <Shivanand.Kunijadar@toshiba-tsip.com>; ashrith sai(TSIP) > <Sai.Sathujoda@toshiba-tsip.com>; Kiszka, Jan > <jan.kiszka@siemens.com>; hayashi kazuhiro(林 和宏 DME ○DIG□MPS○MP4) > <kazuhiro3.hayashi@toshiba.co.jp>; dinesh kumar(TSIP TMIEC ODG > Porting) <dinesh.kumar@toshiba-tsip.com> > Subject: Re: [PATCH v2 1/1] wic/partition.py: Set hash_seed for empty > ext partition > > On Thu, 2024-07-04 at 16:40 +0530, Adithya Balakumar wrote: > > 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'): > > Hi, isn't that always true since we (and OE) nowadays always set this > variable? Why do we need special handling in this case? > > Felix > > > + 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 > > > > > > -- > Siemens AG, Technology > Linux Expert Center > >
Hi All, Any update on this patch? Thanks and Regards, Adithya -----Original Message----- From: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com> Sent: Thursday, July 4, 2024 4:41 PM To: isar-users@googlegroups.com; amikan@ilbers.de Cc: balakumar adithya(TSIP TEUR) <Adithya.Balakumar@toshiba-tsip.com>; jan.kiszka@siemens.com; hayashi kazuhiro(林 和宏 DME ○DIG□MPS○MP4) <kazuhiro3.hayashi@toshiba.co.jp>; dinesh kumar(TSIP TMIEC ODG Porting) <dinesh.kumar@toshiba-tsip.com>; kunijadar shivanand(TSIP TMIEC ODG Porting) <Shivanand.Kunijadar@toshiba-tsip.com>; ashrith sai(TSIP) <Sai.Sathujoda@toshiba-tsip.com> Subject: [PATCH v2 1/1] wic/partition.py: Set hash_seed for empty ext partition 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
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)