Merge "GSI: add the messaging app" into oc-mr1-dev
diff --git a/core/config.mk b/core/config.mk
index 94277de..cc2b2af 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -727,6 +727,14 @@
PRODUCT_FULL_TREBLE := true
endif
+ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
+ ifneq ($(TARGET_USES_MKE2FS),true)
+ $(error When PRODUCT_SHIPPING_API_LEVEL >= 27, TARGET_USES_MKE2FS must be true)
+ endif
+ endif
+endif
+
# The default key if not set as LOCAL_CERTIFICATE
ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE)
diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk
index e3a6707..d930749 100644
--- a/target/board/generic_arm_a/BoardConfig.mk
+++ b/target/board/generic_arm_a/BoardConfig.mk
@@ -17,7 +17,7 @@
include build/make/target/board/treble_common_32.mk
# Overwrite the setting in treble_common_32.mk for non-A/B arm GSI
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 950009856
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 805306368 # 768MB
TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk
index ae8de14..011bcdf 100644
--- a/target/board/generic_arm_ab/BoardConfig.mk
+++ b/target/board/generic_arm_ab/BoardConfig.mk
@@ -16,6 +16,9 @@
include build/make/target/board/treble_common_32.mk
+# Overwrite the setting in treble_common_32.mk for non-A/B arm GSI
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 805306368 # 768MB
+
TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_ABI := armeabi-v7a
diff --git a/target/product/product_launched_with_o_mr1.mk b/target/product/product_launched_with_o_mr1.mk
new file mode 100644
index 0000000..25620aa
--- /dev/null
+++ b/target/product/product_launched_with_o_mr1.mk
@@ -0,0 +1,2 @@
+#PRODUCT_SHIPPING_API_LEVEL indicates the first api level, device has been commercially launced on.
+PRODUCT_SHIPPING_API_LEVEL := 27
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 52d3918..1a08cb6 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -53,11 +53,13 @@
import datetime
import errno
+import hashlib
import os
import shlex
import shutil
import subprocess
import tempfile
+import uuid
import zipfile
import build_image
@@ -257,6 +259,19 @@
if block_list:
image_props["block_list"] = block_list.name
+ # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
+ # build fingerprint).
+ uuid_seed = what + "-"
+ if "build.prop" in info_dict:
+ build_prop = info_dict["build.prop"]
+ if "ro.build.fingerprint" in build_prop:
+ uuid_seed += build_prop["ro.build.fingerprint"]
+ elif "ro.build.thumbprint" in build_prop:
+ uuid_seed += build_prop["ro.build.thumbprint"]
+ image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
+ hash_seed = "hash_seed-" + uuid_seed
+ image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
+
succ = build_image.BuildImage(os.path.join(temp_dir, what),
image_props, output_file.name)
assert succ, "build " + what + ".img image failed"
@@ -532,6 +547,17 @@
has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true")
+ if OPTIONS.info_dict.get("avb_enable") == "true":
+ fp = None
+ if "build.prop" in OPTIONS.info_dict:
+ build_prop = OPTIONS.info_dict["build.prop"]
+ if "ro.build.fingerprint" in build_prop:
+ fp = build_prop["ro.build.fingerprint"]
+ elif "ro.build.thumbprint" in build_prop:
+ fp = build_prop["ro.build.thumbprint"]
+ if fp:
+ OPTIONS.info_dict["avb_salt"] = hashlib.sha256(fp).hexdigest()
+
def banner(s):
print("\n\n++++ " + s + " ++++\n\n")
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 6de9763..ccfa35f 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -120,7 +120,7 @@
return int(output)
def AVBAddFooter(image_path, avbtool, footer_type, partition_size,
- partition_name, key_path, algorithm,
+ partition_name, key_path, algorithm, salt,
additional_args):
"""Adds dm-verity hashtree and AVB metadata to an image.
@@ -132,6 +132,7 @@
partition_name: The name of the partition - will be embedded in metadata.
key_path: Path to key to use or None.
algorithm: Name of algorithm to use or None.
+ salt: The salt to use (a hexadecimal string) or None.
additional_args: Additional arguments to pass to 'avbtool
add_hashtree_image'.
Returns:
@@ -144,6 +145,8 @@
if key_path and algorithm:
cmd.extend(["--key", key_path, "--algorithm", algorithm])
+ if salt:
+ cmd.extend(["--salt", salt])
cmd.extend(shlex.split(additional_args))
@@ -467,6 +470,12 @@
build_command.extend(["-e", prop_dict["flash_erase_block_size"]])
if "flash_logical_block_size" in prop_dict:
build_command.extend(["-o", prop_dict["flash_logical_block_size"]])
+ # Specify UUID and hash_seed if using mke2fs.
+ if prop_dict["ext_mkuserimg"] == "mkuserimg_mke2fs.sh":
+ if "uuid" in prop_dict:
+ build_command.extend(["-U", prop_dict["uuid"]])
+ if "hash_seed" in prop_dict:
+ build_command.extend(["-S", prop_dict["hash_seed"]])
if "selinux_fc" in prop_dict:
build_command.append(prop_dict["selinux_fc"])
elif fs_type.startswith("squash"):
@@ -584,10 +593,11 @@
# key_path and algorithm are only available when chain partition is used.
key_path = prop_dict.get("avb_key_path")
algorithm = prop_dict.get("avb_algorithm")
+ salt = prop_dict.get("avb_salt")
# avb_add_hash_footer_args or avb_add_hashtree_footer_args
additional_args = prop_dict["avb_add_" + avb_footer_type + "_footer_args"]
if not AVBAddFooter(out_file, avbtool, avb_footer_type, original_partition_size,
- partition_name, key_path, algorithm, additional_args):
+ partition_name, key_path, algorithm, salt, additional_args):
return False
if run_fsck and prop_dict.get("skip_fsck") != "true":
@@ -633,8 +643,9 @@
"verity_signer_cmd",
"verity_fec",
"avb_enable",
- "avb_avbtool"
- )
+ "avb_avbtool",
+ "avb_salt",
+ )
for p in common_props:
copy_prop(p, p)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 34c334e..f3096c9 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -353,6 +353,10 @@
algorithm = OPTIONS.info_dict.get("avb_" + partition + "_algorithm")
if key_path and algorithm:
cmd.extend(["--key", key_path, "--algorithm", algorithm])
+ avb_salt = OPTIONS.info_dict.get("avb_salt")
+ # make_vbmeta_image doesn't like "--salt" (and it's not needed).
+ if avb_salt and partition != "vbmeta":
+ cmd.extend(["--salt", avb_salt])
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,