Merge "Fix ALLOW_MISSING_DEPENDENCIES in PDK builds"
diff --git a/core/Makefile b/core/Makefile
index ac8b2f2..a23cdd4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1781,7 +1781,7 @@
ifdef INSTALLED_DTBOIMAGE_TARGET
INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
- --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
+ --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
endif
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@@ -2234,10 +2234,7 @@
ifeq ($(BOARD_AVB_ENABLE),true)
$(hide) echo "board_avb_enable=true" >> $(zip_root)/META/misc_info.txt
$(hide) echo "board_avb_rollback_index=$(BOARD_AVB_ROLLBACK_INDEX)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "board_avb_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "board_avb_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "board_avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "board_avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "board_avb_make_vbmeta_image_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
endif
ifdef BOARD_BPT_INPUT_FILES
@@ -2292,8 +2289,14 @@
$(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
endif
ifdef BOARD_PREBUILT_DTBOIMAGE
- $(hide) mkdir -p $(zip_root)/IMAGES
- $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/IMAGES/
+ $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
+ $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
+ $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
+ifeq ($(BOARD_AVB_ENABLE),true)
+ $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "board_avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" \
+ >> $(zip_root)/META/misc_info.txt
+endif
endif
@# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
index c5cc690..c2473cd 100644
--- a/core/clang/versions.mk
+++ b/core/clang/versions.mk
@@ -1,4 +1,4 @@
## Clang/LLVM release versions.
-LLVM_PREBUILTS_VERSION ?= clang-3859424
+LLVM_PREBUILTS_VERSION ?= clang-4053586
LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 86354e7..1d8090a 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -173,13 +173,43 @@
block_list=block_list)
return img.name
-def FindDtboPrebuilt(prefix="IMAGES/"):
- """Find the prebuilt image of DTBO partition."""
- prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix, "dtbo.img")
- if os.path.exists(prebuilt_path):
- return prebuilt_path
- return None
+def AddDtbo(output_zip, prefix="IMAGES/"):
+ """Adds the DTBO image.
+
+ Uses the image under prefix if it already exists. Otherwise looks for the
+ image under PREBUILT_IMAGES/, signs it as needed, and returns the image name.
+ """
+
+ img = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "dtbo.img")
+ if os.path.exists(img.input_name):
+ print("dtbo.img already exists in %s, no need to rebuild..." % (prefix,))
+ return img.input_name
+
+ dtbo_prebuilt_path = os.path.join(
+ OPTIONS.input_tmp, "PREBUILT_IMAGES", "dtbo.img")
+ assert os.path.exists(dtbo_prebuilt_path)
+ shutil.copy(dtbo_prebuilt_path, img.name)
+
+ # AVB-sign the image as needed.
+ if OPTIONS.info_dict.get("board_avb_enable") == "true":
+ avbtool = os.getenv('AVBTOOL') or OPTIONS.info_dict["avb_avbtool"]
+ part_size = OPTIONS.info_dict["dtbo_size"]
+ # The AVB hash footer will be replaced if already present.
+ cmd = [avbtool, "add_hash_footer", "--image", img.name,
+ "--partition_size", str(part_size), "--partition_name", "dtbo"]
+ cmd.extend(shlex.split(OPTIONS.info_dict["avb_signing_args"]))
+ args = OPTIONS.info_dict.get("board_avb_dtbo_add_hash_footer_args")
+ if args and args.strip():
+ cmd.extend(shlex.split(args))
+ p = common.Run(cmd, stdout=subprocess.PIPE)
+ p.communicate()
+ assert p.returncode == 0, \
+ "avbtool add_hash_footer of %s failed" % (img.name,)
+
+ img.Write()
+ return img.name
+
def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
print("creating " + what + ".img...")
@@ -308,7 +338,7 @@
dtbo_img_path, prefix="IMAGES/"):
"""Create a VBMeta image and store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "vbmeta.img")
- avbtool = os.getenv('AVBTOOL') or "avbtool"
+ avbtool = os.getenv('AVBTOOL') or OPTIONS.info_dict["avb_avbtool"]
cmd = [avbtool, "make_vbmeta_image",
"--output", img.name,
"--include_descriptors_from_image", boot_img_path,
@@ -317,10 +347,10 @@
cmd.extend(["--include_descriptors_from_image", vendor_img_path])
if dtbo_img_path is not None:
cmd.extend(["--include_descriptors_from_image", dtbo_img_path])
- if OPTIONS.info_dict.get("system_root_image", None) == "true":
+ if OPTIONS.info_dict.get("system_root_image") == "true":
cmd.extend(["--setup_rootfs_from_kernel", system_img_path])
- common.AppendAVBSigningArgs(cmd)
- args = OPTIONS.info_dict.get("board_avb_make_vbmeta_image_args", None)
+ cmd.extend(shlex.split(OPTIONS.info_dict["avb_signing_args"]))
+ args = OPTIONS.info_dict.get("board_avb_make_vbmeta_image_args")
if args and args.strip():
cmd.extend(shlex.split(args))
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -500,7 +530,7 @@
banner("system")
system_img_path = AddSystem(
- output_zip, recovery_img=recovery_image, boot_img=boot_image)
+ output_zip, recovery_img=recovery_image, boot_img=boot_image)
vendor_img_path = None
if has_vendor:
banner("vendor")
@@ -513,13 +543,19 @@
AddUserdata(output_zip)
banner("cache")
AddCache(output_zip)
- if OPTIONS.info_dict.get("board_bpt_enable", None) == "true":
+
+ if OPTIONS.info_dict.get("board_bpt_enable") == "true":
banner("partition-table")
AddPartitionTable(output_zip)
- if OPTIONS.info_dict.get("board_avb_enable", None) == "true":
+
+ dtbo_img_path = None
+ if OPTIONS.info_dict.get("has_dtbo") == "true":
+ banner("dtbo")
+ dtbo_img_path = AddDtbo(output_zip)
+
+ if OPTIONS.info_dict.get("board_avb_enable") == "true":
banner("vbmeta")
boot_contents = boot_image.WriteToTemp()
- dtbo_img_path = FindDtboPrebuilt()
AddVBMeta(output_zip, boot_contents.name, system_img_path,
vendor_img_path, dtbo_img_path)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index c022d24..652fadf 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -345,16 +345,6 @@
print("%-25s = (%s) %s" % (k, type(v).__name__, v))
-def AppendAVBSigningArgs(cmd):
- """Append signing arguments for avbtool."""
- keypath = OPTIONS.info_dict.get("board_avb_key_path", None)
- algorithm = OPTIONS.info_dict.get("board_avb_algorithm", None)
- if not keypath or not algorithm:
- algorithm = "SHA256_RSA4096"
- keypath = "external/avb/test/data/testkey_rsa4096.pem"
- cmd.extend(["--key", keypath, "--algorithm", algorithm])
-
-
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
has_ramdisk=False, two_step_image=False):
"""Build a bootable image from the specified sourcedir.
@@ -491,12 +481,12 @@
# AVB: if enabled, calculate and add hash to boot.img.
if info_dict.get("board_avb_enable", None) == "true":
- avbtool = os.getenv('AVBTOOL') or OPTIONS.info_dict["avb_avbtool"]
- part_size = info_dict.get("boot_size", None)
+ avbtool = os.getenv('AVBTOOL') or info_dict["avb_avbtool"]
+ part_size = info_dict["boot_size"]
cmd = [avbtool, "add_hash_footer", "--image", img.name,
"--partition_size", str(part_size), "--partition_name", "boot"]
- AppendAVBSigningArgs(cmd)
- args = info_dict.get("board_avb_boot_add_hash_footer_args", None)
+ cmd.extend(shlex.split(info_dict["avb_signing_args"]))
+ args = info_dict.get("board_avb_boot_add_hash_footer_args")
if args and args.strip():
cmd.extend(shlex.split(args))
p = Run(cmd, stdout=subprocess.PIPE)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 7883fe6..0c44faf 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -130,7 +130,7 @@
' getprop("ro.build.thumbprint") == "{tp}" ||\n'
' abort("Package expects build fingerprint of {fp} or '
'thumbprint of {tp}; this device has a fingerprint of " '
- '+ getprop("ro.build.fingerprint") and a thumbprint of " '
+ '+ getprop("ro.build.fingerprint") + " and a thumbprint of " '
'+ getprop("ro.build.thumbprint") + ".");').format(fp=fp, tp=tp)
self.script.append(cmd)