Merge "Define a basic llvm-link + clang environment"
diff --git a/core/Makefile b/core/Makefile
index ce22fc9..173932c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -9,6 +9,8 @@
   FILE_NAME_TAG := $(BUILD_NUMBER)
 endif
 
+is_tests_build := $(filter tests,$(MAKECMDGOALS))
+
 # -----------------------------------------------------------------
 # Define rules to copy PRODUCT_COPY_FILES defined by the product.
 # PRODUCT_COPY_FILES contains words like <source file>:<dest file>.
@@ -406,6 +408,11 @@
 # -----------------------------------------------------------------
 # NOTICE files
 #
+# We are required to publish the licenses for all code under BSD, GPL and
+# Apache licenses (and possibly other more exotic ones as well). We err on the
+# side of caution, so the licenses for other third-party code are included here
+# too.
+#
 # This needs to be before the systemimage rules, because it adds to
 # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
 # go into the systemimage.
@@ -741,10 +748,18 @@
 #
 
 INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
-	$(ALL_PREBUILT) \
-	$(ALL_COPIED_HEADERS) \
-	$(ALL_GENERATED_SOURCES) \
-	$(ALL_DEFAULT_INSTALLED_MODULES))
+    $(ALL_PREBUILT) \
+    $(ALL_COPIED_HEADERS) \
+    $(ALL_GENERATED_SOURCES) \
+    $(ALL_DEFAULT_INSTALLED_MODULES))
+
+ifdef is_tests_build
+# We don't want to install tests modules to the system partition
+# when building "tests", because now "tests" may be built in a user, userdebug
+# or eng build variant and we don't want to pollute the system partition.
+# INTERNAL_SYSTEMIMAGE_FILES += $(filter $(TARGET_OUT)/%, \
+#    $(tests_MODULES))
+endif
 
 FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
 # -----------------------------------------------------------------
@@ -888,6 +903,12 @@
 INTERNAL_USERDATAIMAGE_FILES := \
     $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
 
+# If we build "tests" at the same time, make sure $(tests_MODULES) get covered.
+ifdef is_tests_build
+INTERNAL_USERDATAIMAGE_FILES += \
+    $(filter $(TARGET_OUT_DATA)/%,$(tests_MODULES))
+endif
+
 userdataimage_intermediates := \
     $(call intermediates-dir-for,PACKAGING,userdata)
 BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
@@ -1206,7 +1227,7 @@
 # -----------------------------------------------------------------
 # A zip of the tests that are built when running "make tests".
 # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
-# only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
+# only grab DATA, and it's called "*-tests-*.zip".
 #
 name := $(TARGET_PRODUCT)
 ifeq ($(TARGET_BUILD_TYPE),debug)
@@ -1222,21 +1243,11 @@
 # Depending on the images guarantees that the underlying
 # directories are up-to-date.
 $(BUILT_TESTS_ZIP_PACKAGE): \
-		$(BUILT_SYSTEMIMAGE) \
-		$(INSTALLED_USERDATAIMAGE_TARGET) \
-		| $(ACP)
+    $(INSTALLED_USERDATAIMAGE_TARGET) \
+    | $(ACP)
 	@echo "Package test files: $@"
 	$(hide) rm -rf $@ $(zip_root)
 	$(hide) mkdir -p $(dir $@) $(zip_root)
-	@# Some parts of the system image
-	$(hide) $(call package_files-copy-root, \
-		$(SYSTEMIMAGE_SOURCE_DIR)/xbin,$(zip_root)/SYSTEM/xbin)
-	$(hide) $(call package_files-copy-root, \
-		$(SYSTEMIMAGE_SOURCE_DIR)/lib,$(zip_root)/SYSTEM/lib)
-	$(hide) $(call package_files-copy-root, \
-		$(SYSTEMIMAGE_SOURCE_DIR)/framework, \
-		$(zip_root)/SYSTEM/framework)
-	$(hide) $(ACP) $(SYSTEMIMAGE_SOURCE_DIR)/build.prop $(zip_root)/SYSTEM
 	@# Contents of the data image
 	$(hide) $(call package_files-copy-root, \
 		$(TARGET_OUT_DATA),$(zip_root)/DATA)
