public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files
@ 2023-12-06 14:27 venkata.pyla
  2023-12-07  0:53 ` Jan Kiszka
  2023-12-14  7:15 ` Uladzimir Bely
  0 siblings, 2 replies; 3+ messages in thread
From: venkata.pyla @ 2023-12-06 14:27 UTC (permalink / raw)
  To: isar-users
  Cc: venkata pyla, jan.kiszka, kazuhiro3.hayashi, dinesh.kumar,
	felix.moessbauer

From: venkata pyla <venkata.pyla@toshiba-tsip.com>

The u-boot rootfs image is not reproducible because the
`update-u-boot-script` is creating new files with build timestamps,
whereas the rootfs files timestamps are set to SOURCE_DATE_EPOCH during
do_rootfs_finalize task and so for set the timestamps for the newly
updated files.

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
 meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
index 93600dc2..b7011775 100644
--- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
+++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
@@ -106,6 +106,15 @@ class RootfsUBootPlugin(RootfsPlugin):
             rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static)
             exec_cmd(rm_cmd)
 
+        # For reproducibility set the time stamp of newly updated files
+        if os.getenv('SOURCE_DATE_EPOCH'):
+            sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
+            os.utime(u_boot_script, (sde_time, sde_time))
+            os.utime(os.path.join(real_rootfs_dir, "boot/boot.scr"),
+                     (sde_time, sde_time))
+            os.utime(os.path.join(real_rootfs_dir, "tmp"),
+                     (sde_time, sde_time))
+
         RootfsPlugin.do_prepare_partition(part, source_params, cr, cr_workdir,
                                           oe_builddir, bootimg_dir, kernel_dir,
                                           krootfs_dir, native_sysroot)
-- 
2.20.1



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

* Re: [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files
  2023-12-06 14:27 [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files venkata.pyla
@ 2023-12-07  0:53 ` Jan Kiszka
  2023-12-14  7:15 ` Uladzimir Bely
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2023-12-07  0:53 UTC (permalink / raw)
  To: venkata.pyla, isar-users
  Cc: kazuhiro3.hayashi, dinesh.kumar, felix.moessbauer

On 06.12.23 22:27, venkata.pyla@toshiba-tsip.com wrote:
> From: venkata pyla <venkata.pyla@toshiba-tsip.com>
> 
> The u-boot rootfs image is not reproducible because the
> `update-u-boot-script` is creating new files with build timestamps,
> whereas the rootfs files timestamps are set to SOURCE_DATE_EPOCH during
> do_rootfs_finalize task and so for set the timestamps for the newly
> updated files.
> 
> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
> ---
>  meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
> index 93600dc2..b7011775 100644
> --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
> +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py
> @@ -106,6 +106,15 @@ class RootfsUBootPlugin(RootfsPlugin):
>              rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static)
>              exec_cmd(rm_cmd)
>  
> +        # For reproducibility set the time stamp of newly updated files
> +        if os.getenv('SOURCE_DATE_EPOCH'):
> +            sde_time = int(os.getenv('SOURCE_DATE_EPOCH'))
> +            os.utime(u_boot_script, (sde_time, sde_time))
> +            os.utime(os.path.join(real_rootfs_dir, "boot/boot.scr"),
> +                     (sde_time, sde_time))
> +            os.utime(os.path.join(real_rootfs_dir, "tmp"),
> +                     (sde_time, sde_time))
> +
>          RootfsPlugin.do_prepare_partition(part, source_params, cr, cr_workdir,
>                                            oe_builddir, bootimg_dir, kernel_dir,
>                                            krootfs_dir, native_sysroot)

Good catch! Looks fine to me.

Thanks,
Jan

-- 
Siemens AG, Technology
Linux Expert Center


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

* Re: [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files
  2023-12-06 14:27 [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files venkata.pyla
  2023-12-07  0:53 ` Jan Kiszka
@ 2023-12-14  7:15 ` Uladzimir Bely
  1 sibling, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2023-12-14  7:15 UTC (permalink / raw)
  To: venkata.pyla, isar-users
  Cc: jan.kiszka, kazuhiro3.hayashi, dinesh.kumar, felix.moessbauer

On Wed, 2023-12-06 at 19:57 +0530, venkata.pyla@toshiba-tsip.com wrote:
> From: venkata pyla <venkata.pyla@toshiba-tsip.com>
> 
> The u-boot rootfs image is not reproducible because the
> `update-u-boot-script` is creating new files with build timestamps,
> whereas the rootfs files timestamps are set to SOURCE_DATE_EPOCH
> during
> do_rootfs_finalize task and so for set the timestamps for the newly
> updated files.
> 
> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
> ---
>  meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

Applied to next, thanks.

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

end of thread, other threads:[~2023-12-14  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 14:27 [PATCH] wic:rootfs-u-boot.py: Set timestamps for newly updated files venkata.pyla
2023-12-07  0:53 ` Jan Kiszka
2023-12-14  7:15 ` Uladzimir Bely

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