am 25863d73: build the sqlite3 binary for use by the OTA tools

* commit '25863d738ca171015a57a2154ff6ebe4ae8f5483':
  build the sqlite3 binary for use by the OTA tools
diff --git a/core/Makefile b/core/Makefile
index de341e2..4c2a4aa 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1086,6 +1086,7 @@
 ifneq ($(TARGET_PRODUCT),sdk)
 ifeq ($(filter generic%,$(TARGET_DEVICE)),)
 ifneq ($(TARGET_NO_KERNEL),true)
+ifneq ($(recovery_fstab),)
 
 # -----------------------------------------------------------------
 # OTA update package
@@ -1138,6 +1139,7 @@
 .PHONY: updatepackage
 updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
 
+endif    # recovery_fstab is defined
 endif    # TARGET_NO_KERNEL != true
 endif    # TARGET_DEVICE != generic*
 endif    # TARGET_PRODUCT != sdk
@@ -1275,7 +1277,7 @@
 
 INTERNAL_EMULATOR_PACKAGE_FILES += \
         $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
-        prebuilt/android-arm/kernel/kernel-qemu \
+        prebuilt/android-$(TARGET_ARCH)/kernel/kernel-qemu \
         $(INSTALLED_RAMDISK_TARGET) \
 		$(INSTALLED_SYSTEMIMAGE) \
 		$(INSTALLED_USERDATAIMAGE_TARGET)
@@ -1341,11 +1343,29 @@
 
 atree_dir := development/build
 
+# sdk/build/tools.atree contains the generic rules, while
+#
+# sdk/build/tools.$(TARGET_ARCH).atree contains target-specific rules
+# the latter is optional.
+#
+sdk_tools_atree_files := sdk/build/tools.atree
+ifneq (,$(strip $(wildcard sdk/build/tools.$(TARGET_ARCH).atree)))
+  sdk_tools_atree_files += sdk/build/tools.$(TARGET_ARCH).atree
+endif
+
 sdk_atree_files := \
 	$(atree_dir)/sdk.exclude.atree \
 	$(atree_dir)/sdk.atree \
 	$(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
-	sdk/build/tools.atree
+	$(sdk_tools_atree_files)
+
+# development/build/sdk-android-<abi>.atree is used to differentiate
+# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
+# files like the kernel image. We use TARGET_CPU_ABI because we don't
+# have a better way to distinguish between CPU models.
+ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
+  sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
+endif
 
 deps := \
 	$(target_notice_file_txt) \
@@ -1359,7 +1379,7 @@
 	$(INSTALLED_BUILD_PROP_TARGET) \
 	$(ATREE_FILES) \
 	$(atree_dir)/sdk.atree \
-	sdk/build/tools.atree \
+	$(sdk_tools_atree_files) \
 	$(HOST_OUT_EXECUTABLES)/atree \
     $(HOST_OUT_EXECUTABLES)/line_endings
 
@@ -1400,9 +1420,12 @@
 			-I $(TARGET_COMMON_OUT_ROOT) \
 			-v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
 			-v "OUT_DIR=$(OUT_DIR)" \
+			-v "TARGET_ARCH=$(TARGET_ARCH)" \
+			-v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
+			-v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
 			-o $(PRIVATE_DIR) && \
 		cp -f $(target_notice_file_txt) \
-				$(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/NOTICE.txt && \
+				$(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/$(TARGET_CPU_ABI)/NOTICE.txt && \
 		cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
 		cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
 		for f in $(PRIVATE_DIR)/platform-tools/llvm-rs-cc-* ; do \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 25564b2..ca0a346 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -194,14 +194,8 @@
 LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
 built_module_path :=
 
-# LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the
-# internal STATIC_LIBRARIES build files.
 LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
-ifdef LOCAL_UNINSTALLABLE_MODULE
-  ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES))
-    $(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE)
-  endif
-else
+ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
   LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
 endif
 
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 3a3a5bd..c332b41 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -47,13 +47,17 @@
 	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-
 endif
 
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(HOST_OUT_EXECUTABLES)/soslim$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip --shady --quiet $< --outfile $@
+# Only define these if there's actually a gcc in there.
+# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
+ifneq ($(wildcard $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)),)
+    TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_STRIP := $(HOST_OUT_EXECUTABLES)/soslim$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip --shady --quiet $< --outfile $@
+endif
 
 TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 412ec69..2d8fbf9 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -38,7 +38,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/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-
+	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-android-linux-4.4.3/bin/i686-android-linux-
 endif
 
 TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
@@ -51,8 +51,7 @@
 
 ifneq ($(wildcard $(TARGET_CC)),)
 TARGET_LIBGCC := \
-	$(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a) \
-        $(shell $(TARGET_CC) -m32 -print-file-name=libgcc_eh.a)
+	$(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a)
 endif
 
 TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -76,23 +75,43 @@
 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
 
 TARGET_GLOBAL_CFLAGS += \
+			-O2 \
 			-Ulinux \
-			-m32 \
+			-Wa,--noexecstack \
+			-Werror=format-security \
+			-Wstrict-aliasing=2 \
 			-fPIC \
