diff options
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r-- | scripts/lib/wic/partition.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 7c288d2958..5563f4448a 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
@@ -293,17 +293,36 @@ class Partition(): | |||
293 | f.write("cd etc\n") | 293 | f.write("cd etc\n") |
294 | f.write("rm fstab\n") | 294 | f.write("rm fstab\n") |
295 | f.write("write %s fstab\n" % (self.updated_fstab_path)) | 295 | f.write("write %s fstab\n" % (self.updated_fstab_path)) |
296 | if os.getenv('SOURCE_DATE_EPOCH'): | ||
297 | fstab_time = int(os.getenv('SOURCE_DATE_EPOCH')) | ||
298 | for time in ["atime", "mtime", "ctime"]: | ||
299 | f.write("set_inode_field fstab %s %s\n" % (time, hex(fstab_time))) | ||
300 | f.write("set_inode_field fstab %s_extra 0\n" % (time)) | ||
301 | debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) | 296 | debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) |
302 | exec_native_cmd(debugfs_cmd, native_sysroot) | 297 | exec_native_cmd(debugfs_cmd, native_sysroot) |
303 | 298 | ||
304 | mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) | 299 | mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) |
305 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) | 300 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) |
306 | 301 | ||
302 | if os.getenv('SOURCE_DATE_EPOCH'): | ||
303 | sde_time = hex(int(os.getenv('SOURCE_DATE_EPOCH'))) | ||
304 | debugfs_script_path = os.path.join(cr_workdir, "debugfs_script") | ||
305 | files = [] | ||
306 | for root, dirs, others in os.walk(rootfs_dir): | ||
307 | base = root.replace(rootfs_dir, "").rstrip(os.sep) | ||
308 | files += [ "/" if base == "" else base ] | ||
309 | files += [ base + "/" + n for n in dirs + others ] | ||
310 | with open(debugfs_script_path, "w") as f: | ||
311 | f.write("set_current_time %s\n" % (sde_time)) | ||
312 | if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update: | ||
313 | f.write("set_inode_field /etc/fstab mtime %s\n" % (sde_time)) | ||
314 | f.write("set_inode_field /etc/fstab mtime_extra 0\n") | ||
315 | for file in set(files): | ||
316 | for time in ["atime", "ctime", "crtime"]: | ||
317 | f.write("set_inode_field \"%s\" %s %s\n" % (file, time, sde_time)) | ||
318 | f.write("set_inode_field \"%s\" %s_extra 0\n" % (file, time)) | ||
319 | for time in ["wtime", "mkfs_time", "lastcheck"]: | ||
320 | f.write("set_super_value %s %s\n" % (time, sde_time)) | ||
321 | for time in ["mtime", "first_error_time", "last_error_time"]: | ||
322 | f.write("set_super_value %s 0\n" % (time)) | ||
323 | debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) | ||
324 | exec_native_cmd(debugfs_cmd, native_sysroot) | ||
325 | |||
307 | self.check_for_Y2038_problem(rootfs, native_sysroot) | 326 | self.check_for_Y2038_problem(rootfs, native_sysroot) |
308 | 327 | ||
309 | def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir, | 328 | def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir, |