merge in master-release history after reset to master
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 59b7d68..7f97a80 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -152,6 +152,11 @@
 
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
 
+# Start of "K" development!
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/core/build_id.mk b/core/build_id.mk
index 5d41135..40bb35d 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -1,4 +1,3 @@
-
 #
 # Copyright (C) 2008 The Android Open Source Project
 #
@@ -14,9 +13,20 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+#
+# Defines branch-specific values.
+#
+
 # 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
+# (like "TC1-RC5").  It must be a single word, and is
 # capitalized by convention.
+#
+BUILD_ID := MASTER
 
-export BUILD_ID=AAP73
+# DISPLAY_BUILD_NUMBER should only be set for development branches,
+# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
+# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY
+# is the same as BUILD_ID
+DISPLAY_BUILD_NUMBER := true
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 853f9a0..a566768 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -110,6 +110,7 @@
 LOCAL_RENDERSCRIPT_INCLUDES:=
 LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:=
 LOCAL_RENDERSCRIPT_CC:=
+LOCAL_RENDERSCRIPT_COMPATIBILITY:=
 LOCAL_RENDERSCRIPT_FLAGS:=
 LOCAL_RENDERSCRIPT_TARGET_API:=
 LOCAL_BUILD_HOST_DEX:=
diff --git a/core/config.mk b/core/config.mk
index 1da5a7f..8fd97dc 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -303,6 +303,7 @@
 JAVATAGS := build/tools/java-event-log-tags.py
 LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
 LLVM_RS_LINK := $(HOST_OUT_EXECUTABLES)/llvm-rs-link$(HOST_EXECUTABLE_SUFFIX)
+BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
 DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
 DEXPREOPT := dalvik/tools/dex-preopt
 LINT := prebuilts/sdk/tools/lint
diff --git a/core/definitions.mk b/core/definitions.mk
index 319b63e..96cc0cc 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -819,6 +819,16 @@
 $(hide) touch $@
 endef
 
+define transform-bc-to-so
+@echo "Renderscript compatibility"
+$(hide) mkdir -p $(dir $@)
+$(hide) $(BCC_COMPAT) -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \
+	-rt-path $(TARGET_OUT_SHARED_LIBRARIES)/libclcore.bc $<
+$(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) \
+	$(dir $@)/$(notdir $(<:.bc=.o)) -o $@ -L prebuilts/gcc/ \
+	-L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) -lRSSupport -lm
+endef
+
 ###########################################################
 ## Commands to compile RenderScript to C++
 ###########################################################
diff --git a/core/java.mk b/core/java.mk
index 222106c..ba7a45c 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -195,6 +195,26 @@
 $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
 	$(transform-renderscripts-to-java-and-bc)
 
+ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
+bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
+rs_generated_bc := $(addprefix \
+    $(renderscript_intermediate)/res/raw/, $(bc_files))
+
+rs_compatibility_jni_libs := $(addprefix \
+    $(renderscript_intermediate)/lib, \
+    $(patsubst %.bc,%.so, $(bc_files)))
+
+$(rs_generated_bc) : $(RenderScript_file_stamp)
+
+$(rs_compatibility_jni_libs): $(RenderScript_file_stamp)
+$(rs_compatibility_jni_libs): $(BCC_COMPAT)
+$(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX)
+$(rs_compatibility_jni_libs): $(renderscript_intermediate)/lib%.so: \
+    $(renderscript_intermediate)/res/raw/%.bc
+	$(transform-bc-to-so)
+
+endif
+
 # include the dependency files (.d) generated by llvm-rs-cc.
 renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
     $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
diff --git a/core/package.mk b/core/package.mk
index 3af1afb..c0bc7d8 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -191,6 +191,8 @@
 endif # EMMA_INSTRUMENT_STATIC
 endif # LOCAL_EMMA_INSTRUMENT
 
+rs_compatibility_jni_libs :=
+
 #################################
 include $(BUILD_SYSTEM)/java.mk
 #################################
@@ -324,6 +326,12 @@
       $(addsuffix $(so_suffix), \
         $(LOCAL_JNI_SHARED_LIBRARIES)))
 
+# Include RS dynamically-generated libraries as well
+# Keep this ifneq, as the += otherwise adds spaces that need to be stripped.
+ifneq ($(rs_compatibility_jni_libs),)
+jni_shared_libraries += $(rs_compatibility_jni_libs)
+endif
+
 # App explicitly requires the prebuilt NDK libstlport_shared.so.
 # libstlport_shared.so should never go to the system image.
 # Instead it should be packaged into the apk.
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index e3ba14f..56860d8 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -41,7 +41,7 @@
   # which is the version that we reveal to the end user.
   # Update this value when the platform version changes (rather
   # than overriding it somewhere else).  Can be an arbitrary string.
-  PLATFORM_VERSION := 4.2.2
+  PLATFORM_VERSION := K
 endif
 
 ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -59,7 +59,7 @@
 ifeq "" "$(PLATFORM_VERSION_CODENAME)"
   # This is the current development code-name, if the build is not a final
   # release build.  If this is a final release build, it is simply "REL".
-  PLATFORM_VERSION_CODENAME := REL
+  PLATFORM_VERSION_CODENAME := K
 endif
 
 ifeq "" "$(DEFAULT_APP_TARGET_SDK)"