Merge "Create userdata.img with real data when SANITIZE_TARGET=address."
This commit is contained in:
@@ -1475,6 +1475,10 @@ endif
|
|||||||
ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
|
ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
|
||||||
# OTA scripts are only interested in fingerprint related properties
|
# OTA scripts are only interested in fingerprint related properties
|
||||||
$(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
|
$(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
|
||||||
|
endif
|
||||||
|
ifeq ($(SANITIZE_TARGET),address)
|
||||||
|
# We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
|
||||||
|
$(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
|
||||||
endif
|
endif
|
||||||
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
|
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
|
||||||
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
|
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
|
||||||
|
@@ -30,6 +30,7 @@ if sys.hexversion < 0x02070000:
|
|||||||
|
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
@@ -153,7 +154,13 @@ def CreateImage(input_dir, info_dict, what, block_list=None):
|
|||||||
|
|
||||||
|
|
||||||
def AddUserdata(output_zip, prefix="IMAGES/"):
|
def AddUserdata(output_zip, prefix="IMAGES/"):
|
||||||
"""Create an empty userdata image and store it in output_zip."""
|
"""Create a userdata image and store it in output_zip.
|
||||||
|
|
||||||
|
In most case we just create and store an empty userdata.img;
|
||||||
|
But the invoker can also request to create userdata.img with real
|
||||||
|
data from the target files, by setting "userdata_img_with_data=true"
|
||||||
|
in OPTIONS.info_dict.
|
||||||
|
"""
|
||||||
|
|
||||||
prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix, "userdata.img")
|
prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix, "userdata.img")
|
||||||
if os.path.exists(prebuilt_path):
|
if os.path.exists(prebuilt_path):
|
||||||
@@ -172,10 +179,19 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
|
|||||||
|
|
||||||
# The name of the directory it is making an image out of matters to
|
# The name of the directory it is making an image out of matters to
|
||||||
# mkyaffs2image. So we create a temp dir, and within it we create an
|
# mkyaffs2image. So we create a temp dir, and within it we create an
|
||||||
# empty dir named "data", and build the image from that.
|
# empty dir named "data", or a symlink to the DATA dir,
|
||||||
|
# and build the image from that.
|
||||||
temp_dir = tempfile.mkdtemp()
|
temp_dir = tempfile.mkdtemp()
|
||||||
user_dir = os.path.join(temp_dir, "data")
|
user_dir = os.path.join(temp_dir, "data")
|
||||||
os.mkdir(user_dir)
|
empty = (OPTIONS.info_dict.get("userdata_img_with_data") != "true")
|
||||||
|
if empty:
|
||||||
|
# Create an empty dir.
|
||||||
|
os.mkdir(user_dir)
|
||||||
|
else:
|
||||||
|
# Symlink to the DATA dir.
|
||||||
|
os.symlink(os.path.join(OPTIONS.input_tmp, "DATA"),
|
||||||
|
user_dir)
|
||||||
|
|
||||||
img = tempfile.NamedTemporaryFile()
|
img = tempfile.NamedTemporaryFile()
|
||||||
|
|
||||||
fstab = OPTIONS.info_dict["fstab"]
|
fstab = OPTIONS.info_dict["fstab"]
|
||||||
@@ -187,8 +203,7 @@ def AddUserdata(output_zip, prefix="IMAGES/"):
|
|||||||
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
|
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
|
||||||
common.ZipWrite(output_zip, img.name, prefix + "userdata.img")
|
common.ZipWrite(output_zip, img.name, prefix + "userdata.img")
|
||||||
img.close()
|
img.close()
|
||||||
os.rmdir(user_dir)
|
shutil.rmtree(temp_dir)
|
||||||
os.rmdir(temp_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def AddCache(output_zip, prefix="IMAGES/"):
|
def AddCache(output_zip, prefix="IMAGES/"):
|
||||||
|
@@ -31,7 +31,7 @@ import tempfile
|
|||||||
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
|
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
|
||||||
|
|
||||||
def RunCommand(cmd):
|
def RunCommand(cmd):
|
||||||
""" Echo and run the given command
|
""" Echo and run the given command.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
cmd: the command represented as a list of strings.
|
cmd: the command represented as a list of strings.
|
||||||
|
Reference in New Issue
Block a user