+			-ffunction-sections \
+			-finline-functions \
+			-finline-limit=300 \
+			-fno-inline-functions-called-once \
+			-fno-short-enums \
+			-fstrict-aliasing \
+			-funswitch-loops \
+			-funwind-tables \
 			-include $(call select-android-config-h,target_linux-x86)
 
+TARGET_GLOBAL_CFLAGS += -fstack-protector
+
+# Needs to be added for RELEASE
+#TARGET_GLOBAL_CFLAGS += \
+#			-DNDEBUG
+
 TARGET_GLOBAL_CPPFLAGS += \
 			-fno-use-cxa-atexit
 
 ifeq ($(TARGET_ARCH_VARIANT),x86-atom)
-    TARGET_GLOBAL_CFLAGS += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2 -mfpmath=sse -msse2
+    TARGET_GLOBAL_CFLAGS += -march=atom -mstackrealign -DUSE_SSSE3 -DUSE_SSE2 -mfpmath=sse
 else
     TARGET_GLOBAL_CFLAGS += -march=i686
 endif
 
+TARGET_GLOBAL_CFLAGS += -mbionic
 TARGET_GLOBAL_CFLAGS += -D__ANDROID__
-TARGET_GLOBAL_LDFLAGS += -m32
 
+TARGET_GLOBAL_LDFLAGS += -m32
+TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
+TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
 
 TARGET_C_INCLUDES := \
 	$(libc_root)/arch-x86/include \
diff --git a/core/combo/select.mk b/core/combo/select.mk
index c886342..d486255 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -62,13 +62,23 @@
 include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
 
 ifneq ($(USE_CCACHE),)
-  ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
-  # prepend ccache if necessary
-  ifneq ($(ccache),$(firstword $($(combo_target)CC)))
-    $(combo_target)CC := $(ccache) $($(combo_target)CC)
+  CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
+  # If we are cross-compiling Windows binaries on Linux
+  # then use the linux ccache binary instead.
+  ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
+    CCACHE_HOST_TAG := linux-$(BUILD_ARCH)
   endif
-  ifneq ($(ccache),$(firstword $($(combo_target)CXX)))
-    $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
+  ccache := prebuilt/$(CCACHE_HOST_TAG)/ccache/ccache
+  # Check that the executable is here.
+  ccache := $(strip $(wildcard $(ccache)))
+  ifdef ccache
+    # prepend ccache if necessary
+    ifneq ($(ccache),$(firstword $($(combo_target)CC)))
+      $(combo_target)CC := $(ccache) $($(combo_target)CC)
+    endif
+    ifneq ($(ccache),$(firstword $($(combo_target)CXX)))
+      $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
+    endif
+    ccache =
   endif
-  ccache =
 endif
diff --git a/core/config.mk b/core/config.mk
index c6f6288..2a8a05b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -108,8 +108,8 @@
 # Default is to prelink modules.
 TARGET_PRELINK_MODULE := true
 
-# Default shell is ash. Other possible value is mksh.
-TARGET_SHELL := ash
+# Default shell is mksh. Other possible value is ash.
+TARGET_SHELL := mksh
 
 # ###############################################################
 # Include sub-configuration files
@@ -277,6 +277,12 @@
 endif
 endif
 
+# Is the host JDK 64-bit version?
+HOST_JDK_IS_64BIT_VERSION :=
+ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
+HOST_JDK_IS_64BIT_VERSION := true
+endif
+
 # It's called md5 on Mac OS and md5sum on Linux
 ifeq ($(HOST_OS),darwin)
 MD5SUM:=md5 -q
diff --git a/core/definitions.mk b/core/definitions.mk
index fe4b534..48c4aed 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -154,7 +154,7 @@
 
 # $(1): List of directories to look for under this directory
 define all-named-subdir-makefiles
