am d5c217ac: Merge "add phony target "all_modules" and use it as make goal for "mm"/"mmm"" into froyo

Merge commit 'd5c217aca18726f0ed9f2ea034f750620d4bdf7d' into gingerbread

* commit 'd5c217aca18726f0ed9f2ea034f750620d4bdf7d':
  add phony target "all_modules" and use it as make goal for "mm"/"mmm"
diff --git a/buildspec.mk.default b/buildspec.mk.default
index 6303efc..c568a82 100644
--- a/buildspec.mk.default
+++ b/buildspec.mk.default
@@ -115,4 +115,4 @@
 # variable will be changed.  After you have modified this file with the new
 # changes (see buildspec.mk.default), update this to the new value from
 # buildspec.mk.default.
-BUILD_ENV_SEQUENCE_NUMBER := 9
+BUILD_ENV_SEQUENCE_NUMBER := 10
diff --git a/core/Makefile b/core/Makefile
index 852a716..54a596c 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -252,8 +252,23 @@
 
 .PHONY: event-log-tags
 
+# Produce an event logs tag file for everything we know about, in order
+# to properly allocate numbers.  Then produce a file that's filtered
+# for what's going to be installed.
+
+all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
+
+# Include tags from all packages that we know about
+all_event_log_tags_src := \
+    $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
+
+$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src)
+$(all_event_log_tags_file): $(all_event_log_tags_src)
+	$(hide) mkdir -p $(dir $@)
+	$(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
+
+
 event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
-ALL_PREBUILT += $(event_log_tag_file)
 
 # Include tags from all packages included in this product.
 event_log_tags_src := \
@@ -263,14 +278,16 @@
       $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
 
 $(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
-$(event_log_tags_file): $(event_log_tags_src)
+$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
+$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file)
 	$(hide) mkdir -p $(dir $@)
-	$(hide) build/tools/merge-event-log-tags.py -o $@ $(PRIVATE_SRC_FILES)
+	$(hide) build/tools/merge-event-log-tags.py -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
 
 event-log-tags: $(event_log_tags_file)
 
 ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
 
+
 ifneq ($(TARGET_SIMULATOR),true)
 
 # #################################################################
@@ -1074,6 +1091,17 @@
 	$(hide) mkdir -p $(dir $@)
 	$(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
 
+
+#------------------------------------------------------------------
+# A zip of emma code coverage meta files. Generated for fully emma
+# instrumented build.
+#
+EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
+$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
+	@echo "Collecting Emma coverage meta files."
+	$(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
+		zip -@ -q $@
+
 endif	# TARGET_SIMULATOR != true
 
 # -----------------------------------------------------------------
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 0d17c83..f1a2f73 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -222,7 +222,7 @@
 logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
 logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
 
-$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT)/etc/event-log-tags
+$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
 	$(transform-logtags-to-java)
 
 endif
@@ -381,10 +381,7 @@
 
   # link against the jar with full original names (before proguard processing).
   full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar
-
-  # We can't depend on the .jar file, so we depend on something that
-  # depends on the jar file; the final built package file.
-  full_java_lib_deps += $(link_instr_intermediates_dir)/package.apk
+  full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar
 endif
 
 ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
@@ -507,6 +504,10 @@
     $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
 ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
     $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
+ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
+    $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
+
+INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
 
 ###########################################################
 ## Take care of LOCAL_MODULE_TAGS
diff --git a/core/build_id.mk b/core/build_id.mk
index 40bb35d..4b7b0e4 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -23,7 +23,7 @@
 # (like "TC1-RC5").  It must be a single word, and is
 # capitalized by convention.
 #
-BUILD_ID := MASTER
+BUILD_ID := GINGERBREAD
 
 # DISPLAY_BUILD_NUMBER should only be set for development branches,
 # If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 7e68d6f..24a3565 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -181,13 +181,11 @@
 	./$(PRODUCT_OUT)/*.xlb \
 	./$(PRODUCT_OUT)/*.zip \
 	./$(PRODUCT_OUT)/data \
-	./$(PRODUCT_OUT)/obj/lib \
 	./$(PRODUCT_OUT)/obj/APPS \
 	./$(PRODUCT_OUT)/obj/NOTICE_FILES \
 	./$(PRODUCT_OUT)/obj/PACKAGING \
 	./$(PRODUCT_OUT)/recovery \
 	./$(PRODUCT_OUT)/root \
-	./$(PRODUCT_OUT)/symbols/system/lib \
 	./$(PRODUCT_OUT)/system
 
 # The files/dirs to delete during a dataclean, which removes any files
diff --git a/core/cleanspec.mk b/core/cleanspec.mk
index 1da984e..5d399a7 100644
--- a/core/cleanspec.mk
+++ b/core/cleanspec.mk
@@ -22,7 +22,7 @@
 # IDEALLY, THOSE STEPS SHOULD BE DONE ATOMICALLY.
 # **********************************************************************
 #
-INTERNAL_CLEAN_BUILD_VERSION := 3
+INTERNAL_CLEAN_BUILD_VERSION := 5
 #
 # ***********************************************************************
 # Do not touch INTERNAL_CLEAN_BUILD_VERSION if you've added a clean step!
@@ -58,129 +58,6 @@
 #$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
 #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
 #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.google.android.datamessaging_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sholes/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/pvasflocal.cfg)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sholes)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/ringtones/Silence.ogg)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/media/audio/ringtones/notifications/Silence.ogg)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/passion/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.google.android.datamessaging_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sholes/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/bugreport)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvm_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/obj/target/common/obj/APPS/VoiceSearch_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/VoiceSearch_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libgps-rpc_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/pdsm_atl_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libgps_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/system/app/Launcher.apk)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/bluetooth/)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sholes/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/com.amazon.mp3_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/com.amazon.mp3.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libv8_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libjs_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libv8_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/os/IDropBoxService.java)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/GoogleSubscribedFeedsProvider.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libmediaplayerservice_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/GoogleServicesFramework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/VoiceSearchWithKeyboard.apk)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/vendor/google_voiceime)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/QuickSearchBox.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvm_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/EnhancedGoogleSearchProvider.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/GoogleCheckin.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libdvm*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libgtest_main_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libgtest_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/Music*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Music*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/Music*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Music*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Launcher.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/AlarmClock.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Calendar.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/DeskClock.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Email.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Facebook.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Gallery3D.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Maps.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/MyFaves.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/googlevoice.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/kickback.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/soundback.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/talkback.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/Launcher*)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Launcher*.apk)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/Music*)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Music*)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/jsr305_intermediates)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/guava_intermediates)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/*)
-$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 75297bc..f311a70 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -51,6 +51,7 @@
 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
 LOCAL_PREBUILT_STRIP_COMMENTS:=
 LOCAL_INTERMEDIATE_SOURCES:=
+LOCAL_INTERMEDIATE_SOURCE_DIR:=
 LOCAL_JAVACFLAGS:=
 LOCAL_JAVA_LIBRARIES:=
 LOCAL_NO_STANDARD_LIBRARIES:=
@@ -93,6 +94,7 @@
 LOCAL_NO_EMMA_COMPILE:=
 LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom
 LOCAL_PROGUARD_FLAGS:=
+LOCAL_EMMA_COVERAGE_FILTER:=
 
 # 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_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index bbd78ba..306ba1a 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -17,6 +17,13 @@
 # Configuration for Darwin (Mac OS X) on x86.
 # Included by combo/select.mk
 
+# We build everything in 32-bit, because some host tools are
+# 32-bit-only anyway (emulator, acc), and because it gives us
+# more consistency between the host tools and the target.
+HOST_GLOBAL_CFLAGS += -m32
+HOST_GLOBAL_LDFLAGS += -m32
+
+
 HOST_GLOBAL_CFLAGS += -fPIC
 HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
 
@@ -38,6 +45,7 @@
     $(HOST_CXX) \
         -dynamiclib -single_module -read_only_relocs suppress \
         $(HOST_GLOBAL_LD_DIRS) \
+        $(HOST_GLOBAL_LDFLAGS) \
         $(PRIVATE_ALL_OBJECTS) \
         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
         $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
@@ -53,6 +61,7 @@
         -o $@ \
         -Wl,-dynamic -headerpad_max_install_names \
         $(HOST_GLOBAL_LD_DIRS) \
+        $(HOST_GLOBAL_LDFLAGS) \
         $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
         $(PRIVATE_ALL_OBJECTS) \
         $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index df6770e..ae1997c 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -44,7 +44,7 @@
 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
 ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
 TARGET_TOOLS_PREFIX := \
-	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
+	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
 endif
 
 TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
@@ -97,12 +97,25 @@
 			-ffunction-sections \
 			-funwind-tables \
 			-fstack-protector \
+			-Wa,--noexecstack \
+			-Werror=format-security \
 			-fno-short-enums \
 			$(arch_variant_cflags) \
 			-include $(android_config_h) \
 			-I $(arch_include_dir)
 
+# This is to avoid the dreaded warning compiler message:
+#   note: the mangling of 'va_list' has changed in GCC 4.4
+#
+# The fact that the mangling changed does not affect the NDK ABI
+# very fortunately (since none of the exposed APIs used va_list
+# in their exported C++ functions). Also, GCC 4.5 has already
+# removed the warning from the compiler.
+#
+TARGET_GLOBAL_CFLAGS += -Wno-psabi
+
 TARGET_GLOBAL_LDFLAGS += \
+			-Wl,-z,noexecstack \
 			$(arch_variant_ldflags)
 
 # We only need thumb interworking in cases where thumb support
@@ -198,6 +211,9 @@
 TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
 TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
 
+TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
+TARGET_CRTEND_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
+
 TARGET_STRIP_MODULE:=true
 
 TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
@@ -216,16 +232,18 @@
 	-Wl,-shared,-Bsymbolic \
 	$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
 	$(PRIVATE_ALL_OBJECTS) \
+	$(PRIVATE_TARGET_CRTBEGIN_SO_O) \
 	-Wl,--whole-archive \
 	$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
 	-Wl,--no-whole-archive \
 	$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
 	$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
 	-o $@ \
-	$(PRIVATE_LDFLAGS) \
 	$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+	$(PRIVATE_LDFLAGS) \
 	$(PRIVATE_TARGET_FDO_LIB) \
-	$(PRIVATE_TARGET_LIBGCC)
+	$(PRIVATE_TARGET_LIBGCC) \
+	$(PRIVATE_TARGET_CRTEND_SO_O)
 endef
 
 define transform-o-to-executable-inner
@@ -240,8 +258,8 @@
 	$(TARGET_CRTBEGIN_DYNAMIC_O) \
 	$(PRIVATE_ALL_OBJECTS) \
 	$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
-	$(PRIVATE_LDFLAGS) \
 	$(TARGET_GLOBAL_LDFLAGS) \
+	$(PRIVATE_LDFLAGS) \
 	$(TARGET_FDO_LIB) \
 	$(TARGET_LIBGCC) \
 	$(TARGET_CRTEND_O)
@@ -253,8 +271,8 @@
 	-o $@ \
 	$(TARGET_GLOBAL_LD_DIRS) \
 	$(TARGET_CRTBEGIN_STATIC_O) \
-	$(PRIVATE_LDFLAGS) \
 	$(TARGET_GLOBAL_LDFLAGS) \
+	$(PRIVATE_LDFLAGS) \
 	$(PRIVATE_ALL_OBJECTS) \
 	$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
 	$(TARGET_FDO_LIB) \
diff --git a/core/config.mk b/core/config.mk
index 20be691..81842be 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -31,6 +31,7 @@
 	$(TOPDIR)dalvik/libnativehelper/include \
 	$(TOPDIR)frameworks/base/include \
 	$(TOPDIR)frameworks/base/opengl/include \
+    $(TOPDIR)frameworks/base/native/include \
 	$(TOPDIR)external/skia/include
 SRC_HOST_HEADERS:=$(TOPDIR)tools/include
 SRC_LIBRARIES:= $(TOPDIR)libs
@@ -209,7 +210,7 @@
 MKTARBALL := build/tools/mktarball.sh
 TUNE2FS := tune2fs
 E2FSCK := e2fsck
-JARJAR := java -jar $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
+JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
 PROGUARD := external/proguard/bin/proguard.sh
 JAVATAGS := build/tools/java-event-log-tags.py
 
diff --git a/core/definitions.mk b/core/definitions.mk
index 0faef02..ae0d9f3 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -949,7 +949,7 @@
 
 define extract-and-include-target-whole-static-libs
 $(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
-	@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
+	$(hide) echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(lib)]"; \
 	ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(lib)))_objs;\
 	rm -rf $$ldir; \
 	mkdir -p $$ldir; \
@@ -969,7 +969,8 @@
 @rm -f $@
 $(extract-and-include-target-whole-static-libs)
 @echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
-$(hide) echo $^ | xargs $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
+$(hide) echo $(filter %.o, $^) | \
+    xargs $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@
 endef
 
 ###########################################################
@@ -1325,7 +1326,8 @@
 
 define transform-classes.jar-to-emma
 $(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
-    $(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR)
+    $(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR) \
+    $(addprefix -ix , $(PRIVATE_EMMA_COVERAGE_FILTER))
 endef
 
 #TODO: use a smaller -Xmx value for most libraries;
@@ -1383,12 +1385,10 @@
     -F $@
 endef
 
-#TODO: Allow library directory to be specified based on the target
-#      CPU and ABI instead of being hard coded as armeabi.
 define add-jni-shared-libs-to-package
 $(hide) rm -rf $(dir $@)lib
-$(hide) mkdir -p $(dir $@)lib/armeabi
-$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/armeabi
+$(hide) mkdir -p $(dir $@)lib/$(TARGET_CPU_ABI)
+$(hide) cp $(PRIVATE_JNI_SHARED_LIBRARIES) $(dir $@)lib/$(TARGET_CPU_ABI)
 $(hide) (cd $(dir $@) && zip -r $(notdir $@) lib)
 $(hide) rm -rf $(dir $@)lib
 endef
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 03ffa55..ba4857b 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -57,6 +57,13 @@
 $(full_target): PRIVATE_CLASSPATH:=$(LOCAL_CLASSPATH)
 full_java_lib_deps :=
 
+$(full_target): PRIVATE_BOOTCLASSPATH :=
+ifeq ($(BUILD_OS),linux)
+# You have to set bootclasspath for javadoc manually on linux since Java 6.
+host_jdk_rt_jar := $(dir $(HOST_JDK_TOOLS_JAR))../jre/lib/rt.jar
+$(full_target): PRIVATE_BOOTCLASSPATH := $(host_jdk_rt_jar)
+endif
+
 ifneq ($(LOCAL_IS_HOST_MODULE),true)
 
 ifeq ($(LOCAL_JAVA_LIBRARIES),)
@@ -165,6 +172,7 @@
                 -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
                 -templatedir $(PRIVATE_TEMPLATE_DIR) \
                 $(PRIVATE_DROIDDOC_HTML_DIR) \
+                $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
                 $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
                 -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
                 -d $(PRIVATE_OUT_DIR) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 86aa2f3..48a8743 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -16,7 +16,7 @@
 # people who haven't re-run those will have to do so before they
 # can build.  Make sure to also update the corresponding value in
 # buildspec.mk.default and envsetup.sh.
-CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 9
+CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
 
 # ---------------------------------------------------------------
 # The product defaults to generic on hardware and sim on sim
@@ -284,7 +284,7 @@
 	ABP:=$(ABP):$(TARGET_OUT_EXECUTABLES)
 else
 	# this should be copied to HOST_OUT_EXECUTABLES instead
-	ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.0/bin
+	ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.4.3/bin
 endif
 ANDROID_BUILD_PATHS := $(ABP)
 ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
diff --git a/core/java.mk b/core/java.mk
index baa83ee..9f7715b 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -63,17 +63,21 @@
 # Choose leaf name for the compiled jar file.
 ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
 full_classes_compiled_jar_leaf := classes-no-debug-var.jar
+built_dex_leaf := classes-no-local.dex
 else
 full_classes_compiled_jar_leaf := classes-full-debug.jar
+built_dex_leaf := classes-with-local.dex
 endif
 full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
+built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_leaf)
 
+jarjar_leaf := classes-jarjar.jar
+full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
 emma_intermediates_dir := $(intermediates.COMMON)/emma_out
-# the 'lib/$(full_classes_compiled_jar_leaf)' portion of this path is fixed in
-# the emma tool
-full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(full_classes_compiled_jar_leaf)
+# emma is hardcoded to use the leaf name of its input for the output file --
+# only the output directory can be changed
+full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
 full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
-full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
 full_classes_full_names_jar := $(intermediates.COMMON)/classes-full-names.jar
 full_classes_proguard_jar := $(full_classes_jar)
 built_dex := $(intermediates.COMMON)/classes.dex
@@ -85,8 +89,10 @@
     $(full_classes_full_names_jar) \
     $(full_classes_stubs_jar) \
     $(full_classes_jarjar_jar) \
-    $(built_dex)
+    $(built_dex) \
+    $(built_dex_intermediate)
 
+LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
 
 # TODO: It looks like the only thing we need from base_rules is
 # all_java_sources.  See if we can get that by adding a
@@ -104,7 +110,7 @@
 $(LOCAL_INTERMEDIATE_TARGETS): \
 	PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
 $(LOCAL_INTERMEDIATE_TARGETS): \
-	PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
+	PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
 
 # Since we're using intermediates.COMMON, make sure that it gets cleaned
 # properly.
@@ -154,17 +160,18 @@
 # be done after the inclusion of base_rules.mk.
 ALL_MODULES.$(LOCAL_MODULE).CHECKED := $(full_classes_compiled_jar)
 
-ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
-# If you instrument class files that have local variable debug information in
-# them emma does not correctly maintain the local variable table.
-# This will cause an error when you try to convert the class files for Android.
-# The workaround for this to compile the java classes with only
-# line and source debug information, not local information.
-$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g:{lines,source}
-else
-# when emma is off, compile with the default flags, which contain full debug
-# info
 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
+
+# Run jarjar if necessary, otherwise just copy the file.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(JARJAR)
+	@echo JarJar: $@
+	$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
+	@echo Copying: $@
+	$(hide) $(ACP) $< $@
 endif
 
 ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
@@ -176,30 +183,27 @@
 ifneq ($(LOCAL_NO_EMMA_INSTRUMENT),true)
 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
+# module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER
+# in Android.mk
+ifdef LOCAL_EMMA_COVERAGE_FILTER
+$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
+else
+# by default, avoid applying emma instrumentation onto emma classes itself,
+# otherwise there will be exceptions thrown
+$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
+endif
 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
 # $(full_classes_emma_jar)
-$(full_classes_emma_jar): $(full_classes_compiled_jar) | $(EMMA_JAR)
+$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR)
 	$(transform-classes.jar-to-emma)
 $(PRIVATE_EMMA_COVERAGE_FILE): $(full_classes_emma_jar)
 
 # tell proguard to load emma jar
 LOCAL_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) $(addprefix -libraryjars ,$(EMMA_JAR))
 else
-$(full_classes_emma_jar): $(full_classes_compiled_jar) | $(ACP)
-	@echo Copying: $<
-	$(copy-file-to-target)
-endif
-
-# Run jarjar if necessary, otherwise just copy the file.
-ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
-$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_emma_jar) | $(JARJAR)
-	@echo JarJar: $@
-	$(hide) $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
-else
-$(full_classes_jarjar_jar): $(full_classes_emma_jar) | $(ACP)
+$(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP)
 	@echo Copying: $@
-	$(hide) $(ACP) $< $@
+	$(copy-file-to-target)
 endif
 
 # Keep a copy of the jar just before proguard processing.
@@ -252,12 +256,25 @@
 
 ALL_MODULES.$(LOCAL_MODULE).PROGUARD_ENABLED:=$(LOCAL_PROGUARD_ENABLED)
 
+# If you instrument class files that have local variable debug information in
+# them emma does not correctly maintain the local variable table.
+# This will cause an error when you try to convert the class files for Android.
+# The workaround here is to build different dex file here based on emma switch
+# then later copy into classes.dex. When emma is on, dx is run with --no-locals
+# option to remove local variable information
+
 # Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
 # will work even when intermediates != intermediates.COMMON.
-$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
-$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_jar) $(DX)
+$(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
+$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
+ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
+$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
+endif
+$(built_dex_intermediate): $(full_classes_jar) $(DX)
 	$(transform-classes.jar-to-dex)
+$(built_dex): $(built_dex_intermediate) | $(ACP)
+	@echo Copying: $@
+	$(hide) $(ACP) $< $@
 ifneq ($(GENERATE_DEX_DEBUG),)
 	$(install-dex-debug)
 endif
diff --git a/core/main.mk b/core/main.mk
index 11f234e..3cab933 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -35,7 +35,7 @@
 $(warning ********************************************************************************)
 $(warning *  You are using version $(MAKE_VERSION) of make.)
 $(warning *  You must upgrade to version 3.81 or greater.)
-$(warning *  see file://$(shell pwd)/docs/development-environment/machine-setup.html)
+$(warning *  see http://source.android.com/download)
 $(warning ********************************************************************************)
 $(error stopping)
 endif
@@ -50,6 +50,10 @@
 DEFAULT_GOAL := droid
 $(DEFAULT_GOAL):
 
+# Used to force goals to build.  Only use for conditionally defined goals.
+.PHONY: FORCE
+FORCE:
+
 # Set up various standard variables based on configuration
 # and host information.
 include $(BUILD_SYSTEM)/config.mk
@@ -60,12 +64,23 @@
 # be generated correctly
 include $(BUILD_SYSTEM)/cleanbuild.mk
 
-VERSION_CHECK_SEQUENCE_NUMBER := 1
+VERSION_CHECK_SEQUENCE_NUMBER := 2
 -include $(OUT_DIR)/versions_checked.mk
 ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
 
 $(info Checking build tools versions...)
 
+ifeq ($(BUILD_OS),linux)
+build_arch := $(shell uname -m)
+ifneq (64,$(findstring 64,$(build_arch)))
+$(warning ************************************************************)
+$(warning You are attempting to build on a 32-bit system.)
+$(warning Only 64-bit build environments are supported now.)
+$(warning ************************************************************)
+$(error stop)
+endif
+endif
+
 ifneq ($(HOST_OS),windows)
 ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
 # check for a case sensitive file system
@@ -98,18 +113,15 @@
 endif
 
 
-# The windows build server currently uses 1.6.  This will be fixed.
-ifneq ($(HOST_OS),windows)
-
 # Check for the correct version of java
-java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
+java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
 ifeq ($(strip $(java_version)),)
 $(info ************************************************************)
 $(info You are attempting to build with the incorrect version)
 $(info of java.)
 $(info $(space))
 $(info Your version is: $(shell java -version 2>&1 | head -n 1).)
-$(info The correct version is: 1.5.)
+$(info The correct version is: 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)http://source.android.com/download)
@@ -118,14 +130,14 @@
 endif
 
 # Check for the correct version of javac
-javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]')
+javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
 ifeq ($(strip $(javac_version)),)
 $(info ************************************************************)
 $(info You are attempting to build with the incorrect version)
 $(info of javac.)
 $(info $(space))
 $(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
-$(info The correct version is: 1.5.)
+$(info The correct version is: 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
 $(info $(space)$(space)$(space)$(space)http://source.android.com/download)
@@ -133,8 +145,6 @@
 $(error stop)
 endif
 
-endif # windows
-
 $(shell echo 'VERSIONS_CHECKED := $(VERSION_CHECK_SEQUENCE_NUMBER)' \
         > $(OUT_DIR)/versions_checked.mk)
 endif
@@ -267,11 +277,6 @@
 else # !sdk
 endif
 
-# build the full stagefright library
-ifneq ($(strip BUILD_WITH_FULL_STAGEFRIGHT),)
-BUILD_WITH_FULL_STAGEFRIGHT := true
-endif
-
 ## precise GC ##
 
 ifneq ($(filter dalvik.gc.type-precise,$(PRODUCT_TAGS)),)
@@ -353,18 +358,21 @@
 # Bring in all modules that need to be built.
 ifneq ($(dont_bother),true)
 
-ifeq ($(HOST_OS),windows)
-SDK_ONLY := true
-endif
 ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
 SDK_ONLY := true
+$(info Building the SDK under darwin-ppc is actually obsolete and unsupported.)
+$(error stop)
+endif
+
+ifeq ($(HOST_OS),windows)
+SDK_ONLY := true
 endif
 
 ifeq ($(SDK_ONLY),true)
 
 # ----- SDK for Windows ------
-# These configure the build targets that are available for the SDK under Cygwin.
-# The first section defines all the C/C++ tools that can be compiled under Cygwin,
+# These configure the build targets that are available for the SDK under Windows.
+# The first section defines all the C/C++ tools that can be compiled in C/C++,
 # the second section defines all the Java ones (assuming javac is available.)
 
 subdirs := \
@@ -385,10 +393,7 @@
 	external/qemu \
 	external/sqlite/dist \
 	external/zlib \
-	frameworks/base/libs/utils \
-	frameworks/base/tools/aapt \
-	frameworks/base/tools/aidl \
-	frameworks/base/opengl/libs \
+	frameworks/base \
 	system/core/adb \
 	system/core/fastboot \
 	system/core/libcutils \
@@ -398,11 +403,10 @@
 # The following can only be built if "javac" is available.
 # This check is used when building parts of the SDK under Cygwin.
 ifneq (,$(shell which javac 2>/dev/null))
-$(warning sdk-only: javac available.)
 subdirs += \
 	build/tools/signapk \
 	dalvik/dx \
-	dalvik/libcore \
+	libcore \
 	sdk/archquery \
 	sdk/androidprefs \
 	sdk/apkbuilder \
@@ -415,10 +419,9 @@
 	sdk/layoutopt \
 	development/apps \
 	development/tools/mkstubs \
-	frameworks/base/tools/layoutlib \
 	packages
 else
-$(warning sdk-only: javac not available.)
+$(warning SDK_ONLY: javac not available.)
 endif
 
 # Exclude tools/acp when cross-compiling windows under linux
@@ -687,6 +690,10 @@
 	$(INSTALLED_USERDATAIMAGE_TARGET) \
 	$(INSTALLED_FILES_FILE)
 
+ifeq ($(EMMA_INSTRUMENT),true)
+  $(call dist-for-goals, droid, $(EMMA_META_ZIP))
+endif
+
 # dist_libraries only for putting your library into the dist directory with a full build.
 .PHONY: dist_libraries
 
@@ -723,6 +730,7 @@
     $(INSTALLED_BUILD_PROP_TARGET) \
     $(BUILT_TARGET_FILES_PACKAGE) \
     $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
+    $(INSTALLED_RAMDISK_TARGET) \
    )
 
   # Tests are installed in userdata.img.  If we're building the tests
@@ -739,7 +747,7 @@
 # Building a full system-- the default is to build droidcore
 droid: droidcore dist_libraries
 
-endif # TARGET_BUILD_APPS
+endif
 
 
 .PHONY: droid tests
@@ -788,7 +796,7 @@
 modules:
 	@echo "Available sub-modules:"
 	@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
-	      sed -e 's/  */\n/g' | sort -u | $(COLUMN)
+	      tr -s ' ' '\n' | sort -u | $(COLUMN)
 
 .PHONY: showcommands
 showcommands:
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 25de0ea..70441b7 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -37,7 +37,6 @@
     graphics:external/skia/include/core \
     libc:bionic/libc/include \
     libdrm1:frameworks/base/media/libdrm/mobile1/include \
-    libdrm2:frameworks/base/media/libdrm/mobile2/include \
     libhardware:hardware/libhardware/include \
     libhardware_legacy:hardware/libhardware_legacy/include \
     libhost:build/libs/host/include \
diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map
index 22f5f34..7daaf98 100644
--- a/core/prelink-linux-arm.map
+++ b/core/prelink-linux-arm.map
@@ -16,6 +16,11 @@
 #     [<64K] observed to be less than 64K
 #     [~1M] rounded up, one megabyte (similarly for other sizes)
 #     [???] no size observed, assumed to be one megabyte
+#
+# note: look at the LOAD sections in the library header:
+#
+#   arm-eabi-objdump -x <lib>
+#
 
 # core system libraries
 libdl.so                0xAFF00000 # [<64K]
@@ -77,18 +82,19 @@
 libexif.so              0xABB00000 # [~1M]
 libcamera_client.so     0xABA80000 # [~1M]
 libui.so                0xAB900000 # [~1M]
-# libsgl is for backward-compatibility with donut
-libsgl.so               0xAB800000 # [???]
-libskia.so              0xAB100000 # [~7M]
+libgui.so               0xAB800000 # [~1M]
+libskia.so              0xAB100000 # [~2M]
 librs_jni.so            0xAB000000 # [~1M]
 libRS.so                0xA9E00000 # [~2M]
+libandroid.so           0xA9D80000 # [<64K]
 libjnigraphics.so       0xA9D00000 # [<64K]
 libskiagl.so            0xA9C00000 # [~1M]
 
 # audio
 libFLAC.so              0xA9B00000 # [???]
 libaudiopolicy.so       0xA9A00000 # [~1M]
-libaudiopolicygeneric.so 0xA9900000 # [???]
+libeffects.so           0xA9980000 # [<64K]
+libaudioeffect_jni.so   0xA9900000 # [<64K]
 libsoundpool.so         0xA9800000 # [~1M]
 libaudio.so             0xA9700000 # [~1M]
 libspeech.so            0xA9600000 # [~1M]
diff --git a/core/product.mk b/core/product.mk
index 38d1148..7594f6f 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -70,7 +70,6 @@
     PRODUCT_PROPERTY_OVERRIDES \
     PRODUCT_COPY_FILES \
     PRODUCT_OTA_PUBLIC_KEYS \
-    PRODUCT_POLICY \
     PRODUCT_PACKAGE_OVERLAYS \
     DEVICE_PACKAGE_OVERLAYS \
     PRODUCT_CONTRIBUTORS_FILE \
diff --git a/core/product_config.mk b/core/product_config.mk
index 04f6ce1..50bc7bc 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -252,9 +252,6 @@
 PRODUCT_DEFAULT_WIFI_CHANNELS := \
 	$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEFAULT_WIFI_CHANNELS))
 
