merge in oc-dr1-release history after reset to master
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 92e69bb..ff6f5bd 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -431,9 +431,27 @@
 ###########################################################
 ifdef LOCAL_COMPATIBILITY_SUITE
 
+# If we are building a native test or benchmark and its stem variants are not defined,
+# separate the multiple architectures into subdirectories of the testcase folder.
+arch_dir :=
+is_native :=
+ifeq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
+  is_native := true
+endif
+ifeq ($(LOCAL_MODULE_CLASS),NATIVE_BENCHMARK)
+  is_native := true
+endif
+ifdef LOCAL_MULTILIB
+  is_native := true
+endif
+ifdef is_native
+  arch_dir := /$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+  is_native :=
+endif
+
 # The module itself.
 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
-  $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+  $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
     $(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))))
 
 # Make sure we only add the files once for multilib modules.
diff --git a/core/build_id.mk b/core/build_id.mk
index 569e54a..0e8e2cf 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -13,21 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-# BUILD_ID is of the form NPM1.YYMMDD.nnn
-#
-# N - dessert designator
-# P - vertical, or category of release
-# M1 - release abbreviation
-# YY - year
-# MM - month
-# DD - day
-# nnn - the patch sequence, starting at 001 for the initial snap
-#
-# OPAT.161221.002
-#
-# See also:
-#
-# https://docs.google.com/document/d/17eqVTxMc2do05T6qwt4eASVyxy8u3Cme4u4fVD5q0VM/view#
-#
+# BUILD_ID is usually used to specify the branch name
+# (like "MAIN") or a branch name and a release candidate
+# (like "CRB01").  It must be a single word, and is
+# capitalized by convention.
 
-export BUILD_ID=OPD1.170412.003
+export BUILD_ID=MASTER
diff --git a/core/definitions.mk b/core/definitions.mk
index 2d260a1..b5cf10c 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -3243,11 +3243,12 @@
 ## Compatibility suite tools
 ###########################################################
 
-# Return a list of output directories for a given suite and the current LOCAL_MODULE
+# Return a list of output directories for a given suite and the current LOCAL_MODULE.
+# Can be passed a subdirectory to use for the common testcase directory.
 define compatibility_suite_dirs
   $(strip \
     $(COMPATIBILITY_TESTCASES_OUT_$(1)) \
-    $($(my_prefix)OUT_TESTCASES)/$(LOCAL_MODULE))
+    $($(my_prefix)OUT_TESTCASES)/$(LOCAL_MODULE)$(2))
 endef
 
 # For each suite:
diff --git a/core/tasks/device-tests.mk b/core/tasks/device-tests.mk
index 731937f..084353b 100644
--- a/core/tasks/device-tests.mk
+++ b/core/tasks/device-tests.mk
@@ -21,7 +21,9 @@
 	sed -i -e 's/\s\+/\n/g' $@.list
 	grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
 	grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
-	$(hide) $(SOONG_ZIP) -d -o $@ -C $(HOST_OUT) -l $@-host.list -C $(PRODUCT_OUT) -l $@-target.list
+	$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
 
 device-tests: $(device-tests-zip)
 $(call dist-for-goals, device-tests, $(device-tests-zip))
+
+tests: device-tests
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index e02faa7..9629bfa 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -20,7 +20,7 @@
 	sed -i -e 's/\s\+/\n/g' $@.list
 	grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
 	grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
-	$(hide) $(SOONG_ZIP) -d -o $@ -C $(HOST_OUT) -l $@-host.list -C $(PRODUCT_OUT) -l $@-target.list
+	$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
 
 general-tests: $(general-tests-zip)
 $(call dist-for-goals, general-tests, $(general-tests-zip))
diff --git a/envsetup.sh b/envsetup.sh
index ec6c960..55f4983 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -225,6 +225,16 @@
     fi
 
     export ANDROID_DEV_SCRIPTS=$T/development/scripts:$T/prebuilts/devtools/tools:$T/external/selinux/prebuilts/bin
+
+    # add kernel specific binaries
+    case $(uname -s) in
+        Linux)
+            export ANDROID_DEV_SCRIPTS=$ANDROID_DEV_SCRIPTS:$T/prebuilts/misc/linux-x86/dtc:$T/prebuilts/misc/linux-x86/libufdt
+            ;;
+        *)
+            ;;
+    esac
+
     export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_TOOLCHAIN:$ANDROID_TOOLCHAIN_2ND_ARCH:$ANDROID_DEV_SCRIPTS:
 
     # If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH
diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk
index 6448d9a..5f55728 100644
--- a/target/product/aosp_arm64_ab.mk
+++ b/target/product/aosp_arm64_ab.mk
@@ -22,11 +22,6 @@
 PRODUCT_COPY_FILES := \
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml
 
-# TODO(jiyong): remove sailfish/marlin rc files. They should be in
-# /vendor/etc/init after b/35269867
-PRODUCT_COPY_FILES += \
-    device/google/marlin/init.recovery.common.rc:root/init.recovery.sailfish.rc \
-
 PRODUCT_COPY_FILES += \
     device/google/marlin/init.recovery.common.rc:root/init.recovery.marlin.rc \
 
@@ -34,10 +29,6 @@
 PRODUCT_COPY_FILES += \
     vendor/google/products/marlin/bootanimation-1440-256col.zip:system/media/bootanimation.zip
 
-# TODO(jiyong): remove this marlin-specific overlay when b/35742444 is fixed.
-PRODUCT_PACKAGE_OVERLAYS := \
-    device/google/marlin/overlay
-
 #split selinux policy
 PRODUCT_FULL_TREBLE_OVERRIDE := true
 
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index b7e27ae..3fae2ac 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -87,10 +87,12 @@
     nonplat_property_contexts \
     nonplat_seapp_contexts \
     nonplat_service_contexts \
+    nonplat_hwservice_contexts \
     plat_mac_permissions.xml \
     plat_property_contexts \
     plat_seapp_contexts \
     plat_service_contexts \
+    plat_hwservice_contexts \
     selinux_policy \
     vndservice_contexts