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