-# Which policy should this product use
-PRODUCT_POLICY := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_POLICY))
-
 # A list of words like <source path>:<destination path>.  The file at
 # the source path should be copied to the destination path when building
 # this product.  <destination path> is relative to $(PRODUCT_OUT), so
diff --git a/core/tasks/ide.mk b/core/tasks/ide.mk
new file mode 100644
index 0000000..e557e60
--- /dev/null
+++ b/core/tasks/ide.mk
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2010 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.
+#
+
+define filter-ide-goals
+$(strip $(filter $(1)-%,$(MAKECMDGOALS)))
+endef
+
+define filter-ide-modules
+$(strip $(subst -,$(space),$(patsubst $(1)-%,%,$(2))))
+endef
+
+# eclipse
+eclipse_project_goals := $(call filter-ide-goals,ECLIPSE)
+ifdef eclipse_project_goals
+  ifneq ($(words $(eclipse_project_goals)),1)
+    $(error Only one ECLIPSE- goal may be specified: $(eclipse_project_goals))
+  endif
+  eclipse_project_modules := $(call filter-ide-modules,ECLIPSE,$(eclipse_project_goals))
+
+  ifneq ($(filter lunch,$(eclipse_project_modules)),)
+    eclipse_project_modules := $(filter-out lunch,$(eclipse_project_modules))
+    installed_modules := $(foreach m,$(ALL_DEFAULT_INSTALLED_MODULES),\
+        $(INSTALLABLE_FILES.$(m).MODULE))
+    java_modules := $(foreach m,$(installed_modules),\
+        $(if $(filter JAVA_LIBRARIES APPS,$(ALL_MODULES.$(m).CLASS)),$(m),))
+    eclipse_project_modules := $(sort $(eclipse_project_modules) $(java_modules))
+  endif
+
+  source_paths := $(foreach m,$(eclipse_project_modules),$(ALL_MODULES.$(m).PATH)) \
+              $(foreach m,$(eclipse_project_modules),$(ALL_MODULES.$(m).INTERMEDIATE_SOURCE_DIR)) \
+              $(INTERNAL_SDK_SOURCE_DIRS)
+  source_paths := $(sort $(source_paths))
+
+.classpath: PRIVATE_MODULES := $(eclipse_project_modules)
+.classpath: PRIVATE_DIRS := $(source_paths)
+
+# the mess below with ./src tries to guess whether the src
+$(eclipse_project_goals): .classpath
+.classpath: FORCE
+	$(hide) echo Generating .classpath for eclipse
+	$(hide) echo '<classpath>' > $@
+	$(hide) for p in $(PRIVATE_DIRS) ; do \
+		echo -n '  <classpathentry kind="src" path="' >> $@ ; \
+		( if [ -d $$p/src ] ; then echo -n $$p/src ; else echo -n $$p ; fi ) >> $@ ; \
+		echo '"/>' >> $@ ; \
+	done
+	$(hide) echo '</classpath>' >> $@
+endif
+
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index ec5dcd4..c17798e 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 := 2.2
+  PLATFORM_VERSION := Gingerbread
 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 := Gingerbread
 endif
 
 ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