-$(wildcard $(addsuffix /Android.mk, $(addprefix $(my-dir)/,$(1))))
+$(wildcard $(addsuffix /Android.mk, $(addprefix $(call my-dir)/,$(1))))
 endef
 
 ###########################################################
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 505d127..051c16a 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -154,7 +154,7 @@
 	$(hide) ( \
 		javadoc \
                 \@$(PRIVATE_SRC_LIST_FILE) \
-                -J-Xmx1024m \
+                -J-Xmx1280m \
                 $(PRIVATE_PROFILING_OPTIONS) \
                 -quiet \
                 -doclet com.google.doclava.Doclava \
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index c94d943..831ed97 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -8,8 +8,11 @@
 ifeq ($(TARGET_SIMULATOR),true)
 	ABP:=$(ABP):$(TARGET_OUT_EXECUTABLES)
 else
-	# this should be copied to HOST_OUT_EXECUTABLES instead
-	ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin
+	# Add the toolchain bin dir if it actually exists
+	ifneq ($(wildcard $(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin),)
+		# this should be copied to HOST_OUT_EXECUTABLES instead
+		ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin
+	endif
 endif
 ANDROID_BUILD_PATHS := $(ABP)
 ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh
index ed0b127..e1278c3 100755
--- a/core/find-jdk-tools-jar.sh
+++ b/core/find-jdk-tools-jar.sh
@@ -5,9 +5,9 @@
     if [ -z "$JAVAC" ] ; then
         exit 1
     fi
-    while [ -L $JAVAC ] ; do
-        LSLINE=$(ls -l $JAVAC)
-        JAVAC=$(echo -n $LSLINE | sed -e "s/.* -> //")
+    while [ -L "$JAVAC" ] ; do
+        LSLINE=$(ls -l "$JAVAC")
+        JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //")
     done
     echo $JAVAC | sed -e "s:\(.*\)/bin/javac.*:\\1/lib/tools.jar:"
 fi
diff --git a/core/main.mk b/core/main.mk
index cd4aad2..ddcb591 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -12,6 +12,13 @@
 # this turns off the suffix rules built into make
 .SUFFIXES:
 
+# this turns off the RCS / SCCS implicit rules of GNU Make
+% : RCS/%,v
+% : RCS/%
+% : %,v
+% : s.%
+% : SCCS/s.%
+
 # If a rule fails, delete $@.
 .DELETE_ON_ERROR:
 
@@ -73,17 +80,6 @@
 
 $(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 beyond froyo/2.2.)
-$(warning ************************************************************)
-$(error stop)
-endif
-endif
-
 ifneq ($(HOST_OS),windows)
 ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
 # check for a case sensitive file system
@@ -403,6 +399,7 @@
 	development/host \
 	development/tools/etc1tool \
 	development/tools/line_endings \
+	development/tools/emulator/opengl \
 	external/clang \
 	external/easymock \
 	external/expat \
@@ -431,6 +428,7 @@
 	sdk/archquery \
 	sdk/androidprefs \
 	sdk/apkbuilder \
+	sdk/assetstudio \
 	sdk/common \
 	sdk/ddms \
 	sdk/hierarchyviewer2 \
@@ -439,8 +437,10 @@
 	sdk/layoutlib_api \
 	sdk/layoutopt \
 	sdk/ninepatch \
+	sdk/rule_api \
 	sdk/sdkstats \
 	sdk/sdkmanager \
+	sdk/swtmenubar \
 	development/apps \
 	development/tools/mkstubs \
 	packages
@@ -456,7 +456,7 @@
 else	# !SDK_ONLY
 ifeq ($(BUILD_TINY_ANDROID), true)
 
-# TINY_ANDROID is a super-minimal build configuration, handy for board 
+# TINY_ANDROID is a super-minimal build configuration, handy for board
 # bringup and very low level debugging
 
 subdirs := \
@@ -818,9 +818,10 @@
 sdk: $(ALL_SDK_TARGETS)
 ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
 $(call dist-for-goals,sdk win_sdk, \
-	$(ALL_SDK_TARGETS) \
-	$(SYMBOLS_ZIP) \
- )
+    $(ALL_SDK_TARGETS) \
+    $(SYMBOLS_ZIP) \
+    $(INSTALLED_BUILD_PROP_TARGET) \
+)
 endif
 
 .PHONY: samplecode
diff --git a/core/notice_files.mk b/core/notice_files.mk
index fd76d51..74beb49 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -2,9 +2,9 @@
 ## Track NOTICE files
 ###########################################################
 
-notice_file:=$(shell find $(LOCAL_PATH) -maxdepth 1 -name NOTICE)
+notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
 
-ifneq ($(strip $(notice_file)),)
+ifdef notice_file
 
 # This relies on the name of the directory in PRODUCT_OUT matching where
 # it's installed on the target - i.e. system, data, etc.  This does
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index afcda23..abbf999 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -55,10 +55,11 @@
 
 # All SDK add-ons have these files
 files_to_copy += \
-        $(BUILT_SYSTEMIMAGE):images/system.img \
-        $(BUILT_USERDATAIMAGE_TARGET):images/userdata.img \
-        $(BUILT_RAMDISK_TARGET):images/ramdisk.img \
-        $(target_notice_file_txt):images/NOTICE.txt
+        $(BUILT_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
+        $(BUILT_USERDATAIMAGE_TARGET):images/$(TARGET_CPU_ABI)/userdata.img \
+        $(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \
+        $(ANDROID_PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \
+        $(target_notice_file_txt):images/$(TARGET_CPU_ABI)/NOTICE.txt
 
 # Generate rules to copy the requested files
 $(foreach cf,$(files_to_copy), \
@@ -110,4 +111,3 @@
 $(error Trying to build sdk_addon, but product '$(INTERNAL_PRODUCT)' does not define one)
 endif
 endif # addon_name
-
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index ef85f84..6216463 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 := 3.2.2
+  PLATFORM_VERSION := 3.1.4.1.5.9.2.6.5
 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 := AOSP
 endif
 
 ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
diff --git a/envsetup.sh b/envsetup.sh
index 24c4386..4c62e8e 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -95,19 +95,34 @@
     #                                                                #
     ##################################################################
 
+    # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces
+    # due to "C:\Program Files" being in the path.
+
     # out with the old
-    if [ -n $ANDROID_BUILD_PATHS ] ; then
+    if [ -n "$ANDROID_BUILD_PATHS" ] ; then
         export PATH=${PATH/$ANDROID_BUILD_PATHS/}
     fi
-    if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
+    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-linux-androideabi-4.4.x/bin
-    export ARM_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
+
+    # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
+    export ANDROID_EABI_TOOLCHAIN=
+    toolchaindir=toolchain/arm-linux-androideabi-4.4.x/bin
+    if [ -d "$prebuiltdir/$toolchaindir" ]; then
+        export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+    fi
+
+    export ARM_EABI_TOOLCHAIN=
+    toolchaindir=toolchain/arm-eabi-4.4.3/bin
+    if [ -d "$prebuiltdir/$toolchaindir" ]; then
+        export ARM_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+    fi
+
     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:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS
@@ -176,6 +191,29 @@
     fi
 }
 
+function addcompletions()
+{
+    local T dir f
+
+    # Keep us from trying to run in something that isn't bash.
+    if [ -z "${BASH_VERSION}" ]; then
+        return
+    fi
+
+    # Keep us from trying to run in bash that's too old.
+    if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
+        return
+    fi
+
+    dir="sdk/bash_completion"
+    if [ -d ${dir} ]; then
+        for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do
+            echo "including $f"
+            . $f
+        done
+    fi
+}
+
 case `uname -s` in
     Linux)
         function choosesim()
@@ -435,12 +473,7 @@
 # add the default one here
 add_lunch_combo full-eng
 add_lunch_combo full_x86-eng
-
-# if we're on linux, add the simulator.  There is a special case
-# in lunch to deal with the simulator
-if [ "$(uname)" = "Linux" ] ; then
-    add_lunch_combo simulator
-fi
+add_lunch_combo vbox_x86-eng
 
 function print_lunch_menu()
 {
@@ -1111,13 +1144,15 @@
     fi
 }
 
-case `ps -o command -p $$` in
-    *bash*)
-        ;;
-    *)
-        echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
-        ;;
-esac
+if [ "x$SHELL" != "x/bin/bash" ]; then
+    case `ps -o command -p $$` in
+        *bash*)
+            ;;
+        *)
+            echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
+            ;;
+    esac
+fi
 
 # Execute the contents of any vendorsetup.sh files we can find.
 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