@@ -1247,13 +1258,17 @@
 
 # Target needed by tests build
 .PHONY: tests-build-target
-tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
-                    $(BUILT_USERDATAIMAGE_TARGET)
+tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE)
 
 ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
   $(call dist-for-goals, tests-build-target, \
-          $(BUILT_TESTS_ZIP_PACKAGE) \
-          $(BUILT_USERDATAIMAGE_TARGET))
+          $(BUILT_TESTS_ZIP_PACKAGE))
+endif
+
+.PHONY: tests
+tests: $(BUILT_TESTS_ZIP_PACKAGE)
+ifneq (,$(filter tests, $(MAKECMDGOALS)))
+$(call dist-for-goals, tests, $(BUILT_TESTS_ZIP_PACKAGE))
 endif
 
 # -----------------------------------------------------------------
diff --git a/core/binary.mk b/core/binary.mk
index e488200..e729164 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -571,7 +571,7 @@
 # We don't care about installed static libraries, since the
 # libraries have already been linked into the module at that point.
 # We do, however, care about the NOTICE files for any static
-# libraries that we use. (see notice_files.make)
+# libraries that we use. (see notice_files.mk)
 
 installed_static_library_notice_file_targets := \
     $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index ae4bd38..63f44b3 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -117,6 +117,7 @@
 LOCAL_PROPRIETARY_MODULE:=
 LOCAL_MODULE_OWNER:=
 LOCAL_CTS_TEST_PACKAGE:=
+LOCAL_CTS_TEST_RUNNER:=
 
 # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
 # iterate over thousands of entries every time.
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 5974fbf..6cee6ea 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -33,13 +33,13 @@
 # LOCAL_CC and LOCAL_CXX to override this.
 #
 ifeq ($(TARGET_PRODUCT),sdk)
-HOST_SDK_TOOLCHAIN_PREFIX := prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/bin/i686-linux
+HOST_SDK_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk
 # Don't do anything if the toolchain is not there
-ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc)))
-HOST_CC  := $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc
-HOST_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)-g++
-HOST_AR  := $(HOST_SDK_TOOLCHAIN_PREFIX)-ar
-endif # $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc exists
+ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc)))
+HOST_CC  := $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc
+HOST_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)/g++
+HOST_AR  := $(HOST_SDK_TOOLCHAIN_PREFIX)/ar
+endif # $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc exists
 endif # TARGET_PRODUCT == sdk
 
 ifneq ($(strip $(BUILD_HOST_64bit)),)
diff --git a/core/config.mk b/core/config.mk
index a3eb358..6383113 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -33,7 +33,7 @@
 	$(TOPDIR)frameworks/native/opengl/include \
 	$(TOPDIR)frameworks/base/include \
 	$(TOPDIR)frameworks/base/opengl/include \
-    $(TOPDIR)frameworks/base/native/include \
+	$(TOPDIR)frameworks/base/native/include \
 	$(TOPDIR)external/skia/include
 SRC_HOST_HEADERS:=$(TOPDIR)tools/include
 SRC_LIBRARIES:= $(TOPDIR)libs
@@ -151,6 +151,33 @@
 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
 board_config_mk :=
 
+# pull in device specific kernel headers. Files should be in
+# $(TARGET_DEVICE_DIR)/kernel-headers, e.g.
+# $(TARGET_DEVICE_DIR)/kernel-headers/linux/
+# $(TARGET_DEVICE_DIR)/kernel-headers/media/
+# $(TARGET_DEVICE_DIR)/kernel-headers/video/
+# etc.
+TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
+
+define validate-kernel-headers
+$(if $(firstword $(foreach hdr_dir,$(1),\
+         $(filter-out kernel-headers,$(notdir $(hdr_dir))))),\
+     $(error Kernel header dirs must be end in kernel-headers: $(1)))
+endef
+# also allow the board config to provide additional directories since
+# there could be device/oem/base_hw and device/oem/derived_hw
+# that both are valid devices but derived_hw needs to use kernel headers
+# from base_hw.
+TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
+TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
+$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
+
+# then add product-inherited includes, to allow for
+# hardware/sivendor/chip/chip.mk to include their own headers
+TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
+TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
+$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
+
 # Clean up/verify variables defined by the board config file.
 TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
 TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