diff --git a/envsetup.sh b/envsetup.sh
index 4d5bbc3..e85aab6 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -99,16 +99,28 @@
     if [ -n $ANDROID_BUILD_PATHS ] ; then
         export PATH=${PATH/$ANDROID_BUILD_PATHS/}
     fi
+    if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
+        export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
+    fi
 
     # and in with the new
     CODE_REVIEWS=
     prebuiltdir=$(getprebuilt)
-    export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.0/bin
+    export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
     export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
     export ANDROID_QTOOLS=$T/development/emulator/qtools
     export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
     export PATH=$PATH$ANDROID_BUILD_PATHS
 
+    unset ANDROID_JAVA_TOOLCHAIN
+    if [ -n "$JAVA_HOME" ]; then
+        export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
+    fi
+    export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN
+    if [ -n "$ANDROID_PRE_BUILD_PATHS" ]; then
+        export PATH=$ANDROID_PRE_BUILD_PATHS:$PATH
+    fi
+
     unset ANDROID_PRODUCT_OUT
     export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
     export OUT=$ANDROID_PRODUCT_OUT
@@ -134,6 +146,7 @@
 function set_stuff_for_environment()
 {
     settitle
+    set_java_home
     setpaths
     set_sequence_number
 
@@ -145,7 +158,7 @@
 
 function set_sequence_number()
 {
-    export BUILD_ENV_SEQUENCE_NUMBER=9
+    export BUILD_ENV_SEQUENCE_NUMBER=10
 }
 
 function settitle()
@@ -1058,19 +1071,19 @@
     cd $T/$pathname
 }
 