@@ -1126,3 +1161,5 @@
     . $f
 done
 unset f
+
+addcompletions
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 26bf6ab..c8a0569 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -6,7 +6,22 @@
 # The generic product target doesn't have any hardware-specific pieces.
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_KERNEL := true
-TARGET_CPU_ABI := armeabi
+
+# Note: we build the platform images for ARMv7-A _without_ NEON.
+#
+# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but
+# emulated NEON code paths typically ends up 2x slower than the normal C code
+# it is supposed to replace (unlike on real devices where it is 2x to 3x
+# faster).
+#
+# What this means is that the platform image will not use NEON code paths
+# that are slower to emulate. On the other hand, it is possible to emulate
+# application code generated with the NDK that uses NEON in the emulator.
+#
+TARGET_ARCH_VARIANT := armv7-a
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+
 HAVE_HTC_AUDIO_DRIVER := true
 BOARD_USES_GENERIC_AUDIO := true
 
@@ -15,3 +30,12 @@
 
 # Set /system/bin/sh to mksh, not ash, to test the transition.
 TARGET_SHELL := mksh
+
+# Enable dex-preoptimization to speed up the first boot sequence
+# of an SDK AVD. Note that this operation only works on Linux for now
+ifeq ($(HOST_OS),linux)
+WITH_DEXPREOPT := true
+endif
+
+# Build OpenGLES emulation guest and host libraries
+BUILD_EMULATOR_OPENGL := true
diff --git a/target/board/generic_armv5/AndroidBoard.mk b/target/board/generic_armv5/AndroidBoard.mk
new file mode 100644
index 0000000..7daff27
--- /dev/null
+++ b/target/board/generic_armv5/AndroidBoard.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2011 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.
+#
+
+-include build/target/board/generic/AndroidBoard.mk
diff --git a/target/board/generic_armv5/BoardConfig.mk b/target/board/generic_armv5/BoardConfig.mk
new file mode 100644
index 0000000..d8fa2fe
--- /dev/null
+++ b/target/board/generic_armv5/BoardConfig.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2011 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.
+#
+
+include build/target/board/generic/BoardConfig.mk
+
+TARGET_ARCH_VARIANT :=
+TARGET_CPU_ABI := armeabi
+TARGET_CPU_ABI2 :=
+
+WITH_DEXPREOPT := false
diff --git a/target/board/generic_armv5/README.txt b/target/board/generic_armv5/README.txt
new file mode 100644
index 0000000..25d590a
--- /dev/null
+++ b/target/board/generic_armv5/README.txt
@@ -0,0 +1,5 @@
+The "generic_armv5" product defines a non-hardware-specific target
+without a kernel or bootloader.
+
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_armv5/device.mk b/target/board/generic_armv5/device.mk
new file mode 100644
index 0000000..7c4aaf2
--- /dev/null
+++ b/target/board/generic_armv5/device.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2011 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.
+#
+
+include build/target/board/generic/device.mk
diff --git a/target/board/generic_armv5/system.prop b/target/board/generic_armv5/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/generic_armv5/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 83a8c3e..5b6d50f 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -1,31 +1,31 @@
-TARGET_ARCH=x86
-DISABLE_DEXPREOPT := true
-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"
+# config.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
 TARGET_CPU_ABI := x86