@@ -330,7 +357,8 @@
 TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
 
 HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
-TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS)
+TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
+		$(TARGET_OUT_KERNEL_HEADERS)
 
 # Many host compilers don't support these flags, so we have to make
 # sure to only specify them for the target compilers checked in to
diff --git a/core/definitions.mk b/core/definitions.mk
index 4f13133..0b7092f 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1927,6 +1927,21 @@
 	$$(transform-prebuilt-to-target)
 endef
 
+# Version of add-radio-file that also arranges for the version of the
+# file to be checked against the contents of
+# $(TARGET_BOARD_INFO_FILE).
+# $(1): filename
+# $(2): name of version variable in board-info (eg, "version-baseband")
+define add-radio-file-checked
+  $(eval $(call add-radio-file-checked-internal,$(1),$(notdir $(1)),$(2)))
+endef
+define add-radio-file-checked-internal
+INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2)
+BOARD_INFO_CHECK += $(3):$(LOCAL_PATH)/$(1)
+$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP)
+	$$(transform-prebuilt-to-target)
+endef
+
 
 ###########################################################
 # Override the package defined in $(1), setting the
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 74e9100..9cc32c3 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -191,6 +191,7 @@
 
 TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
 TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include
+TARGET_OUT_KERNEL_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/kernel-headers
 TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
 TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
 