-# Force JAVA_HOME to point to java 1.5 if it isn't already set
-if [ "$STAY_OFF_MY_LAWN" = "" ]; then
+# Force JAVA_HOME to point to java 1.6 if it isn't already set
+function set_java_home() {
     if [ ! "$JAVA_HOME" ]; then
         case `uname -s` in
             Darwin)
-                export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
+                export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
                 ;;
             *)
-                export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
+                export JAVA_HOME=/usr/lib/jvm/java-6-sun
                 ;;
         esac
     fi
-fi
+}
 
 # determine whether arrays are zero-based (bash) or one-based (zsh)
 _xarray=(a b c)
diff --git a/target/board/emulator/BoardConfig.mk b/target/board/emulator/BoardConfig.mk
index 784118a..9ab607a 100644
--- a/target/board/emulator/BoardConfig.mk
+++ b/target/board/emulator/BoardConfig.mk
@@ -7,3 +7,6 @@
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_KERNEL := true
 HAVE_HTC_AUDIO_DRIVER := true
+
+# no hardware camera
+USE_CAMERA_STUB := true
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 2b72d01..9e52d25 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -9,3 +9,6 @@
 TARGET_CPU_ABI := armeabi
 HAVE_HTC_AUDIO_DRIVER := true
 BOARD_USES_GENERIC_AUDIO := true