-TARGET_USERIMAGES_USE_EXT4 := true
-TARGET_BOOTIMAGE_USE_EXT2 := true
+TARGET_ARCH := x86
+TARGET_ARCH_VARIANT := x86-atom
+TARGET_PRELINK_MODULE := false
 
-# For VirtualBox and likely other emulators
-BOARD_INSTALLER_CMDLINE := init=/init console=ttyS0 console=tty0 androidboot.hardware=generic_x86 vga=788 androidboot.console=tty0 verbose
-BOARD_KERNEL_CMDLINE := init=/init console=tty0 console=ttyS0 androidboot.hardware=generic_x86 vga=788 androidboot.console=tty0 verbose
-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
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 157286400
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 52428800
-BOARD_INSTALLERIMAGE_PARTITION_SIZE := 524288000
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+# The IA emulator (qemu) uses the Goldfish devices
+HAVE_HTC_AUDIO_DRIVER := true
+BOARD_USES_GENERIC_AUDIO := true
 
+# no hardware camera
+USE_CAMERA_STUB := true
 
-# The eth0 device should be started with dhcp on boot.
-# Useful for emulators that don't provide a wifi connection.
-NET_ETH0_STARTONBOOT := true
+# Set /system/bin/sh to mksh, not ash, to test the transition.
+TARGET_SHELL := mksh
+
+# Enable dex-preoptimization to speed up the first boot sequence
+# of an SDK AVD. Note that this operation only works on Linux for now
+ifeq ($(HOST_OS),linux)
+WITH_DEXPREOPT := true
+endif
+
+# Build OpenGLES emulation host and guest libraries
+BUILD_EMULATOR_OPENGL := true
diff --git a/target/board/generic_x86/README.txt b/target/board/generic_x86/README.txt
index 585a373..938d982 100644
--- a/target/board/generic_x86/README.txt
+++ b/target/board/generic_x86/README.txt
@@ -1,29 +1,8 @@
-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).
+The "generic_x86" product defines a non-hardware-specific IA target
+without a kernel or bootloader.
 
-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
+It can be used to build the entire user-level system, and
+will work with the IA version of the emulator,
 
-A2. Copy in the kernel
-        cd $HOME/AOSP
-        cp ~/bzImage.your_device $HOME/AOSP/prebuilt/android-x86/kernel/kernel
-
-A3. 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:
-
-A4. Build a VirtualBox installer image
-	cd $HOME/AOSP
-        source build/envsetup.sh
-        lunch generic_x86-eng
-        make -j8 installer_vdi
-
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index bbdc8f4..0b4dc27 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -1,9 +1,26 @@
-ifeq ($(TARGET_PREBUILT_KERNEL),)
-LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel
-else
-LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
-endif
+#
+# Copyright (C) 2009 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.
+#
 