diff --git a/core/java_library.mk b/core/java_library.mk
index 904ef5f..06cdfc4 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -92,6 +92,7 @@
 $(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
 	@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
 	$(hide) rm -f $@
+	@mkdir -p $(dir $@)
 	$(call dexpreopt-one-file,$<,$@)
 
 $(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(AAPT)
diff --git a/core/main.mk b/core/main.mk
index 5604df2..ab9d52d 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -183,7 +183,7 @@
 # Bring in dex_preopt.mk
 include $(BUILD_SYSTEM)/dex_preopt.mk
 
-ifneq ($(filter eng user userdebug tests,$(MAKECMDGOALS)),)
+ifneq ($(filter eng user userdebug,$(MAKECMDGOALS)),)
 $(info ***************************************************************)
 $(info ***************************************************************)
 $(info Don't pass '$(filter eng user userdebug tests,$(MAKECMDGOALS))' on \
@@ -209,12 +209,12 @@
 
 # -----------------------------------------------------------------
 # The pdk (Platform Development Kit) build
-# pdk1 : for building binary blob necessary for pdk2 build
-# pdk2 : HAL build for chipset vendors
+# pdk_eng : for building binary blob necessary for pdk_rel build
+# pdk_rel : HAL build for chipset vendors
 
-PDK_BUILD_TYPE:= $(filter pdk1 pdk2,$(MAKECMDGOALS))
+PDK_BUILD_TYPE:= $(filter pdk_eng pdk_rel,$(MAKECMDGOALS))
 ifeq (2,$(words $(PDK_BUILD_TYPE)))
-  $(error You can't build pdk1 and pdk2 in the same run.)
+  $(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))
@@ -222,15 +222,15 @@
   include pdk/build/pdk.mk
   # force droid target
   MAKECMDGOALS:= $(subst $(PDK_BUILD_TYPE),droid,$(MAKECMDGOALS))
-ifeq ($(PDK_BUILD_TYPE), pdk1)
-  .PHONY: pdk1
-  pdk1: droid pdk_bin_zip
+ifeq ($(PDK_BUILD_TYPE), pdk_eng)
+  .PHONY: pdk_eng
+  pdk_eng: droid pdk_bin_zip
 
-else  # pdk2
-  .PHONY: pdk2
-  pdk2: droid
+else  # pdk_rel
+  .PHONY: pdk_rel
+  pdk_rel: droid
 
-endif # pdk2
+endif # pdk_rel
 endif # PDK_BUILD_TYPE
 # -----------------------------------------------------------------
 ###
@@ -797,8 +797,7 @@
 endif # droid in $(MAKECMDGOALS)
 
 
-.PHONY: droid tests
-tests: droidcore
+.PHONY: droid
 
 # phony target that include any targets in $(ALL_MODULES)
 .PHONY: all_modules
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 041a7b0..235f775 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -51,6 +51,10 @@
     opengl-tests-includes:frameworks/native/opengl/tests/include \
     recovery:bootable/recovery \
     system-core:system/core/include \
+    audio-effects:system/media/audio_effects/include \
+    audio-utils:system/media/audio_utils/include \
+    wilhelm:system/media/wilhelm/include \
+    wilhelm-ut:system/media/wilhelm/src/ut \
     speex:external/speex/include
 
 #
diff --git a/core/product.mk b/core/product.mk
index 23dc375..b001ca2 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -86,6 +86,7 @@
     PRODUCT_DEFAULT_DEV_CERTIFICATE \
     PRODUCT_RESTRICT_VENDOR_FILES \
     PRODUCT_FACTORY_RAMDISK_MODULES \
+    PRODUCT_VENDOR_KERNEL_HEADERS \
 
 
 define dump-product
@@ -201,6 +202,9 @@
 	TARGET_ARCH_VARIANT \
 	TARGET_BOARD_PLATFORM \
 	TARGET_BOARD_PLATFORM_GPU \
+	TARGET_BOARD_KERNEL_HEADERS \
+	TARGET_DEVICE_KERNEL_HEADERS \
+	TARGET_PRODUCT_KERNEL_HEADERS \
 	TARGET_BOOTLOADER_BOARD_NAME \
 	TARGET_COMPRESS_MODULE_SYMBOLS \
 	TARGET_NO_BOOTLOADER \
diff --git a/core/product_config.mk b/core/product_config.mk
index c455723..ea3e517 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -306,6 +306,10 @@
 # An list of whitespace-separated words.
 PRODUCT_TAGS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_TAGS))
 
+# The list of product-specific kernel header dirs
+PRODUCT_VENDOR_KERNEL_HEADERS := \
+    $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_KERNEL_HEADERS)
+
 # Add the product-defined properties to the build properties.
 ADDITIONAL_BUILD_PROPERTIES := \
     $(ADDITIONAL_BUILD_PROPERTIES) \
diff --git a/core/tasks/factory_ramdisk.mk b/core/tasks/factory_ramdisk.mk
index ecfc4d0..6757194 100644
--- a/core/tasks/factory_ramdisk.mk
+++ b/core/tasks/factory_ramdisk.mk
@@ -60,14 +60,22 @@
 
 ifneq (,$(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES)$(INTERNAL_FACTORY_RAMDISK_FILES))
 
+BUILT_FACTORY_RAMDISK_FS := $(PRODUCT_OUT)/factory_ramdisk.gz
 BUILT_FACTORY_RAMDISK_TARGET := $(PRODUCT_OUT)/factory_ramdisk.img
 
-INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET)
-$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTFS) \
+INSTALLED_FACTORY_RAMDISK_FS := $(BUILT_FACTORY_RAMDISK_FS)
+$(INSTALLED_FACTORY_RAMDISK_FS) : $(MKBOOTFS) \
     $(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES) $(INTERNAL_FACTORY_RAMDISK_FILES) | $(MINIGZIP)
-	$(call pretty,"Target factory ram disk: $@")
+	$(call pretty,"Target factory ram disk file system: $@")
 	$(hide) $(MKBOOTFS) $(TARGET_FACTORY_RAMDISK_OUT) | $(MINIGZIP) > $@
 