+
+# no hardware camera
+USE_CAMERA_STUB := true
diff --git a/target/board/generic_x86/AndroidBoard.mk b/target/board/generic_x86/AndroidBoard.mk
new file mode 100644
index 0000000..ff46149
--- /dev/null
+++ b/target/board/generic_x86/AndroidBoard.mk
@@ -0,0 +1,17 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.rc
+LOCAL_SRC_FILES := init.rc
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+include $(BUILD_PREBUILT)
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel
+else
+LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
+endif
+
+PRODUCT_COPY_FILES += \
+    $(LOCAL_KERNEL):kernel
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
new file mode 100644
index 0000000..608aee1
--- /dev/null
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -0,0 +1,20 @@
+TARGET_COMPRESS_MODULE_SYMBOLS := false
+TARGET_PRELINK_MODULE := false
+TARGET_NO_RECOVERY := true
+TARGET_HARDWARE_3D := false
+BOARD_USES_GENERIC_AUDIO := true
+USE_CAMERA_STUB := true
+TARGET_PROVIDES_INIT_RC := true
+USE_CUSTOM_RUNTIME_HEAP_MAX := "32M"
+TARGET_CPU_ABI := x86
+TARGET_USERIMAGES_USE_EXT2 := true
+TARGET_BOOTIMAGE_USE_EXT2 := true
+
+# For VirtualBox and likely other emulators
+BOARD_INSTALLER_CMDLINE := init=/init console=ttyS0 console=tty0 androidboot.hardware=generic_x86 vga=788 verbose
+BOARD_KERNEL_CMDLINE := init=/init console=tty0 console=ttyS0 androidboot.hardware=generic_x86 vga=788
+TARGET_USE_DISKINSTALLER := true
+TARGET_DISK_LAYOUT_CONFIG := build/target/board/generic_x86/disk_layout.conf
+BOARD_BOOTIMAGE_MAX_SIZE := 8388608
+BOARD_SYSLOADER_MAX_SIZE := 7340032
+BOARD_FLASH_BLOCK_SIZE := 512
diff --git a/target/board/generic_x86/README.txt b/target/board/generic_x86/README.txt
new file mode 100644
index 0000000..97e2d5b
--- /dev/null
+++ b/target/board/generic_x86/README.txt
@@ -0,0 +1,33 @@
+The generic_x86 board target provides basic services on very basic
+hardware (really for an emulation). To build with generic_x86, you will
+need an appropriate kernel for your emulation (or device).
+
+A1. Create a new top level directory and pull the AOSP repository
+        mkdir $HOME/AOSP
+        cd $HOME/AOSP
+        repo init -u git://android.git.kernel.org/platform/manifest.git
+        repo sync
+
+A2. Copy in the buildspeck.mk
+        cd $HOME/AOSP
+        cp build/target/board/generic_x86/buildspec-generic_x86.mk buildspec.mk
+
+A3. Copy in the kernel
+        cd $HOME/AOSP
+        cp ~/bzImage.your_device $HOME/AOSP/prebuilt/android-x86/kernel/kernel
+
+A4. Build
+        cd $HOME/AOSP
+        source build/envsetup.sh
+        lunch generic_x86-eng
+        make -j8
+
+The build will generate some image files whose format may or may not be correct for your
+device. You can build an installer image disk for the VirtualBox emulator using the command:
+
+A5. Build a VirtualBox installer image
+	cd $HOME/AOSP
+        source build/envsetup.sh
+        lunch generic_x86-eng
+        make -j8 installer_vdi
+
diff --git a/target/board/generic_x86/buildspec-generic_x86.mk b/target/board/generic_x86/buildspec-generic_x86.mk
new file mode 100644
index 0000000..fbc3947
--- /dev/null
+++ b/target/board/generic_x86/buildspec-generic_x86.mk
@@ -0,0 +1,7 @@
+BUILD_ENV_SEQUENCE_NUMBER := 9
+DISABLE_DEXPREOPT := true
+TARGET_ARCH := x86
+
+# The eth0 device should be started with dhcp on boot.
+# Useful for emulators that don't provide a wifi connection.
+NET_ETH0_STARTONBOOT := true
diff --git a/target/board/generic_x86/disk_layout.conf b/target/board/generic_x86/disk_layout.conf
new file mode 100644
index 0000000..7b073ee
--- /dev/null
+++ b/target/board/generic_x86/disk_layout.conf
@@ -0,0 +1,54 @@
+device {
+    path /dev/block/sda
+
+    scheme mbr
+
+    # bytes in a disk sector (== 1 LBA), must be a power of 2!
+    sector_size 512
+
+    # What LBA should the partitions start at?
+    start_lba 2048
+
+    # Autodetect disk size if == 0
+    num_lba 0
+
+    partitions {
+        sysloader {
+            active y
+            type linux
+            len 7M
+        }
+
+        recovery {
+            active y
+            type linux
+            len 16M
+        }
+
+        boot {
+            active y
+            type linux
+            len 8M
+        }
+
+        cache {
+            type linux
+            len 512M
+        }
+
+        system {
+            type linux
+            len 512M
+        }
+
+        third_party {
+            type linux
+            len 512M
+        }
+
+        data {
+            type linux
+            len -1
+        }
+    }
+}
diff --git a/target/board/generic_x86/init.rc b/target/board/generic_x86/init.rc
new file mode 100644
index 0000000..235083d
--- /dev/null
+++ b/target/board/generic_x86/init.rc
@@ -0,0 +1,254 @@
+
+on init
+
+sysclktz 0
+
+loglevel 3
+
+# setup the global environment
+    export PATH /sbin:/system/sbin:/system/bin:/system/xbin
+    export LD_LIBRARY_PATH /system/lib
+    export ANDROID_BOOTLOGO 1
+    export ANDROID_ROOT /system
+    export ANDROID_ASSETS /system/app
+    export ANDROID_DATA /data
+    export EXTERNAL_STORAGE /sdcard
+    export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
+
+# Backward compatibility
+    symlink /system/etc /etc
+
+# create mountpoints and mount tmpfs on sqlite_stmt_journals and debugfs on d
+    mkdir /d
+    mkdir /sdcard 0000 system system
+    mkdir /system
+    mkdir /data 0771 system system
+    mkdir /cache 0770 system cache
+    mkdir /sqlite_stmt_journals 01777 root root
+    mount tmpfs tmpfs /sqlite_stmt_journals
+    mount debugfs debugfs /d
+
+    mount rootfs rootfs / rw remount
+
+    write /proc/sys/kernel/panic_on_oops 1
+    write /proc/sys/kernel/hung_task_timeout_secs 0
+    write /proc/cpu/alignment 4
+    write /proc/sys/kernel/sched_latency_ns 10000000
+    write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
+
+# mount mtd partitions
+    # Hack...
+    #   We'll attempt to mount both as sdcard and harddisk...
+    #   Only one or the other will actually work... this way, we can
+    #   use the same init.rc for both
+    mount ext3 /dev/block/mmcblk0p6 /system
+    mount ext3 /dev/block/mmcblk0p6 /system rw remount
+    mount ext3 /dev/block/mmcblk0p2 /data nosuid nodev
+    mount ext3 /dev/block/mmcblk0p7 /cache nosuid nodev
+    mount ext3 /dev/block/sda6 /system
+    mount ext3 /dev/block/sda6 /system rw remount
+    mount ext3 /dev/block/sda8 /data
+
+    # We chown/chmod /data again so because mount is run as root + defaults
+    chown system system /data
+    chmod 0771 /data
+
+    # Same reason as /data above
+    chown system cache /cache
+    chmod 0770 /cache
+
+    # This may have been created by the recovery system with odd permissions
+    chown system system /cache/recovery
+    chmod 0770 /cache/recovery
+
+# create basic filesystem structure
+    mkdir /data/misc 01771 system misc
+    mkdir /data/misc/hcid 0770 bluetooth bluetooth
+    mkdir /data/local 0771 shell shell
+    mkdir /data/local/tmp 0771 shell shell
+    mkdir /data/data 0771 system system
+    mkdir /data/app-private 0771 system system
+    mkdir /data/app 0771 system system
+    mkdir /data/property 0700 root root
+
+    # create dalvik-cache and double-check the perms
+    mkdir /data/dalvik-cache 0771 system system
+    chown system system /data/dalvik-cache
+    chmod 0771 /data/dalvik-cache
+
+    # create the lost+found directories, so as to enforce our permissions
+    mkdir /system/lost+found 0770
+    mkdir /data/lost+found 0770
+    mkdir /cache/lost+found 0770
+
+    # double check the perms, in case lost+found already exists, and set owner
+    chown root root /data/lost+found
+    chmod 0770 /data/lost+found
+    chown root root /cache/lost+found
+    chmod 0770 /cache/lost+found
+
+on boot
+
+### Load some modules
+
+# basic network init
+    ifup lo
+    hostname localhost
+    domainname localdomain
+
+
+# set RLIMIT_NICE to allow priorities from 19 to -20
+    setrlimit 13 40 40
+    mkdir /data/core 0777
+    write /proc/sys/kernel/core_pattern /data/core/%e.%p
+    setrlimit 4 -1 -1
+
+# Define the oom_adj values for the classes of processes that can be
+# killed by the kernel.  These are used in ActivityManagerService.
+    setprop ro.FOREGROUND_APP_ADJ 0
+    setprop ro.VISIBLE_APP_ADJ 1
+    setprop ro.SECONDARY_SERVER_ADJ 2
+    setprop ro.HIDDEN_APP_MIN_ADJ 7
+    setprop ro.CONTENT_PROVIDER_ADJ 14
+    setprop ro.EMPTY_APP_ADJ 15
+    setprop ro.BACKUP_APP_ADJ 2
+    setprop ro.HOME_APP_ADJ 4
+
+
+# Define the memory thresholds at which the above process classes will
+# be killed.  These numbers are in pages (4k).
+    setprop ro.FOREGROUND_APP_MEM 1536
+    setprop ro.VISIBLE_APP_MEM 2048
+    setprop ro.SECONDARY_SERVER_MEM 4096
+    setprop ro.BACKUP_APP_MEM 4096
+    setprop ro.HOME_APP_MEM 4096
+    setprop ro.HIDDEN_APP_MEM 5120
+    setprop ro.CONTENT_PROVIDER_MEM 5632
+    setprop ro.EMPTY_APP_MEM 6144
+
+
+# Write value must be consistent with the above properties.
+    write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
+
+    write /proc/sys/vm/overcommit_memory 1
+    write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,8192,16384
+
+    # Set init its forked children's oom_adj.
+    write /proc/1/oom_adj -16
+
+    # Permissions for System Server and daemons.
+    chown radio system /sys/android_power/state
+    chown radio system /sys/android_power/request_state
+    chown radio system /sys/android_power/acquire_full_wake_lock
+    chown radio system /sys/android_power/acquire_partial_wake_lock
+    chown radio system /sys/android_power/release_wake_lock
+    chown radio system /sys/power/state
+    chown radio system /sys/power/wake_lock
+    chown radio system /sys/power/wake_unlock
+    chmod 0660 /sys/power/state
+    chmod 0660 /sys/power/wake_lock
+    chmod 0660 /sys/power/wake_unlock
+
+    chown system system /sys/class/timed_output/vibrator/enable
+    chown system system /sys/class/leds/keyboard-backlight/brightness
+    chown system system /sys/class/leds/lcd-backlight/brightness
+    chown system system /sys/class/leds/button-backlight/brightness
+    chown system system /sys/class/leds/red/brightness
+    chown system system /sys/class/leds/green/brightness
+    chown system system /sys/class/leds/blue/brightness
+    chown system system /sys/class/leds/red/device/grpfreq
+    chown system system /sys/class/leds/red/device/grppwm
+    chown system system /sys/class/leds/red/device/blink
+    chown system system /sys/class/leds/red/brightness
+    chown system system /sys/class/leds/green/brightness
+    chown system system /sys/class/leds/blue/brightness
+    chown system system /sys/class/leds/red/device/grpfreq
+    chown system system /sys/class/leds/red/device/grppwm
+    chown system system /sys/class/leds/red/device/blink
+    chown system system /sys/class/timed_output/vibrator/enable
+    chown bluetooth bluetooth /sys/module/board_trout/parameters/bluetooth_power_on
+    chown system system /sys/module/sco/parameters/disable_esco
+    chmod 0660 /sys/module/board_trout/parameters/bluetooth_power_on
+    chown radio audio /system/etc/AudioPara4.csv
+    chown system system /sys/kernel/ipv4/tcp_wmem_min
+    chown system system /sys/kernel/ipv4/tcp_wmem_def
+    chown system system /sys/kernel/ipv4/tcp_wmem_max
+    chown system system /sys/kernel/ipv4/tcp_rmem_min
+    chown system system /sys/kernel/ipv4/tcp_rmem_def
+    chown system system /sys/kernel/ipv4/tcp_rmem_max
+    chown root radio /proc/cmdline
+
+# Enable audio based on existing /dev/dsp
+    chmod 0666 /dev/snd/dsp
+
+# Define TCP buffer sizes for various networks
+#   ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
+    setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
+    setprop net.tcp.buffersize.wifi    4095,87380,110208,4096,16384,110208
+    setprop net.tcp.buffersize.umts    4094,87380,110208,4096,16384,110208
+    setprop net.tcp.buffersize.edge    4093,26280,35040,4096,16384,35040
+    setprop net.tcp.buffersize.gprs    4092,8760,11680,4096,8760,11680
+
+    class_start default
+
+
+## Daemon processes to be run by init.
+##
+service console /system/bin/sh
+    console
+
+# adbd is controlled by the persist.service.adb.enable system property
+service adbd /sbin/adbd
+#    disabled
+
+# adbd on at boot in emulator
+on property:ro.kernel.qemu=1
+    start adbd
+
+# adbd on at boot in insecure builds
+on property:ro.secure=0
+    start adbd
+
+on property:persist.service.adb.enable=1
+    start adbd
+
+on property:persist.service.adb.enable=0
+    stop adbd
+
+service servicemanager /system/bin/servicemanager
+    user system
+    critical
+    onrestart restart zygote
+    onrestart restart media
+
+service vold /system/bin/vold
+    socket vold stream 0660 root mount
+
+service zygote /system/bin/app_process -Xzygote -Xint:fast /system/bin --zygote --start-system-server
+    socket zygote stream 666
+    onrestart write /sys/android_power/request_state wake
+
+service media /system/bin/mediaserver
+    user media
+    group system audio camera graphics inet net_bt net_bt_admin
+
+service dbus /system/bin/dbus-daemon --system --nofork
+    socket dbus stream 660 bluetooth bluetooth
+    user bluetooth
+    group bluetooth net_bt_admin
+
+service brick /system/bin/wipe nuke
+    disabled
+
+service installd /system/bin/installd
+    socket installd stream 600 system system
+
+#
+# Set by PRODUCT_PROPERTY_OVERRIDES in <product>.mk
+on property:net.eth0.startonboot=1
+    setprop ro.com.android.dataroaming true
+    start start_eth0
+
+service start_eth0 /system/bin/netcfg eth0 dhcp
+    oneshot
+    disabled
diff --git a/target/board/sim/BoardConfig.mk b/target/board/sim/BoardConfig.mk
index 491b30f..ba25c18 100644
--- a/target/board/sim/BoardConfig.mk
+++ b/target/board/sim/BoardConfig.mk
@@ -20,6 +20,12 @@
 # The simulator does not support native code at all
 TARGET_CPU_ABI := none
 