-PRODUCT_COPY_FILES += \
-    $(LOCAL_KERNEL):kernel \
-    build/target/board/generic_x86/init.rc:root/init.rc
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+    ro.ril.hsxpa=1 \
+    ro.ril.gprsclass=10
+
+PRODUCT_COPY_FILES := \
+    development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+    development/data/etc/vold.conf:system/etc/vold.conf
diff --git a/target/board/generic_x86/disk_layout.conf b/target/board/generic_x86/disk_layout.conf
deleted file mode 100644
index 7b073ee..0000000
--- a/target/board/generic_x86/disk_layout.conf
+++ /dev/null
@@ -1,54 +0,0 @@
-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/system.prop b/target/board/generic_x86/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/generic_x86/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/board/vbox_x86/AndroidBoard.mk b/target/board/vbox_x86/AndroidBoard.mk
new file mode 100644
index 0000000..2af7dcd
--- /dev/null
+++ b/target/board/vbox_x86/AndroidBoard.mk
@@ -0,0 +1,7 @@
+LOCAL_PATH := $(call my-dir)
+
+LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel-vbox
+
+PRODUCT_COPY_FILES += \
+    $(LOCAL_KERNEL):kernel \
+    $(LOCAL_PATH)/init.rc:root/init.rc
diff --git a/target/board/vbox_x86/BoardConfig.mk b/target/board/vbox_x86/BoardConfig.mk
new file mode 100644
index 0000000..525074e
--- /dev/null
+++ b/target/board/vbox_x86/BoardConfig.mk
@@ -0,0 +1,35 @@
+#
+# IA target for VitualBox
+#
+
+TARGET_ARCH=x86
+DISABLE_DEXPREOPT := true
+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_EXT4 := true
+TARGET_BOOTIMAGE_USE_EXT2 := true
+
+# For VirtualBox and likely other emulators
+BOARD_INSTALLER_CMDLINE := init=/init console=ttyS0 console=tty0 vga=788 verbose
+BOARD_KERNEL_CMDLINE :=    init=/init console=ttyS0 console=tty0 vga=788 verbose androidboot.hardware=generic_x86 androidboot.console=ttyS0
+TARGET_USE_DISKINSTALLER := true
+
+TARGET_DISK_LAYOUT_CONFIG := build/target/board/vbox_x86/disk_layout.conf
+BOARD_BOOTIMAGE_MAX_SIZE := 8388608
+BOARD_SYSLOADER_MAX_SIZE := 7340032
+BOARD_FLASH_BLOCK_SIZE := 512
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 50M
+BOARD_INSTALLERIMAGE_PARTITION_SIZE := 500M
+TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+
+
+# 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/vbox_x86/README.txt b/target/board/vbox_x86/README.txt
new file mode 100644
index 0000000..568dc5f
--- /dev/null
+++ b/target/board/vbox_x86/README.txt
@@ -0,0 +1,9 @@
+The "vbox_x86" product defines a non-hardware-specific target intended
+to run on the VirtualBox emulator.
+
+Most of the Android devices (networking, phones, sound, etc) do not work.
+
+ADB via ethernet works with this target. You can use 'adb install' to
+test applications that do not require network, phone or sound support.
+This emulation is useful because VirtualBox runs much faster then does the
+QEMU emulators (at least until a KVM enabled QEMU emulator is available).
diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk
new file mode 100644
index 0000000..0b4dc27
--- /dev/null
+++ b/target/board/vbox_x86/device.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2009 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.
+#
+
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+    ro.ril.hsxpa=1 \
+    ro.ril.gprsclass=10
+
+PRODUCT_COPY_FILES := \
+    development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+    development/data/etc/vold.conf:system/etc/vold.conf
diff --git a/target/board/vbox_x86/disk_layout.conf b/target/board/vbox_x86/disk_layout.conf
new file mode 100644
index 0000000..12241ab
--- /dev/null
+++ b/target/board/vbox_x86/disk_layout.conf
@@ -0,0 +1,76 @@
+# Best to align all partion start/ends on a cylinder boundary (fdisk prefers it)
+# 512 bytes/sector
+# 63 sectors/track
+# 32 tracks/cylinder
+
+# LBAs are in 'k', so...
+# 1008 blocks (1k each) (1032192 bytes) / cylinder
+
+device {
+
+    path /dev/block/sda
+
+    scheme mbr
+
+    # bytes in a disk sector (== 1 LBA), must be a power of 2!
+    sector_size 512
+
+    # Start_lba should be on a cylindar boundary.
+    start_lba 63
+
+    # Autodetect disk size if == 0
+    num_lba 0
+
+    partitions {
+        # /dev/sdX1
+        sysloader {
+            active y
+            type linux
+            # 8 cyls in length... about 8M
+            len 8064
+        }
+
+        # /dev/sdX2
+        recovery {
+            active y
+            type linux
+            # 8 cyls in length... about 8M
+            len 8064
+        }
+
+        # /dev/sdX3
+        boot {
+            active y
+            type linux
+            # 8 cyls in length... about 8M
+            len 8064
+        }
+
+        # /dev/sdX4
+        # (extended partion begins)
+
+        # /dev/sdX5
+        cache {
+            type linux
+            len 512M
+        }
+
+        # /dev/sdX6
+        system {
+            type linux
+            len 512M
+        }
+
+        # /dev/sdX7
+        third_party {
+            type linux
+            len 512M
+        }
+
+        # /dev/sdX8
+        data {
+            type linux
+            len -1
+        }
+    }
+}
diff --git a/target/board/generic_x86/init.rc b/target/board/vbox_x86/init.rc
similarity index 98%
rename from target/board/generic_x86/init.rc
rename to target/board/vbox_x86/init.rc
index 8f6be28..100cc09 100644
--- a/target/board/generic_x86/init.rc
+++ b/target/board/vbox_x86/init.rc
@@ -90,11 +90,11 @@
     write /dev/cpuctl/bg_non_interactive/cpu.shares 52
 
 on fs
-# mount mtd partitions
-    mount ext4 /dev/block/sda6 /system rw
-    mkdir /system/vendor
-    mount ext4 /dev/block/sda8 /data nosuid nodev
-    mount ext4 /dev/block/sda7 /cache nosuid nodev
+# mount sda partitions
+    mount ext4 /dev/block/sda6 /system
+    mount ext4 /dev/block/sda6 /system ro remount
+    mount ext4 /dev/block/sda7 /data nosuid nodev
+    mount ext4 /dev/block/sda8 /cache nosuid nodev
 
 on post-fs
     # once everything is setup, no need to modify /
@@ -293,11 +293,6 @@
 on property:ro.secure=0
     start console
 
