merge in jb-release history after reset to master
diff --git a/core/Makefile b/core/Makefile
index bb714ab..169fc02 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -682,7 +682,8 @@
     $(ALL_PREBUILT) \
     $(ALL_COPIED_HEADERS) \
     $(ALL_GENERATED_SOURCES) \
-    $(ALL_DEFAULT_INSTALLED_MODULES))
+    $(ALL_DEFAULT_INSTALLED_MODULES)\
+    $(ALL_PDK_FUSION_FILES))
 
 ifdef is_tests_build
 # We don't want to install tests modules to the system partition
@@ -800,6 +801,21 @@
 .PHONY: stnod
 stnod: systemtarball-nodeps
 
+#######
+## platform.zip: system in a zip file
+INSTALLED_PLATFROM_ZIP := $(PRODUCT_OUT)/platform.zip
+$(INSTALLED_PLATFROM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
+	$(call pretty,"Platform zip package: $(INSTALLED_PLATFROM_ZIP)")
+	$(hide) rm -f $@
+	$(hide) cd $(dir $@) && zip -qry $(notdir $@) system
+
+.PHONY: platform
+platform: $(INSTALLED_PLATFROM_ZIP)
+
+# Dist the platform.zip
+ifneq (,$(filter platform, $(MAKECMDGOALS)))
+$(call dist-for-goals, platform, $(INSTALLED_PLATFROM_ZIP))
+endif
 
 #######
 ## boot tarball
diff --git a/core/build_id.mk b/core/build_id.mk
index 698ac3b..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=JRN02D
+# 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/main.mk b/core/main.mk
index 841bd3f..15e8973 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -209,30 +209,8 @@
 
 # -----------------------------------------------------------------
 # The pdk (Platform Development Kit) build
-# pdk_eng : for building binary blob necessary for pdk_rel build
-# pdk_rel : HAL build for chipset vendors
+include build/core/pdk_config.mk
 
-PDK_BUILD_TYPE:= $(filter pdk_eng pdk_rel,$(MAKECMDGOALS))
-ifeq (2,$(words $(PDK_BUILD_TYPE)))
-  $(error You can't build pdk_eng and pdk_rel in the same run.)
-endif
-ifneq ($(PDK_BUILD_TYPE),)
-  $(info PDK build type $(PDK_BUILD_TYPE))
-  BUILD_PDK:=true
-  TARGET_BUILD_PDK:=true
-  include pdk/build/pdk.mk
-  # force droid target
-  MAKECMDGOALS:= $(subst $(PDK_BUILD_TYPE),droid,$(MAKECMDGOALS))
-ifeq ($(PDK_BUILD_TYPE), pdk_eng)
-  .PHONY: pdk_eng
-  pdk_eng: droid pdk_bin_zip
-
-else  # pdk_rel
-  .PHONY: pdk_rel
-  pdk_rel: droid
-
-endif # pdk_rel
-endif # PDK_BUILD_TYPE
 # -----------------------------------------------------------------
 ###
 ### In this section we set up the things that are different
@@ -437,10 +415,6 @@
 	external/yaffs2 \
 	external/zlib
 else	# !BUILD_TINY_ANDROID
-ifneq ($(BUILD_PDK),)
-subdirs := $(BUILD_PDK_SUBDIRS)
-FULL_BUILD := true
-else # Normal droid build
 #
 # Typical build; include any Android.mk files we can find.
 #
@@ -448,8 +422,6 @@
 
 FULL_BUILD := true
 
-endif  # !BUILD_PDK
-
 endif	# !BUILD_TINY_ANDROID
 
 endif	# !SDK_ONLY
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
new file mode 100644
index 0000000..98f34a5
--- /dev/null
+++ b/core/pdk_config.mk
@@ -0,0 +1,66 @@
+# This file defines the rule to fuse the platform.zip into the current PDK build.
+
+.PHONY: pdk fusion
+pdk fusion: $(DEFAULT_GOAL)
+
+# What to build:
+# pdk fusion if:
+# 1) the platform.zip exists in the default location
+# or
+# 2) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
+# or
+# 3) fusion is a command line build goal,
+#    PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
+# otherwise pdk only if:
+# 1) pdk is a command line build goal
+# or
+# 2) TARGET_BUILD_PDK is passed in from the environment
+
+# TODO: what's the best default location?
+_pdk_fusion_default_platform_zip := $(OUT_DIR)/platform.zip
+ifneq (,$(wildcard $(_pdk_fusion_default_platform_zip)))
+$(info $(_pdk_fusion_default_platform_zip) found, do a PDK fusion build.)
+PDK_FUSION_PLATFORM_ZIP := $(_pdk_fusion_default_platform_zip)
+TARGET_BUILD_PDK := true
+endif
+
+ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
+TARGET_BUILD_PDK := true
+ifneq (,$(filter fusion, $(MAKECMDGOALS)))
+ifndef PDK_FUSION_PLATFORM_ZIP
+  $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
+endif
+endif  # fusion
+endif  # pdk or fusion
+
+ifdef PDK_FUSION_PLATFORM_ZIP
+TARGET_BUILD_PDK := true
+ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
+  $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
+endif
+
+_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
+_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
+
+$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
+	@echo "Unzip $(dir $@) <- $<"
+	$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
+	$(hide) unzip -qo $< -d $(dir $@)
+	$(hide) touch $@
+
+_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null)
+_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list))
+$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
+
+# Implicit pattern rules to copy the fusion files to the system image directory.
+# Note that if there is already explicit rule in the build system to generate a file,
+# the pattern rule will be just ignored by make.
+# That's desired by us: we want only absent files from the platform zip package.
+# Copy with the last-modified time preserved, never follow symbolic links.
+$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/%
+	@mkdir -p $(dir $@)
+	$(hide) cp -fpPR $< $@
+
+ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
+
+endif