+# But it is very likely SMP.
+TARGET_CPU_SMP := true
+
 #the simulator partially emulates the original HTC /dev/eac audio interface
 HAVE_HTC_AUDIO_DRIVER := true
 BOARD_USES_GENERIC_AUDIO := true
+
+# no hardware camera
+USE_CAMERA_STUB := true
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 3581da3..9a91da9 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -34,6 +34,7 @@
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/core.mk \
     $(LOCAL_DIR)/generic.mk \
+    $(LOCAL_DIR)/generic_x86.mk \
     $(LOCAL_DIR)/full.mk \
     $(LOCAL_DIR)/sdk.mk \
     $(LOCAL_DIR)/sim.mk
diff --git a/target/product/core.mk b/target/product/core.mk
index a35df85..f87ee46 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -18,8 +18,6 @@
 PRODUCT_DEVICE := generic
 PRODUCT_NAME := core
 
-PRODUCT_POLICY := android.policy_phone
-
 PRODUCT_PROPERTY_OVERRIDES := \
     ro.config.notification_sound=OnTheHunt.ogg \
     ro.config.alarm_alert=Alarm_Classic.ogg
@@ -47,7 +45,4 @@
     Bugreport
 
 PRODUCT_PROPERTY_OVERRIDES += \
-    media.stagefright.enable-player=true \
-    media.stagefright.enable-meta=true   \
-    media.stagefright.enable-scan=true   \
-    media.stagefright.enable-http=true
+    media.stagefright.enable-record=true
diff --git a/target/product/full.mk b/target/product/full.mk
index a86e89d..8725804 100644
--- a/target/product/full.mk
+++ b/target/product/full.mk
@@ -20,7 +20,12 @@
 # in inherited configurations.
 
 PRODUCT_PACKAGES := \