-# Enable networking so that adb can connect
-service netcfg /system/bin/netcfg eth0 dhcp
-    setprop property:ro.kernel.qemu 1
-    oneshot
-
 # adbd is controlled by the persist.service.adb.enable system property
 service adbd /sbin/adbd
     disabled
@@ -425,3 +420,7 @@
     socket dumpstate stream 0660 shell log
     disabled
     oneshot
+
+# Enable networking so that adb can connect
+service netcfg /system/bin/netcfg eth0 dhcp
+    oneshot
diff --git a/target/board/vbox_x86/system.prop b/target/board/vbox_x86/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/vbox_x86/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index b27721a..5dc6543 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -35,10 +35,13 @@
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/core.mk \
     $(LOCAL_DIR)/generic.mk \
+    $(LOCAL_DIR)/generic_armv5.mk \
     $(LOCAL_DIR)/generic_x86.mk \
     $(LOCAL_DIR)/full.mk \
     $(LOCAL_DIR)/full_x86.mk \
+    $(LOCAL_DIR)/vbox_x86.mk \
     $(LOCAL_DIR)/sdk.mk \
+    $(LOCAL_DIR)/sdk_x86.mk \
     $(LOCAL_DIR)/sim.mk \
     $(LOCAL_DIR)/large_emu_hw.mk
 endif
diff --git a/target/product/full_x86.mk b/target/product/full_x86.mk
index 9e22bc5..d6a169a 100644
--- a/target/product/full_x86.mk
+++ b/target/product/full_x86.mk
@@ -16,8 +16,8 @@
 
 # This is a build configuration for a full-featured build of the
 # Open-Source part of the tree. It's geared toward a US-centric
-# x86 build, but all those aspects can be overridden
-# in inherited configurations.
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
 
 # 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
@@ -29,8 +29,13 @@
 $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk)
 
+# Ensure we package the BIOS files too.
+PRODUCT_PACKAGES += \
+	bios.bin \
+	vgabios-cirrus.bin \
+
 # Overrides
 PRODUCT_NAME := full_x86
 PRODUCT_DEVICE := generic_x86
 PRODUCT_BRAND := Android
-PRODUCT_MODEL := Full Android x86
+PRODUCT_MODEL := Full Android on x86 Emulator
diff --git a/target/product/generic_armv5.mk b/target/product/generic_armv5.mk
new file mode 100644
index 0000000..d419e70
--- /dev/null
+++ b/target/product/generic_armv5.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2011 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.
+#
+
+# This is a generic product that isn't specialized for a specific device.
+# It includes the base Android platform.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic_armv5
+PRODUCT_DEVICE := generic_armv5
+PRODUCT_NAME := generic_armv5
diff --git a/target/product/generic_x86.mk b/target/product/generic_x86.mk
index 345a79a..7e77a27 100644
--- a/target/product/generic_x86.mk
+++ b/target/product/generic_x86.mk
@@ -1,34 +1,26 @@
+#
+# Copyright (C) 2007 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.
+#
+
 # 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
+# It includes the base Android platform.
 
-PRODUCT_PACKAGES := \
-    DeskClock \
-    AlarmProvider \
-    Calendar \
-    Camera \
-    DrmProvider \
-    LatinIME \
-    Mms \
-    Music \
-    Settings \
-    Sync \
-    Updater \
-    CalendarProvider \
-    SubscribedFeedsProvider \
-    SyncProvider
-
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
 $(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 1dffb60..92de1b2 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -100,6 +100,8 @@
 	sdklib \
 	sdkuilib \
 	sdkmanager \
+	swtmenubar \
+	swing-worker-1.1 \
 	groovy-all-1.7.0 \
 	commons-compress-1.0 \
 	emmalib \
diff --git a/target/product/sdk_x86.mk b/target/product/sdk_x86.mk
new file mode 100644
index 0000000..6c5e746
--- /dev/null
+++ b/target/product/sdk_x86.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2009 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.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/sdk.mk)
+
+# Overrides
+PRODUCT_BRAND := generic_x86
+PRODUCT_NAME := sdk_x86
+PRODUCT_DEVICE := generic_x86
+PRODUCT_MODEL := Android SDK built for x86
diff --git a/target/product/vbox_x86.mk b/target/product/vbox_x86.mk
new file mode 100644
index 0000000..c32b1eb
--- /dev/null
+++ b/target/product/vbox_x86.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2009 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.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_x86.mk)
+
+PRODUCT_NAME := vbox_x86
+PRODUCT_DEVICE := vbox_x86
+PRODUCT_MODEL := Full Android on x86 VirtualBox
diff --git a/tools/Android.mk b/tools/Android.mk
index fa9d0b7..92603f5 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-LOCAL_PATH := $(my-dir)
+LOCAL_PATH := $(call my-dir)
 
 # If we're building only unbundled apps, this is the only tool we need.
 ifneq ($(TARGET_BUILD_APPS),)
diff --git a/tools/findleaves.py b/tools/findleaves.py
index 0adf188..52c4d9f 100755
--- a/tools/findleaves.py
+++ b/tools/findleaves.py
@@ -89,9 +89,9 @@
     usage()
   dirlist = argv[i:-1]
   filename = argv[-1]