+TARGET_RAMDISK_KERNEL := $(INSTALLED_KERNEL_TARGET)
+INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET)
+$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTIMG) $(TARGET_RAMDISK_KERNEL) $(INSTALLED_FACTORY_RAMDISK_FS)
+	$(call pretty,"Target factory ram disk img format: $@")
+	$(MKBOOTIMG) --kernel $(TARGET_RAMDISK_KERNEL) --ramdisk $(INSTALLED_FACTORY_RAMDISK_FS) \
+            --base $(BOARD_KERNEL_BASE) --output $@
+
 endif
 
 endif # ONE_SHOT_MAKEFILE
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 6f3bf91..7d94ee0 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -36,6 +36,7 @@
 board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
 endif
 $(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt)
+	$(hide) build/tools/check_radio_versions.py $< $(BOARD_INFO_CHECK)
 	$(call pretty,"Generated: ($@)")
 ifdef board_info_txt
 	$(hide) grep -v '#' $< > $@
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index ee8e273..ca18365 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -26,6 +26,7 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
 
 PRODUCT_PACKAGES := \
     audio.primary.goldfish \
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index 0dd2bc0..3a1d2f0 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -26,3 +26,4 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk
index 07ebb1c..a650ed6 100644
--- a/target/board/vbox_x86/device.mk
+++ b/target/board/vbox_x86/device.mk
@@ -30,6 +30,7 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
     build/target/board/vbox_x86/init.rc:root/init.rc \
     build/target/board/vbox_x86/init.vbox_x86.rc:root/init.vbox_x86.rc \
     $(LOCAL_KERNEL):kernel
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index b7c9b32..2a65adf 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -62,6 +62,9 @@
     local_time.default \
     power.default
 
+PRODUCT_PACKAGES += \
+    local_time.default
+
 PRODUCT_COPY_FILES := \
         system/bluetooth/data/audio.conf:system/etc/bluetooth/audio.conf \
         system/bluetooth/data/auto_pairing.conf:system/etc/bluetooth/auto_pairing.conf \
diff --git a/tools/adbs b/tools/adbs
index b571d48..1a400f7 100755
--- a/tools/adbs
+++ b/tools/adbs
@@ -137,11 +137,7 @@
 
   uname = os.uname()[0]
   if uname == "Darwin":
-    proc = os.uname()[-1]
-    if proc == "i386":
-      uname = "darwin-x86"
-    else:
-      uname = "darwin-ppc"
+    uname = "darwin-x86"
   elif uname == "Linux":
     uname = "linux-x86"
   prefix = "./prebuilt/" + uname + "/toolchain/arm-linux-androideabi-4.4.x/bin/"
diff --git a/tools/check_radio_versions.py b/tools/check_radio_versions.py
new file mode 100755
index 0000000..ebe621f
--- /dev/null
+++ b/tools/check_radio_versions.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import os
+
+try:
+  from hashlib import sha1
+except ImportError:
+  from sha import sha as sha1
+
+if len(sys.argv) < 2:
+  sys.exit(0)
+
+build_info = {}
+f = open(sys.argv[1])
+for line in f:
+  line = line.strip()
+  if line.startswith("require"):
+    key, value = line.split()[1].split("=", 1)
+    build_info[key] = value
+f.close()
+
+bad = False
+
+for item in sys.argv[2:]:
+  key, fn = item.split(":", 1)
+
+  values = build_info.get(key, None)
+  if not values:
+    continue
+  values = values.split("|")
+
+  f = open(fn, "rb")
+  digest = sha1(f.read()).hexdigest()
+  f.close()
+
+  versions = {}
+  try:
+    f = open(fn + ".sha1")
+  except IOError:
+    if not bad: print
+    print "*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key)
+    bad = True
+    continue
+  for line in f:
+    line = line.strip()
+    if not line or line.startswith("#"): continue
+    h, v = line.split()
+    versions[h] = v
+
+  if digest not in versions:
+    if not bad: print
+    print "*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn)
+    bad = True
+    continue
+
+  if versions[digest] not in values:
+    if not bad: print
+    print "*** \"%s\" is version %s; not any %s allowed by \"%s\"." % (
+        fn, versions[digest], key, sys.argv[1])
+    bad = True
+
+if bad:
+  print
+  sys.exit(1)