-    VoiceDialer
+    OpenWnn \
+    PinyinIME \
+    VoiceDialer \
+    libWnnEngDic \
+    libWnnJpnDic \
+    libwnndict
 
 # Additional settings used in all AOSP builds
 PRODUCT_PROPERTY_OVERRIDES := \
diff --git a/target/product/generic.mk b/target/product/generic.mk
index f05c441..1f26a75 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -39,6 +39,7 @@
     QuickSearchBox \
     Settings \
     Sync \
+    SystemUI \
     Updater \
     CalendarProvider \
     SyncProvider
diff --git a/target/product/generic_x86.mk b/target/product/generic_x86.mk
new file mode 100644
index 0000000..9713900
--- /dev/null
+++ b/target/product/generic_x86.mk
@@ -0,0 +1,34 @@
+# This is a generic product that isn't specialized for a specific device.
+# It includes the base Android platform. If you need Google-specific features,
+# you should derive from generic_with_google.mk
+
+PRODUCT_PACKAGES := \
+    AlarmClock \
+    AlarmProvider \
+    Calendar \
+    Camera \
+    DrmProvider \
+    LatinIME \
+    Mms \
+    Music \
+    Settings \
+    Sync \
+    Updater \
+    CalendarProvider \
+    SubscribedFeedsProvider \
+    SyncProvider
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic_x86
+PRODUCT_DEVICE := generic_x86
+PRODUCT_NAME := generic_x86
+PRODUCT_POLICY := android.policy_phone
+
+# If running on an emulator or some other device that has a LAN connection
+# that isn't a wifi connection. This will instruct init.rc to enable the
+# network connection so that you can use it with ADB
+ifdef NET_ETH0_STARTONBOOT
+  PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index be41486..b6700b6 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -18,10 +18,10 @@
 
 PRODUCT_PACKAGES := \
 	AccountAndSyncSettings \
-	AlarmClock \
 	Camera \
 	Calculator \
 	CarHome \
+	DeskClock \
 	Development \
 	DrmProvider \
 	Email \
diff --git a/tools/adbs b/tools/adbs
index 815ae10..8277790 100755
--- a/tools/adbs
+++ b/tools/adbs
@@ -144,13 +144,13 @@
       uname = "darwin-ppc"
   elif uname == "Linux":
     uname = "linux-x86"
-  prefix = "./prebuilt/" + uname + "/toolchain/arm-eabi-4.4.0/bin/"
+  prefix = "./prebuilt/" + uname + "/toolchain/arm-eabi-4.4.3/bin/"
   addr2line_cmd = prefix + "arm-eabi-addr2line"
 
   if (not os.path.exists(addr2line_cmd)):
     try:
       prefix = os.environ['ANDROID_BUILD_TOP'] + "/prebuilt/" + uname + \
-               "/toolchain/arm-eabi-4.4.0/bin/"
+               "/toolchain/arm-eabi-4.4.3/bin/"
     except:
       prefix = "";
 
diff --git a/tools/apicheck/etc/apicheck b/tools/apicheck/etc/apicheck
index 9c00e25..5d0480c 100644
--- a/tools/apicheck/etc/apicheck
+++ b/tools/apicheck/etc/apicheck
@@ -38,7 +38,7 @@
 
 javaOpts=""
 while expr "x$1" : 'x-J' >/dev/null; do
-    opt=`expr "$1" : '-J\(.*\)'`
+    opt=`expr "x$1" : 'x-J\(.*\)'`
     javaOpts="${javaOpts} -${opt}"
     shift
 done
diff --git a/tools/atree/fs.cpp b/tools/atree/fs.cpp
index 00f44c2..9971879 100644
--- a/tools/atree/fs.cpp
+++ b/tools/atree/fs.cpp
@@ -108,6 +108,10 @@
 {
     int err;
     size_t pos = 0;
+    // For absolute pathnames, that starts with leading '/'
+    // use appropriate initial value.
+    if (path.length() != 0 and path[0] == '/') pos++;
+
     while (true) {
         pos = path.find('/', pos);
         string p = path.substr(0, pos);
diff --git a/tools/merge-event-log-tags.py b/tools/merge-event-log-tags.py
index df9ebce..bddda90 100755
--- a/tools/merge-event-log-tags.py
+++ b/tools/merge-event-log-tags.py
@@ -36,6 +36,7 @@
 warnings = []
 
 output_file = None
+pre_merged_file = None
 
 # Tags with a tag number of ? are assigned a tag in the range
 # [ASSIGN_START, ASSIGN_LIMIT).
@@ -43,7 +44,7 @@
 ASSIGN_LIMIT = 1000000
 
 try:
-  opts, args = getopt.getopt(sys.argv[1:], "ho:")
+  opts, args = getopt.getopt(sys.argv[1:], "ho:m:")
 except getopt.GetoptError, err:
   print str(err)
   print __doc__
@@ -55,6 +56,8 @@
     sys.exit(2)
   elif o == "-o":
     output_file = a
+  elif o == "-m":
+    pre_merged_file = a
   else:
     print >> sys.stderr, "unhandled option %s" % (o,)
     sys.exit(1)
@@ -71,6 +74,11 @@
 by_tagname = {}
 by_tagnum = {}
 
+pre_merged_tags = {}
+if pre_merged_file:
+  for t in event_log_tags.TagFile(pre_merged_file).tags:
+    pre_merged_tags[t.tagname] = t
+
 for fn in args:
   tagfile = event_log_tags.TagFile(fn)
 
@@ -140,15 +148,26 @@
 # assigned.  We do this based on a hash of the tag name so that the
 # numbers should stay relatively stable as tags are added.
 
+# If we were provided pre-merged tags (w/ the -m option), then don't
+# ever try to allocate one, just fail if we don't have a number
+
 for name, t in sorted(by_tagname.iteritems()):
   if t.tagnum is None:
-    while True:
-      x = (hashname(name) % (ASSIGN_LIMIT - ASSIGN_START - 1)) + ASSIGN_START
-      if x not in by_tagnum:
-        t.tagnum = x
-        by_tagnum[x] = t
-        break
-      name = "_" + name
+    if pre_merged_tags:
+      try:
+        t.tagnum = pre_merged_tags[t.tagname]
+      except KeyError:
+        print >> sys.stderr, ("Error: Tag number not defined for tag `%s'."
+            +" Have you done a full build?") % t.tagname
+        sys.exit(1)
+    else:
+      while True:
+        x = (hashname(name) % (ASSIGN_LIMIT - ASSIGN_START - 1)) + ASSIGN_START
+        if x not in by_tagnum:
+          t.tagnum = x
+          by_tagnum[x] = t
+          break
+        name = "_" + name
 
 # by_tagnum should be complete now; we've assigned numbers to all tags.
 
diff --git a/tools/soslim/main.c b/tools/soslim/main.c
index fa5a315..dd8a60b 100644
--- a/tools/soslim/main.c
+++ b/tools/soslim/main.c
@@ -337,7 +337,7 @@
                             section_name = "(undefined)";
                         }
                         /* value size binding type section symname */
-                        PRINT("%-15s %8d: %08llx %08llx %c%c %5d %n%s%n",
+                        PRINT("%-15s %8zd: %08llx %08llx %c%c %5d %n%s%n",
                               file,
                               index,
                               sym->st_value, sym->st_size, bind, type,
diff --git a/tools/soslim/prelink_info.c b/tools/soslim/prelink_info.c
index 36516b1..81d5de3 100644
--- a/tools/soslim/prelink_info.c
+++ b/tools/soslim/prelink_info.c
@@ -14,13 +14,13 @@
 typedef struct {
 	uint32_t mmap_addr;
 	char tag[4]; /* 'P', 'R', 'E', ' ' */
-} prelink_info_t __attribute__((packed));
+} __attribute__((packed)) prelink_info_t;
 
 static inline void set_prelink(long *prelink_addr, 
 							   int elf_little,
 							   prelink_info_t *info)
 {
-    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %d!\n", sizeof(prelink_info_t));
+    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %zd!\n", sizeof(prelink_info_t));
 	if (prelink_addr) {
 		if (!(elf_little ^ is_host_little())) {
 			/* Same endianness */
@@ -35,11 +35,14 @@
 
 int check_prelinked(const char *fname, int elf_little, long *prelink_addr)
 {
-    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %d!\n", sizeof(prelink_info_t));
+    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %zd!\n", sizeof(prelink_info_t));
 	int fd = open(fname, O_RDONLY);
 	FAILIF(fd < 0, "open(%s, O_RDONLY): %s (%d)!\n",
 		   fname, strerror(errno), errno);
 	off_t end = lseek(fd, 0, SEEK_END);
+#ifndef DEBUG
+	(void)end;
+#endif
 
     int nr = sizeof(prelink_info_t);
 
@@ -50,14 +53,14 @@
 		   fd, strerror(errno), errno);
 
 	prelink_info_t info;
-	int num_read = read(fd, &info, nr);
+	ssize_t num_read = read(fd, &info, nr);
 	FAILIF(num_read < 0, 
 		   "read(%d, &info, sizeof(prelink_info_t)): %s (%d)!\n",
 		   fd, strerror(errno), errno);
-	FAILIF(num_read != sizeof(info),
-		   "read(%d, &info, sizeof(prelink_info_t)): did not read %d bytes as "
-		   "expected (read %d)!\n",
-		   fd, sizeof(info), num_read);
+	FAILIF((size_t)num_read != sizeof(info),
+		   "read(%d, &info, sizeof(prelink_info_t)): did not read %zd bytes as "
+		   "expected (read %zd)!\n",
+		   fd, sizeof(info), (size_t)num_read);
 
 	int prelinked = 0;
 	if (!strncmp(info.tag, "PRE ", 4)) {
@@ -70,7 +73,7 @@
 
 void setup_prelink_info(const char *fname, int elf_little, long base)
 {
-    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %d!\n", sizeof(prelink_info_t));
+    FAILIF(sizeof(prelink_info_t) != 8, "Unexpected sizeof(prelink_info_t) == %zd!\n", sizeof(prelink_info_t));
     int fd = open(fname, O_WRONLY);
     FAILIF(fd < 0, 
            "open(%s, O_WRONLY): %s (%d)\n" ,
@@ -93,13 +96,13 @@
     }
     strncpy(info.tag, "PRE ", 4);
 
-    int num_written = write(fd, &info, sizeof(info));
+    ssize_t num_written = write(fd, &info, sizeof(info));
     FAILIF(num_written < 0, 
            "write(%d, &info, sizeof(info)): %s (%d)\n",
            fd, strerror(errno), errno);
-    FAILIF(sizeof(info) != num_written, 
-           "Could not write %d bytes (wrote only %d bytes) as expected!\n",
-           sizeof(info), num_written);
+    FAILIF(sizeof(info) != (size_t)num_written,
+           "Could not write %zd bytes (wrote only %zd bytes) as expected!\n",
+           sizeof(info), (size_t)num_written);
     FAILIF(close(fd) < 0, "close(%d): %s (%d)!\n", fd, strerror(errno), errno);
 }
 
diff --git a/tools/soslim/soslim.c b/tools/soslim/soslim.c
index d32e247..125e29e 100644
--- a/tools/soslim/soslim.c
+++ b/tools/soslim/soslim.c
@@ -42,7 +42,7 @@
     int dynsym_idx = -1; /* index in shdr_info[] of dynamic symbol table
                             section */
 
-    int cnt;	  /* general-purpose counter */
+    unsigned int cnt;	  /* general-purpose counter */
     /* This flag is true when at least one section is dropped or when the
        relative order of sections has changed, so that section indices in
        the resulting file will be different from those in the original. */
@@ -51,7 +51,7 @@
 	size_t idx;	  /* general-purporse section index */
 
 	shdr_info_t *shdr_info = NULL;
-    int shdr_info_len = 0;
+    unsigned int shdr_info_len = 0;
     GElf_Phdr *phdr_info = NULL;
 
 	/* Get the information from the old file. */
@@ -95,7 +95,7 @@
 
 	/* Get the number of sections. */
 	FAILIF_LIBELF(elf_getshnum (elf, &shnum) < 0, elf_getshnum);
-	INFO("Original ELF file has %d sections.\n", shnum);
+	INFO("Original ELF file has %zd sections.\n", shnum);
 
 	/* Allocate the section-header-info buffer.  We allocate one more entry
        for the section-strings section because we regenerate that one and
@@ -104,7 +104,7 @@
        one more section the header.  We just mark the old section for removal
        and create one as the last section.
     */
-	INFO("Allocating section-header info structure (%d) bytes...\n",
+	INFO("Allocating section-header info structure (%zd) bytes...\n",
 		 shnum*sizeof (shdr_info_t));
     shdr_info_len = rebuild_shstrtab ? shnum + 1 : shnum;
 	shdr_info = (shdr_info_t *)CALLOC(shdr_info_len, sizeof (shdr_info_t));
@@ -305,9 +305,9 @@
 
               /* Check the length of the dynamic-symbol filter. */
               FAILIF(sym_filter != NULL &&
-                     num_symbols != symdata->d_size / elsize,
+                     (size_t)num_symbols != symdata->d_size / elsize,
                      "Length of dynsym filter (%d) must equal the number"
-                     " of dynamic symbols (%d)!\n",
+                     " of dynamic symbols (%zd)!\n",
                      num_symbols,
                      symdata->d_size / elsize);
 
@@ -443,14 +443,14 @@
 			shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0);
 
 			INFO("\tsection [%s]  (old offset %lld, old size %lld) will have index %d "
-				 "(was %d).\n",
+				 "(was %zd).\n",
 				 shdr_info[cnt].name,
 				 shdr_info[cnt].old_shdr.sh_offset,
 				 shdr_info[cnt].old_shdr.sh_size,
 				 shdr_info[cnt].idx,
 				 elf_ndxscn(shdr_info[cnt].scn));
 		} else {
-			INFO("\tIgnoring section [%s] (offset %lld, size %lld, index %d), "
+			INFO("\tIgnoring section [%s] (offset %lld, size %lld, index %zd), "
 				 "it will be discarded.\n",
 				 shdr_info[cnt].name,
 				 shdr_info[cnt].shdr.sh_offset,
diff --git a/tools/soslim/symfilter.c b/tools/soslim/symfilter.c
index c21ab2e..b59e68a 100644
--- a/tools/soslim/symfilter.c
+++ b/tools/soslim/symfilter.c
@@ -38,9 +38,9 @@
            strerror(errno),
            errno);
 
-    INFO("Symbol-filter file %s is %ld bytes long...\n", 
+    INFO("Symbol-filter file %s is %zd bytes long...\n",
          name,
-         fsize);
+         (size_t)fsize);
     filter->fsize = fsize;
 
     /* mmap the symbols file */
@@ -48,8 +48,8 @@
                         PROT_READ | PROT_WRITE, MAP_PRIVATE, 
                         filter->fd, 0);
     FAILIF(MAP_FAILED == filter->mmap, 
-           "mmap(NULL, %ld, PROT_READ, MAP_PRIVATE, %d, 0): %s (%d)\n",
-           fsize,
+           "mmap(NULL, %zd, PROT_READ, MAP_PRIVATE, %d, 0): %s (%d)\n",
+           (size_t)fsize,
            filter->fd,
            strerror(errno),
            errno);
@@ -202,6 +202,8 @@
 
 static int match_hash_table_section(Elf *elf, Elf_Scn *sect, void *data)
 {
+    (void)elf; // unused argument
+
     symfilter_t *filter = (symfilter_t *)data;
     Elf32_Shdr *shdr;
 
@@ -224,6 +226,8 @@
 
 static int match_dynsym_section(Elf *elf, Elf_Scn *sect, void *data)
 {
+    (void)elf; // unused argument
+
     symfilter_t *filter = (symfilter_t *)data;
     Elf32_Shdr *shdr;