-  results = perform_find(mindepth, prune, dirlist, filename)
+  results = list(set(perform_find(mindepth, prune, dirlist, filename)))
   results.sort()
-  for r in set(results):
+  for r in results:
     print r
 
 if __name__ == "__main__":
diff --git a/tools/releasetools/check_target_files_signatures b/tools/releasetools/check_target_files_signatures
index 2c97e2e..1325ef4 100755
--- a/tools/releasetools/check_target_files_signatures
+++ b/tools/releasetools/check_target_files_signatures
@@ -52,6 +52,11 @@
 import tempfile
 import zipfile
 
+try:
+  from hashlib import sha1 as sha1
+except ImportError:
+  from sha import sha as sha1
+
 import common
 
 # Work around a bug in python's zipfile module that prevents opening
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index bcfacb2..2cb5680 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -29,11 +29,9 @@
 import zipfile
 
 try:
-  import hashlib
-  sha1 = hashlib.sha1
+  from hashlib import sha1 as sha1
 except ImportError:
-  import sha
-  sha1 = sha.sha
+  from sha import sha as sha1
 
 # missing in Python 2.4 and before
 if not hasattr(os, "SEEK_SET"):
@@ -144,10 +142,6 @@
   makeint("boot_size")
 
   d["fstab"] = LoadRecoveryFSTab(zip)
-  if not d["fstab"]:
-    if "fs_type" not in d: d["fs_type"] = "yaffs2"
-    if "partition_type" not in d: d["partition_type"] = "MTD"
-
   return d
 
 def LoadRecoveryFSTab(zip):
@@ -157,9 +151,7 @@
   try:
     data = zip.read("RECOVERY/RAMDISK/etc/recovery.fstab")
   except KeyError:
-    # older target-files that doesn't have a recovery.fstab; fall back
-    # to the fs_type and partition_type keys.
-    return
+    raise ValueError("Could not find RECOVERY/RAMDISK/etc/recovery.fstab")
 
   d = {}
   for line in data.split("\n"):
@@ -397,9 +389,6 @@
     p = info_dict["fstab"][mount_point]
     fs_type = p.fs_type
     limit = info_dict.get(p.device + "_size", None)
-  else:
-    fs_type = info_dict.get("fs_type", None)
-    limit = info_dict.get(target + "_size", None)
   if not fs_type or not limit: return
 
   if fs_type == "yaffs2":
@@ -830,9 +819,4 @@
   if fstab:
     return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
   else:
-    devices = {"/boot": "boot",
-               "/recovery": "recovery",
-               "/radio": "radio",
-               "/data": "userdata",
-               "/cache": "cache"}
-    return info["partition_type"], info.get("partition_path", "") + devices[mount_point]
+    return None
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index c2b0056..6c53f9e 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -140,13 +140,6 @@
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type],
                           p.device, p.mount_point))
       self.mounts.add(p.mount_point)
-    else:
-      what = mount_point.lstrip("/")
-      what = self.info.get("partition_path", "") + what
-      self.script.append('mount("%s", "%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          what, mount_point))
-      self.mounts.add(mount_point)
 
   def UnpackPackageDir(self, src, dst):
     """Unpack a given directory from the OTA package into the given
@@ -175,12 +168,6 @@
       self.script.append('format("%s", "%s", "%s", "%s");' %
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type],
                           p.device, p.length))
-    else:
-      # older target-files without per-partition types
-      partition = self.info.get("partition_path", "") + partition
-      self.script.append('format("%s", "%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          partition, reserve_size))
 
   def DeleteFiles(self, file_list):
     """Delete all files in file_list."""
@@ -221,23 +208,6 @@
             'package_extract_file("%(fn)s", "%(device)s");' % args)
       else:
         raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,))
-    else:
-      # backward compatibility with older target-files that lack recovery.fstab
-      if self.info["partition_type"] == "MTD":
-        self.script.append(
-            ('assert(package_extract_file("%(fn)s", "/tmp/%(partition)s.img"),\n'
-             '       write_raw_image("/tmp/%(partition)s.img", "%(partition)s"),\n'
-             '       delete("/tmp/%(partition)s.img"));')
-            % {'partition': partition, 'fn': fn})
-      elif self.info["partition_type"] == "EMMC":
-        self.script.append(
-            ('package_extract_file("%(fn)s", "%(dir)s%(partition)s");')
-            % {'partition': partition, 'fn': fn,
-               'dir': self.info.get("partition_path", ""),
-               })
-      else:
-        raise ValueError("don't know how to write \"%s\" partitions" %
-                         (self.info["partition_type"],))
 
   def SetPermissions(self, fn, uid, gid, mode):
     """Set file ownership and permissions."""
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 8f5c3fe..aead38f 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -63,6 +63,11 @@
 import time
 import zipfile
 
+try:
+  from hashlib import sha1 as sha1
+except ImportError:
+  from sha import sha as sha1
+
 import common
 import edify_generator