fix timestamps in images to the build date
Pass the -T option to mkuserimg.sh to set all timestamps in the system
image (and any other ext4 image we build) to the value of
ro.build.date.utc for the build. This makes images produced from a
given target_files bit-identical.
Change-Id: Ibba5fa7a610f476209ef61708729cfd79dece0b6
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 2d75749..9f71194 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -232,8 +232,9 @@
run_fsck = True
build_command.extend([in_dir, out_file, fs_type,
prop_dict["mount_point"]])
- if "partition_size" in prop_dict:
- build_command.append(prop_dict["partition_size"])
+ build_command.append(prop_dict["partition_size"])
+ if "timestamp" in prop_dict:
+ build_command.extend(["-T", str(prop_dict["timestamp"])])
if "selinux_fc" in prop_dict:
build_command.append(prop_dict["selinux_fc"])
else:
@@ -276,7 +277,7 @@
glob_dict: the global dictionary from the build system.
mount_point: such as "system", "data" etc.
"""
- d = {}
+ d = {"timestamp": glob_dict["build.prop"].get("ro.build.date.utc", -1)}
def copy_prop(src_p, dest_p):
if src_p in glob_dict: