From a7e72e17dfed8adf5905ccc1b0245460727f53aa Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Wed, 18 Mar 2009 20:53:43 -0700 Subject: [PATCH 001/143] auto import //branches/donutburger/...@140359 --- core/build_id.mk | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) mode change 100755 => 100644 core/build_id.mk diff --git a/core/build_id.mk b/core/build_id.mk old mode 100755 new mode 100644 index 8d31dac986..9163cdf999 --- a/core/build_id.mk +++ b/core/build_id.mk @@ -1,3 +1,32 @@ -# This branch was born out of a naming conventions fix. -# The decision was to keep the RC names the same. -export BUILD_ID=CRA77 +# +# Copyright (C) 2008 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. +# + +# +# Defines branch-specific values. +# + +# BUILD_ID is usually used to specify the branch name +# (like "MAIN") or a branch name and a release candidate +# (like "TC1-RC5"). It must be a single word, and is +# capitalized by convention. +# +BUILD_ID := DONUT-BURGER + +# DISPLAY_BUILD_NUMBER should only be set for development branches, +# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for +# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY +# is the same as BUILD_ID +DISPLAY_BUILD_NUMBER := true From c6f440e85c1e6ecf833cbfbd623a386f0ead40c7 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 24 Mar 2009 17:45:38 -0700 Subject: [PATCH 002/143] Automated import from //branches/donutburger/...@140489,140489 --- cleanspec.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cleanspec.mk b/cleanspec.mk index 290319cd9c..d0f7a6929b 100644 --- a/cleanspec.mk +++ b/cleanspec.mk @@ -71,6 +71,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/s $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj/SHARED_LIBRARIES/libwebcore_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIME_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.inputmethod.pinyin.lib_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIMEGoogleService_intermediates) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST From cd44e5400f0d29d7a7cd92fc8aa55dafade09cfa Mon Sep 17 00:00:00 2001 From: Dianne Hackborn <> Date: Tue, 24 Mar 2009 18:36:43 -0700 Subject: [PATCH 003/143] Automated import from //branches/donutburger/...@140818,140818 --- tools/droiddoc/NOTICE | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tools/droiddoc/NOTICE diff --git a/tools/droiddoc/NOTICE b/tools/droiddoc/NOTICE new file mode 100644 index 0000000000..3f1b1bb5b9 --- /dev/null +++ b/tools/droiddoc/NOTICE @@ -0,0 +1,45 @@ + +Copyright (C) 2008 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. + + +====================================================================== + +jQuery 1.2.6 - New Wave Javascript + +Copyright (c) 2008 John Resig (jquery.com) +Dual licensed under the MIT (MIT-LICENSE.txt) +and GPL (GPL-LICENSE.txt) licenses. + +Copyright (c) 2009 John Resig, http://jquery.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + From bd46b21c31463701b6a38fda70c70b5394c1bf9d Mon Sep 17 00:00:00 2001 From: Joe Onorato <> Date: Tue, 24 Mar 2009 19:07:34 -0700 Subject: [PATCH 004/143] Automated import from //branches/donutburger/...@140982,140982 --- core/java.mk | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/core/java.mk b/core/java.mk index 65c525d21f..b1ded8a268 100644 --- a/core/java.mk +++ b/core/java.mk @@ -72,33 +72,38 @@ LOCAL_NO_EMMA_INSTRUMENT := true LOCAL_NO_EMMA_COMPILE := true endif +# Choose leaf name for the compiled jar file. 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_name_jar := classes-no-debug-var.jar -$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g:{lines,source} +full_classes_compiled_jar_leaf := classes-no-debug-var.jar else -# when emma is off, compile with the default flags, which contain full debug -# info -full_classes_compiled_name_jar := classes-full-debug.jar -$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g +full_classes_compiled_jar_leaf := classes-full-debug.jar endif # Compile the java files to a .jar file. # This intentionally depends on java_sources, not all_java_sources. # Deps for generated source files must be handled separately, # via deps on the target that generates the sources. -full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_name_jar) +full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf) $(full_classes_compiled_jar): $(java_sources) $(full_java_lib_deps) $(transform-java-to-classes.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 +endif + emma_intermediates_dir := $(intermediates.COMMON)/emma_out -# the 'lib/$(full_classes_compiled_name_jar)' portion of this path is fixed in +# 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_name_jar) +full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(full_classes_compiled_jar_leaf) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) # Skip adding emma instrumentation to class files if this is a static library, From 7f3eaaf9cf2f9ec15ce6db1046d06950ba2b6d3a Mon Sep 17 00:00:00 2001 From: Dave Sparks <> Date: Tue, 24 Mar 2009 19:14:21 -0700 Subject: [PATCH 005/143] Automated import from //branches/donutburger/...@141015,141015 --- target/product/core.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/product/core.mk b/target/product/core.mk index 83e2b3af58..35e8670e26 100644 --- a/target/product/core.mk +++ b/target/product/core.mk @@ -22,6 +22,3 @@ PRODUCT_PACKAGES := \ PackageInstaller \ Bugreport -#include basic ringtones -include frameworks/base/data/sounds/OriginalAudio.mk - From bafa6ddfc5b6c02a6dc8c4b2bdabd2882b1e909d Mon Sep 17 00:00:00 2001 From: Iliyan Malchev <> Date: Tue, 24 Mar 2009 19:58:48 -0700 Subject: [PATCH 006/143] Automated import from //branches/donutburger/...@141285,141285 --- tools/soslim/soslim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/soslim/soslim.c b/tools/soslim/soslim.c index 4e59c248c6..d32e247430 100644 --- a/tools/soslim/soslim.c +++ b/tools/soslim/soslim.c @@ -236,7 +236,7 @@ void clone_elf(Elf *elf, Elf *newelf, { /* Mark the symbol table's string table for removal. */ INFO("Section [%s] (static symbol-string table) will be stripped from image.\n", - shdr_info[cnt].name); + shdr_info[shdr_info[cnt].shdr.sh_link].name); shdr_info[shdr_info[cnt].shdr.sh_link].idx = 0; } else { From e94d71753db7689eabc10372553ffb27aeacd516 Mon Sep 17 00:00:00 2001 From: Dima Zavin <> Date: Tue, 24 Mar 2009 20:31:33 -0700 Subject: [PATCH 007/143] Automated import from //branches/donutburger/...@141546,141546 --- target/product/core.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/product/core.mk b/target/product/core.mk index 35e8670e26..d79b1e1f48 100644 --- a/target/product/core.mk +++ b/target/product/core.mk @@ -9,7 +9,7 @@ PRODUCT_PACKAGES := \ framework-res \ Browser \ Contacts \ - Home \ + Launcher \ HTMLViewer \ Phone \ ContactsProvider \ From d14f6d92d4284ea54520bb29f21411e892ba43ed Mon Sep 17 00:00:00 2001 From: Dave Bort <> Date: Tue, 24 Mar 2009 20:50:42 -0700 Subject: [PATCH 008/143] Automated import from //branches/donutburger/...@141759,141759 --- core/product_config.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/product_config.mk b/core/product_config.mk index b55760f8b4..f5fa53a555 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -156,7 +156,10 @@ PRODUCT_LOCALES := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_LOCALES)) # in PRODUCT_LOCALES, add them to PRODUCT_LOCALES. extra_locales := $(filter-out $(PRODUCT_LOCALES),$(CUSTOM_LOCALES)) ifneq (,$(extra_locales)) - $(info Adding CUSTOM_LOCALES [$(extra_locales)] to PRODUCT_LOCALES [$(PRODUCT_LOCALES)]) + ifneq ($(CALLED_FROM_SETUP),true) + # Don't spam stdout, because envsetup.sh may be scraping values from it. + $(info Adding CUSTOM_LOCALES [$(extra_locales)] to PRODUCT_LOCALES [$(PRODUCT_LOCALES)]) + endif PRODUCT_LOCALES += $(extra_locales) extra_locales := endif From 7b64124f0baabfa7216727a03e23fa1330fc6fad Mon Sep 17 00:00:00 2001 From: Sriram Raman <> Date: Tue, 24 Mar 2009 22:40:59 -0700 Subject: [PATCH 009/143] Automated import from //branches/donutburger/...@142410,142410 --- core/Makefile | 16 ++++++++++++++++ core/version_defaults.mk | 10 ---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/Makefile b/core/Makefile index 9ba117aa5f..3f452b34b5 100644 --- a/core/Makefile +++ b/core/Makefile @@ -79,6 +79,22 @@ ifneq ($(words $(BUILD_FINGERPRINT)),1) $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)") endif +# Display parameters shown under Settings -> About Phone +ifeq ($(TARGET_BUILD_VARIANT),user) + # User builds should show: + # release build number or branch.buld_number non-release builds + + # Dev. branches should have DISPLAY_BUILD_NUMBER set + ifeq "true" "$(DISPLAY_BUILD_NUMBER)" + BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER) + else + BUILD_DISPLAY_ID := $(BUILD_ID) + endif +else + # Non-user builds should show detailed build information + BUILD_DISPLAY_ID := $(build_desc) +endif + # Selects the first locale in the list given as the argument, # and splits it into language and region, which each may be # empty. diff --git a/core/version_defaults.mk b/core/version_defaults.mk index e38a80366a..578d779466 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -72,13 +72,3 @@ ifeq "" "$(BUILD_NUMBER)" BUILD_NUMBER := eng.$(USER).$(shell date +%Y%m%d.%H%M%S) endif -ifeq "true" "$(DISPLAY_BUILD_NUMBER)" - # if the build_id.mk has this defined, then BUILD_ID is updated with - # the BUILD_NUMBER as well. For development branches, this will be - # set, but release branches this will not be set. - BUILD_DISPLAY_ID := "$(BUILD_ID).$(BUILD_NUMBER)" -else - BUILD_DISPLAY_ID := "$(BUILD_ID)" -endif - - From 0ccf0ad4c0d00856568b0a0f3b9c8298515d7c96 Mon Sep 17 00:00:00 2001 From: Andy Stadler <> Date: Wed, 25 Mar 2009 16:05:01 -0700 Subject: [PATCH 010/143] Automated import from //branches/donutburger/...@142699,142699 --- cleanspec.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cleanspec.mk b/cleanspec.mk index d0f7a6929b..22d9fe19d8 100644 --- a/cleanspec.mk +++ b/cleanspec.mk @@ -73,6 +73,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIME_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.inputmethod.pinyin.lib_intermediates) $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIMEGoogleService_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.inputmethod.pinyin.lib_intermediates) +$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIMEGoogleService_intermediates) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST From 35354dc7542fc3efc643e69aa8bcc2bd8172408b Mon Sep 17 00:00:00 2001 From: Eric Fischer <> Date: Wed, 25 Mar 2009 17:01:21 -0700 Subject: [PATCH 011/143] Automated import from //branches/donutburger/...@142719,142719 --- core/cleanbuild.mk | 2 ++ core/dynamic_binary.mk | 10 +++++++++- core/prelink-linux-arm.map | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index 50b56f9528..a753554ca5 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -169,11 +169,13 @@ installclean_files := \ ./$(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/dynamic_binary.mk b/core/dynamic_binary.mk index 10027b828f..f07cf2a8e3 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -18,7 +18,15 @@ ifeq ($(LOCAL_UNSTRIPPED_PATH),) endif # The name of the target file, without any path prepended. -LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX) +# TODO: This duplicates logic from base_rules.mk because we need to +# know its results before base_rules.mk is included. +# Consolidate the duplicates. +LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM)) +ifeq ($(LOCAL_MODULE_STEM),) + LOCAL_MODULE_STEM := $(LOCAL_MODULE) +endif +LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) +LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM) # base_rules.make defines $(intermediates), but we need its value # before we include base_rules. Make a guess, and verify that diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map index 429ae1a1ce..1cd2aa4801 100644 --- a/core/prelink-linux-arm.map +++ b/core/prelink-linux-arm.map @@ -39,7 +39,7 @@ libnetutils.so 0xADB00000 # core dalvik runtime support libandroid_servers.so 0xAD900000 -libicudata.so 0xAD600000 +#libicudata.so 0xAD600000 libicuuc.so 0xAD500000 libicui18n.so 0xAD400000 libandroid_runtime.so 0xAD300000 From e253d822dd45ce09aaf8daa92a90e0c9b01c8c32 Mon Sep 17 00:00:00 2001 From: Brett Chabot <> Date: Fri, 27 Mar 2009 20:17:02 -0700 Subject: [PATCH 012/143] AI 143263: am: CL 143102 Add build environment shortcut to runtest.py. This change does not affect device code. Original author: brettchabot Merged from: //branches/cupcake/... Automated import of CL 143263 --- envsetup.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/envsetup.sh b/envsetup.sh index 016c399ba4..bccf7c9c97 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -974,6 +974,17 @@ function runtest() (cd "$T" && development/tools/runtest $@) } +# simple shortcut to the runtest.py command +function runtest.py() +{ + T=$(gettop) + if [ ! "$T" ]; then + echo "Couldn't locate the top of the tree. Try setting TOP." >&2 + return + fi + (cd "$T" && development/testrunner/runtest.py $@) +} + function godir () { if [[ -z "$1" ]]; then echo "Usage: godir " From 03e1e28c199be8e2527aa618502d2b55b405b1ea Mon Sep 17 00:00:00 2001 From: Brett Chabot <> Date: Tue, 31 Mar 2009 14:53:34 -0700 Subject: [PATCH 013/143] AI 143784: am: CL 143737 Fix kernel build: remove the '.' from runtest.py shortcut Original author: brettchabot Merged from: //branches/cupcake/... Automated import of CL 143784 --- envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index bccf7c9c97..d15abcbf39 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -975,7 +975,7 @@ function runtest() } # simple shortcut to the runtest.py command -function runtest.py() +function runtest_py() { T=$(gettop) if [ ! "$T" ]; then From a401b054a44c3ee72912542d66d41293bdb33b65 Mon Sep 17 00:00:00 2001 From: Raphael Moll <> Date: Tue, 31 Mar 2009 17:19:14 -0700 Subject: [PATCH 014/143] AI 143879: am: CL 143876 Include hprof-conv in SDK (bug #1640225) Original author: raphael Merged from: //branches/cupcake/... Automated import of CL 143879 --- core/main.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/core/main.mk b/core/main.mk index 37c580deac..815745b0b1 100644 --- a/core/main.mk +++ b/core/main.mk @@ -290,6 +290,7 @@ subdirs := \ dalvik/dexdump \ dalvik/libdex \ dalvik/tools/dmtracedump \ + dalvik/tools/hprof-conv \ development/emulator/mksdcard \ development/tools/activitycreator \ development/tools/line_endings \ From 17c83cf22c426c628b4b21bc65128a0d80866d31 Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Wed, 1 Apr 2009 15:48:46 -0700 Subject: [PATCH 015/143] AI 144130: Don't build OTA package keys into the recovery binary; read them from an external file in the recovery image. Use the test-keys for all builds. Automated import of CL 144130 --- core/Makefile | 52 ++++++++++++++++++------------------------ core/product_config.mk | 31 ++++++++----------------- 2 files changed, 32 insertions(+), 51 deletions(-) diff --git a/core/Makefile b/core/Makefile index 3f452b34b5..c840ca8705 100644 --- a/core/Makefile +++ b/core/Makefile @@ -62,9 +62,6 @@ endif # Apps are always signed with test keys, and may be re-signed in a post-build # step. If that happens, the "test-keys" tag will be removed by that step. BUILD_VERSION_TAGS += test-keys -ifndef INCLUDE_TEST_OTA_KEYS - BUILD_VERSION_TAGS += ota-rel-keys -endif BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) # A human-readable string that descibes this build in detail. @@ -639,13 +636,31 @@ ifdef BOARD_KERNEL_CMDLINE INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" endif +# Keys authorized to sign OTA packages this build will accept. The +# build always uses test-keys for this; release packaging tools will +# substitute other keys for this one. +OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem + +# Generate a file containing the keys that will be read by the +# recovery binary. +RECOVERY_INSTALL_OTA_KEYS := \ + $(call intermediates-dir-for,PACKAGING,ota_keys)/keys +DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar +$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) +$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) + @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" + @rm -rf $@ + @mkdir -p $(dir $@) + java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ + $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(recovery_binary) \ $(recovery_initrc) $(recovery_kernel) \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ - $(recovery_build_prop) $(recovery_resource_deps) + $(recovery_build_prop) $(recovery_resource_deps) \ + $(RECOVERY_INSTALL_OTA_KEYS) @echo ----- Making recovery image ------ rm -rf $(TARGET_RECOVERY_OUT) mkdir -p $(TARGET_RECOVERY_OUT) @@ -660,6 +675,7 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) \ cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ $(foreach item,$(recovery_resources_private), \ cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) + cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ > $(TARGET_RECOVERY_ROOT_OUT)/default.prop $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | gzip > $(recovery_ramdisk) @@ -759,16 +775,6 @@ endif .PHONY: otapackage otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) -# Keys authorized to sign OTA packages this build will accept. -ifeq ($(INCLUDE_TEST_OTA_KEYS),true) - OTA_PUBLIC_KEYS := \ - $(sort $(SRC_TARGET_DIR)/product/security/testkey.x509.pem $(OTA_PUBLIC_KEYS)) -endif - -ifeq ($(OTA_PUBLIC_KEYS),) - $(error No OTA_PUBLIC_KEYS defined) -endif - # Build a keystore with the authorized keys in it. # java/android/android/server/checkin/UpdateVerifier.java uses this. ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip @@ -784,21 +790,6 @@ $(TARGET_OUT_ETC)/security/otacerts.zip: $(OTA_PUBLIC_KEYS) # -import -file $$f -alias $(notdir $$f) || exit 1; \ # done -ifdef RECOVERY_INSTALL_OTA_KEYS_INC -# Generate a C-includable file containing the keys. -# RECOVERY_INSTALL_OTA_KEYS_INC is defined by recovery/Android.mk. -# *** THIS IS A TOTAL HACK; EXECUTABLES MUST NOT CHANGE BETWEEN DIFFERENT -# PRODUCTS/BUILD TYPES. *** -# TODO: make recovery read the keys from an external file. -DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar -$(RECOVERY_INSTALL_OTA_KEYS_INC): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) -$(RECOVERY_INSTALL_OTA_KEYS_INC): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) - @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" - @rm -rf $@ - @mkdir -p $(dir $@) - $(hide) java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ -endif - # ----------------------------------------------------------------- # A zip of the directories that map to the target filesystem. # This zip can be used to create an OTA package or filesystem image @@ -827,7 +818,7 @@ define package_files-copy-root endef built_ota_tools := \ - $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ + $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \ $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) @@ -897,6 +888,7 @@ endif @# build them. $(hide) mkdir -p $(zip_root)/META $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt + $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt @# Zip everything up, preserving symlinks $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) diff --git a/core/product_config.mk b/core/product_config.mk index f5fa53a555..e34ad02de3 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -81,11 +81,11 @@ ifdef product_goals TARGET_BUILD_VARIANT := $(word 2,$(product_goals)) # The build server wants to do make PRODUCT-dream-installclean - # which really means TARGET_PRODUCT=dream make installclean. + # which really means TARGET_PRODUCT=dream make installclean. ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) MAKECMDGOALS := $(MAKECMDGOALS) $(TARGET_BUILD_VARIANT) TARGET_BUILD_VARIANT := eng - default_goal_substitution := + default_goal_substitution := else default_goal_substitution := $(DEFAULT_GOAL) endif @@ -106,7 +106,7 @@ ifdef product_goals # # Note that modifying this will not affect the goals that make will # attempt to build, but it's important because we inspect this value - # in certain situations (like for "make sdk"). + # in certain situations (like for "make sdk"). # MAKECMDGOALS := $(patsubst $(goal_name),$(default_goal_substitution),$(MAKECMDGOALS)) @@ -176,7 +176,7 @@ PRODUCT_BRAND := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BRAND)) PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MODEL)) ifndef PRODUCT_MODEL - PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_NAME)) + PRODUCT_MODEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_NAME)) endif PRODUCT_MANUFACTURER := \ @@ -219,23 +219,12 @@ ADDITIONAL_BUILD_PROPERTIES := \ $(ADDITIONAL_BUILD_PROPERTIES) \ $(PRODUCT_PROPERTY_OVERRIDES) -# Get the list of OTA public keys for the product. -OTA_PUBLIC_KEYS := \ - $(sort \ - $(OTA_PUBLIC_KEYS) \ - $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_PUBLIC_KEYS) \ - ) - -# HACK: Not all products define OTA keys yet, and the -user build -# will fail if no keys are defined. -# TODO: Let a product opt out of needing OTA keys, and stop defaulting to -# the test key as soon as possible. -ifeq (,$(strip $(OTA_PUBLIC_KEYS))) - ifeq (,$(CALLED_FROM_SETUP)) - $(warning WARNING: adding test OTA key) - endif - OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem -endif +# The OTA key(s) specified by the product config, if any. The names +# of these keys are stored in the target-files zip so that post-build +# signing tools can substitute them for the test key embedded by +# default. +PRODUCT_OTA_PUBLIC_KEYS := $(sort \ + $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_PUBLIC_KEYS)) # --------------------------------------------------------------- # Force the simulator to be the simulator, and make BUILD_TYPE From 934de9b7586940d70bad31cb218c211505183048 Mon Sep 17 00:00:00 2001 From: Doug Zongker <> Date: Thu, 2 Apr 2009 01:15:57 -0700 Subject: [PATCH 016/143] AI 144143: Define OTA_PUBLIC_KEYS to be the test keys in the otapackage target as well. Automated import of CL 144143 --- core/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/Makefile b/core/Makefile index c840ca8705..cd9663003f 100644 --- a/core/Makefile +++ b/core/Makefile @@ -775,6 +775,11 @@ endif .PHONY: otapackage otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) +# Keys authorized to sign OTA packages this build will accept. The +# build always uses test-keys for this; release packaging tools will +# substitute other keys for this one. +OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem + # Build a keystore with the authorized keys in it. # java/android/android/server/checkin/UpdateVerifier.java uses this. ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip From 032e32a012a3697025c4069d510da45d441578d0 Mon Sep 17 00:00:00 2001 From: Mike Ritter <> Date: Thu, 2 Apr 2009 01:26:29 -0700 Subject: [PATCH 017/143] AI 144166: am: CL 144164 Adding droiddocs/javadocs usage to Pdk-docs to get correct style. Original author: mritter Merged from: //branches/cupcake/... Automated import of CL 144166 --- .../templates-pdk/assets-pdk/favicon.ico | Bin 0 -> 1150 bytes .../templates-pdk/assets-pdk/placeholder | 0 tools/droiddoc/templates-pdk/customization.cs | 98 ++++++++++++++++++ tools/droiddoc/templates-pdk/data.hdf | 4 + tools/droiddoc/templates-pdk/head_tag.cs | 47 +++++++++ 5 files changed, 149 insertions(+) create mode 100644 tools/droiddoc/templates-pdk/assets-pdk/favicon.ico create mode 100644 tools/droiddoc/templates-pdk/assets-pdk/placeholder create mode 100644 tools/droiddoc/templates-pdk/customization.cs create mode 100644 tools/droiddoc/templates-pdk/data.hdf create mode 100644 tools/droiddoc/templates-pdk/head_tag.cs diff --git a/tools/droiddoc/templates-pdk/assets-pdk/favicon.ico b/tools/droiddoc/templates-pdk/assets-pdk/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..d8884b792b29f4650ee03fdf313476b7e751eb90 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x$gfiO1%0|?U!ELq(49~Xw%i7XEj z1JTIh*w`?&$a2`kkmZrt*wli=kk!E0Ftyldm>Lj`O+Pk0$YS{PBdf#39?tq + + + + + + +
+
+
+
+
+ + + + + + + Except as noted, this content is + licensed under + Creative Commons Attribution 2.5. For details and + restrictions, see the Content + License. + + + Except as noted, this content is licensed under Apache 2.0. + For details and restrictions, see the + Content License. + + +

+ Site Terms of Service - + Privacy Policy - + Brand Guidelines +

+ + + Android  r - + diff --git a/tools/droiddoc/templates-pdk/data.hdf b/tools/droiddoc/templates-pdk/data.hdf new file mode 100644 index 0000000000..9411b78718 --- /dev/null +++ b/tools/droiddoc/templates-pdk/data.hdf @@ -0,0 +1,4 @@ +template { + which = normal +} + diff --git a/tools/droiddoc/templates-pdk/head_tag.cs b/tools/droiddoc/templates-pdk/head_tag.cs new file mode 100644 index 0000000000..1a7f1a878c --- /dev/null +++ b/tools/droiddoc/templates-pdk/head_tag.cs @@ -0,0 +1,47 @@ + + + +<?cs + if:page.title ?><?cs + var:page.title ?><?cs + if:sdk.version ?> (<?cs + var:sdk.version ?>)<?cs + /if ?> | <?cs + /if ?>Android Developers + + + + + + + + + + + Android.com
+ +/def ?> @@ -66,22 +95,80 @@ def:guide_nav() ?> - -
-
-
-
+ +
+
+
+ + +
- + referenceguidesdkhomecommunitypublishabout"> + + + + + +
  • + Blog + +
  • + + + \ No newline at end of file diff --git a/tools/droiddoc/templates/assets/android-developer-core.css b/tools/droiddoc/templates/assets/android-developer-core.css index 2a62291897..30165df1a8 100644 --- a/tools/droiddoc/templates/assets/android-developer-core.css +++ b/tools/droiddoc/templates/assets/android-developer-core.css @@ -268,20 +268,16 @@ hr.blue { #headerLinks { margin:10px 10px 0 0; height:13px; -} - -#headerLinks .text { - text-decoration: none; - color: #7FA9B5; font-size: 11px; vertical-align: top; } #headerLinks a { - text-decoration: underline; color: #7FA9B5; - font-size: 11px; - vertical-align: top; +} + +#language { + margin:0 10px; } #search { diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js index 2a8c3bf514..016fa4e49d 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.js +++ b/tools/droiddoc/templates/assets/android-developer-docs.js @@ -4,7 +4,7 @@ var devdocNav; var sidenav; var content; var HEADER_HEIGHT = 117; -var cookie_style = 'android_developer'; +var cookie_namespace = 'android_developer'; var NAV_PREF_TREE = "tree"; var NAV_PREF_PANELS = "panels"; var nav_pref; @@ -70,8 +70,8 @@ function restoreHeight(packageHeight) { $("#nav-tree").css({height:swapperHeight + "px"}); } -function getCookie(cookie) { - var myCookie = cookie_style+"_"+cookie+"="; +function readCookie(cookie) { + var myCookie = cookie_namespace+"_"+cookie+"="; if (document.cookie) { var index = document.cookie.indexOf(myCookie); if (index != -1) { @@ -87,16 +87,15 @@ function getCookie(cookie) { return 0; } -function writeCookie(cookie, val, path, expiration) { +function writeCookie(cookie, val, section, expiration) { if (!val) return; - var date = new Date(); - date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week - expiration = expiration ? expiration : date.toGMTString(); - if (location.href.indexOf("/reference/") != -1) { - document.cookie = cookie_style+'_reference_'+cookie+'='+val+'; expires='+expiration+'; path='+'/'+path; - } else if (location.href.indexOf("/guide/") != -1) { - document.cookie = cookie_style+'_guide_'+cookie+'='+val+'; expires='+expiration+'; path='+'/'+path; + section = section == null ? "_" : "_"+section+"_"; + if (expiration == null) { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week + expiration = date.toGMTString(); } + document.cookie = cookie_namespace+section+cookie+"="+val+"; expires="+expiration+"; path=/"; } function init() { @@ -116,8 +115,8 @@ function init() { if (!isMobile) { $("#resize-packages-nav").resizable({handles: "s", resize: function(e, ui) { resizeHeight(); } }); $(".side-nav-resizable").resizable({handles: "e", resize: function(e, ui) { resizeWidth(); } }); - var cookieWidth = getCookie(cookiePath+'width'); - var cookieHeight = getCookie(cookiePath+'height'); + var cookieWidth = readCookie(cookiePath+'width'); + var cookieHeight = readCookie(cookiePath+'height'); if (cookieWidth) { restoreWidth(cookieWidth); } else if ($(".side-nav-resizable").length) { @@ -175,7 +174,9 @@ function resizeHeight() { $("#packages-nav").css({height:parseInt(resizePackagesNav.css("height")) - 6 + "px"}); //move 6px for handle devdocNav.css({height:sidenav.css("height")}); $("#nav-tree").css({height:swapperHeight + "px"}); - writeCookie("height", resizePackagesNav.css("height"), "", null); + + var section = location.pathname.substring(1,location.pathname.indexOf("/",1)); + writeCookie("height", resizePackagesNav.css("height"), section, null); } function resizeWidth() { @@ -190,7 +191,9 @@ function resizeWidth() { resizePackagesNav.css({width:sidenavWidth}); classesNav.css({width:sidenavWidth}); $("#packages-nav").css({width:sidenavWidth}); - writeCookie("width", sidenavWidth, "", null); + + var section = location.pathname.substring(1,location.pathname.indexOf("/",1)); + writeCookie("width", sidenavWidth, section, null); } function resizeAll() { @@ -207,7 +210,7 @@ function loadLast(cookiePath) { if (location.indexOf("/"+cookiePath+"/") != -1) { return true; } - var lastPage = getCookie(cookiePath + "_lastpage"); + var lastPage = readCookie(cookiePath + "_lastpage"); if (lastPage) { window.location = lastPage; return false; @@ -216,11 +219,11 @@ function loadLast(cookiePath) { } $(window).unload(function(){ - var href = location.href; - if (href.indexOf("/reference/") != -1) { - writeCookie("lastpage", href, "", null); - } else if (href.indexOf("/guide/") != -1) { - writeCookie("lastpage", href, "", null); + var path = location.pathname; + if (path.indexOf("/reference/") != -1) { + writeCookie("lastpage", path, "reference", null); + } else if (path.indexOf("/guide/") != -1) { + writeCookie("lastpage", path, "guide", null); } }); @@ -257,7 +260,7 @@ function buildToggleLists() { } function getNavPref() { - var v = getCookie('reference_nav'); + var v = readCookie('reference_nav'); if (v != NAV_PREF_TREE) { v = NAV_PREF_PANELS; } @@ -283,7 +286,7 @@ function swapNav() { } var date = new Date(); date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years - writeCookie("nav", nav_pref, "", date.toGMTString()); + writeCookie("nav", nav_pref, null, date.toGMTString()); $("#nav-panels").toggle(); $("#panel-link").toggle(); @@ -349,3 +352,57 @@ function toggleAllSummaryInherited(linkObj) { } return false; } + + +function changeTabLang(lang) { + var nodes = $("#header-tabs").find("."+lang); + for (i=0; i < nodes.length; i++) { // for each node in this language + var node = $(nodes[i]); + node.siblings().css("display","none"); // hide all siblings + if (node.not(":empty").length != 0) { //if this languages node has a translation, show it + node.css("display","inline"); + } else { //otherwise, show English instead + node.css("display","none"); + node.siblings().filter(".en").css("display","inline"); + } + } +} + +function changeNavLang(lang) { + var nodes = $("#side-nav").find("."+lang); + for (i=0; i < nodes.length; i++) { // for each node in this language + var node = $(nodes[i]); + node.siblings().css("display","none"); // hide all siblings + if (node.not(":empty").length != 0) { // if this languages node has a translation, show it + node.css("display","inline"); + } else { // otherwise, show English instead + node.css("display","none"); + node.siblings().filter(".en").css("display","inline"); + } + } +} + +function changeDocLang(lang) { + changeTabLang(lang); + changeNavLang(lang); +} + +function changeLangPref(lang) { + var date = new Date(); + date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years + writeCookie("pref_lang", lang, null, date); + + changeDocLang(lang); +} + +function loadLangPref() { + var lang = readCookie("pref_lang"); + if (lang != 0) { + $("#language").find("option[value='"+lang+"']").attr("selected",true); + } +} + +function getLangPref() { + return $("#language").find(":selected").attr("value"); +} + diff --git a/tools/droiddoc/templates/macros.cs b/tools/droiddoc/templates/macros.cs index 3ba743bbf6..a2306a0895 100644 --- a/tools/droiddoc/templates/macros.cs +++ b/tools/droiddoc/templates/macros.cs @@ -233,108 +233,5 @@ def:expandable_class_list(id, classes, default) ?>
    - -
    -
    -
    - - -
    -
    - - - - From 5da317e51d1832cb1ec67dd20fbcff7708bbadb5 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 2 Jun 2009 13:38:17 -0700 Subject: [PATCH 100/143] support incremental updates of boot image Modify applypatch to be able to write MTD partitions as well as read them. Make applypatch save a backup copy of the contents of an MTD partition it reads in cache, to be used in case an update is interrupted while writing back to MTD. Modify OTA package creation script to send boot image updates in patch form. --- tools/applypatch/applypatch.c | 231 +++++++++++++++++------ tools/applypatch/applypatch.h | 5 + tools/releasetools/ota_from_target_files | 64 ++++--- 3 files changed, 220 insertions(+), 80 deletions(-) diff --git a/tools/applypatch/applypatch.c b/tools/applypatch/applypatch.c index 655953354b..db4c30b82c 100644 --- a/tools/applypatch/applypatch.c +++ b/tools/applypatch/applypatch.c @@ -27,9 +27,12 @@ #include "applypatch.h" #include "mtdutils/mtdutils.h" +int SaveFileContents(const char* filename, FileContents file); int LoadMTDContents(const char* filename, FileContents* file); int ParseSha1(const char* str, uint8_t* digest); +static int mtd_partitions_scanned = 0; + // Read a file into memory; store it and its associated metadata in // *file. Return 0 on success. int LoadFileContents(const char* filename, FileContents* file) { @@ -139,15 +142,14 @@ int LoadMTDContents(const char* filename, FileContents* file) { index[i] = i; } - // sort the index[] array so it indexs the pairs in order of + // sort the index[] array so it indexes the pairs in order of // increasing size. size_array = size; qsort(index, pairs, sizeof(int), compare_size_indices); - static int partitions_scanned = 0; - if (!partitions_scanned) { + if (!mtd_partitions_scanned) { mtd_scan_partitions(); - partitions_scanned = 1; + mtd_partitions_scanned = 1; } const MtdPartition* mtd = mtd_find_partition_by_name(partition); @@ -234,6 +236,11 @@ int LoadMTDContents(const char* filename, FileContents* file) { file->sha1[i] = sha_final[i]; } + // Fake some stat() info. + file->st.st_mode = 0644; + file->st.st_uid = 0; + file->st.st_gid = 0; + free(copy); free(index); free(size); @@ -275,6 +282,76 @@ int SaveFileContents(const char* filename, FileContents file) { return 0; } +// Copy the contents of source_file to target_mtd partition, a string +// of the form "MTD:[:...]". Return 0 on success. +int CopyToMTDPartition(const char* source_file, const char* target_mtd) { + char* partition = strchr(target_mtd, ':'); + if (partition == NULL) { + fprintf(stderr, "bad MTD target name \"%s\"\n", target_mtd); + return -1; + } + ++partition; + // Trim off anything after a colon, eg "MTD:boot:blah:blah:blah...". + // We want just the partition name "boot". + partition = strdup(partition); + char* end = strchr(partition, ':'); + if (end != NULL) + *end = '\0'; + + FILE* f = fopen(source_file, "rb"); + if (f == NULL) { + fprintf(stderr, "failed to open %s for reading: %s\n", + source_file, strerror(errno)); + return -1; + } + + if (!mtd_partitions_scanned) { + mtd_scan_partitions(); + mtd_partitions_scanned = 1; + } + + const MtdPartition* mtd = mtd_find_partition_by_name(partition); + if (mtd == NULL) { + fprintf(stderr, "mtd partition \"%s\" not found for writing\n", partition); + return -1; + } + + MtdWriteContext* ctx = mtd_write_partition(mtd); + if (ctx == NULL) { + fprintf(stderr, "failed to init mtd partition \"%s\" for writing\n", + partition); + return -1; + } + + const int buffer_size = 4096; + char buffer[buffer_size]; + size_t read; + while ((read = fread(buffer, 1, buffer_size, f)) > 0) { + size_t written = mtd_write_data(ctx, buffer, read); + if (written != read) { + fprintf(stderr, "only wrote %d of %d bytes to MTD %s\n", + written, read, partition); + mtd_write_close(ctx); + return -1; + } + } + + fclose(f); + if (mtd_erase_blocks(ctx, -1) < 0) { + fprintf(stderr, "error finishing mtd write of %s\n", partition); + mtd_write_close(ctx); + return -1; + } + + if (mtd_write_close(ctx)) { + fprintf(stderr, "error closing mtd write of %s\n", partition); + return -1; + } + + free(partition); + return 0; +} + // Take a string 'str' of 40 hex digits and parse it into the 20 // byte array 'digest'. 'str' may contain only the digest or be of @@ -443,9 +520,10 @@ int main(int argc, char** argv) { " or %s -s \n" " or %s -l\n" "\n" - " or may be of the form\n" - " MTD::::::...\n" - "to specify reading from an MTD partition.\n\n", + "Filenames may be of the form\n" + " MTD:::::" + ":...:\n" + "to specify reading from or writing to an MTD partition.\n\n", argv[0], argv[0], argv[0], argv[0]); return 1; } @@ -480,16 +558,7 @@ int main(int argc, char** argv) { target_filename = source_filename; } - // assume that target_filename (eg "/system/app/Foo.apk") is located - // on the same filesystem as its top-level directory ("/system"). - // We need something that exists for calling statfs(). - char* target_fs = strdup(target_filename); - char* slash = strchr(target_fs+1, '/'); - if (slash != NULL) { - *slash = '\0'; - } - - if (ParseSha1(argv[3], target_sha1) != 0) { + if (ParseSha1(argv[3], target_sha1) != 0) { fprintf(stderr, "failed to parse tgt-sha1 \"%s\"\n", argv[3]); return 1; } @@ -557,39 +626,70 @@ int main(int argc, char** argv) { } } - // Is there enough room in the target filesystem to hold the patched file? - size_t free_space = FreeSpaceForFile(target_fs); - int enough_space = free_space > (target_size * 3 / 2); // 50% margin of error - printf("target %ld bytes; free space %ld bytes; enough %d\n", - (long)target_size, (long)free_space, enough_space); + // Is there enough room in the target filesystem to hold the patched + // file? - if (!enough_space && source_patch_filename != NULL) { - // Using the original source, but not enough free space. First - // copy the source file to cache, then delete it from the original - // location. - - if (strncmp(source_filename, "MTD:", 4) == 0) { - // It's impossible to free space on the target filesystem by - // deleting the source if the source is an MTD partition. If - // we're ever in a state where we need to do this, fail. - fprintf(stderr, "not enough free space for target but source is MTD\n"); - return 1; - } + if (strncmp(target_filename, "MTD:", 4) == 0) { + // If the target is an MTD partition, we're actually going to + // write the output to /tmp and then copy it to the partition. + // statfs() always returns 0 blocks free for /tmp, so instead + // we'll just assume that /tmp has enough space to hold the file. + // We still write the original source to cache, in case the MTD + // write is interrupted. if (MakeFreeSpaceOnCache(source_file.size) < 0) { fprintf(stderr, "not enough free space on /cache\n"); return 1; } - if (SaveFileContents(CACHE_TEMP_SOURCE, source_file) < 0) { fprintf(stderr, "failed to back up source file\n"); return 1; } made_copy = 1; - unlink(source_filename); + } else { + // assume that target_filename (eg "/system/app/Foo.apk") is located + // on the same filesystem as its top-level directory ("/system"). + // We need something that exists for calling statfs(). + char* target_fs = strdup(target_filename); + char* slash = strchr(target_fs+1, '/'); + if (slash != NULL) { + *slash = '\0'; + } size_t free_space = FreeSpaceForFile(target_fs); - printf("(now %ld bytes free for target)\n", (long)free_space); + int enough_space = + free_space > (target_size * 3 / 2); // 50% margin of error + printf("target %ld bytes; free space %ld bytes; enough %d\n", + (long)target_size, (long)free_space, enough_space); + + if (!enough_space && source_patch_filename != NULL) { + // Using the original source, but not enough free space. First + // copy the source file to cache, then delete it from the original + // location. + + if (strncmp(source_filename, "MTD:", 4) == 0) { + // It's impossible to free space on the target filesystem by + // deleting the source if the source is an MTD partition. If + // we're ever in a state where we need to do this, fail. + fprintf(stderr, "not enough free space for target but source is MTD\n"); + return 1; + } + + if (MakeFreeSpaceOnCache(source_file.size) < 0) { + fprintf(stderr, "not enough free space on /cache\n"); + return 1; + } + + if (SaveFileContents(CACHE_TEMP_SOURCE, source_file) < 0) { + fprintf(stderr, "failed to back up source file\n"); + return 1; + } + made_copy = 1; + unlink(source_filename); + + size_t free_space = FreeSpaceForFile(target_fs); + printf("(now %ld bytes free for target)\n", (long)free_space); + } } FileContents* source_to_use; @@ -602,14 +702,19 @@ int main(int argc, char** argv) { patch_filename = copy_patch_filename; } - // We write the decoded output to ".patch". - char* outname = (char*)malloc(strlen(target_filename) + 10); - strcpy(outname, target_filename); - strcat(outname, ".patch"); + char* outname = NULL; + if (strncmp(target_filename, "MTD:", 4) == 0) { + outname = MTD_TARGET_TEMP_FILE; + } else { + // We write the decoded output to ".patch". + outname = (char*)malloc(strlen(target_filename) + 10); + strcpy(outname, target_filename); + strcat(outname, ".patch"); + } FILE* output = fopen(outname, "wb"); if (output == NULL) { - fprintf(stderr, "failed to patch file %s: %s\n", - target_filename, strerror(errno)); + fprintf(stderr, "failed to open output file %s: %s\n", + outname, strerror(errno)); return 1; } @@ -665,22 +770,32 @@ int main(int argc, char** argv) { return 1; } - // Give the .patch file the same owner, group, and mode of the - // original source file. - if (chmod(outname, source_to_use->st.st_mode) != 0) { - fprintf(stderr, "chmod of \"%s\" failed: %s\n", outname, strerror(errno)); - return 1; - } - if (chown(outname, source_to_use->st.st_uid, source_to_use->st.st_gid) != 0) { - fprintf(stderr, "chown of \"%s\" failed: %s\n", outname, strerror(errno)); - return 1; - } + if (strcmp(outname, MTD_TARGET_TEMP_FILE) == 0) { + // Copy the temp file to the MTD partition. + if (CopyToMTDPartition(outname, target_filename) != 0) { + fprintf(stderr, "copy of %s to %s failed\n", outname, target_filename); + return 1; + } + unlink(outname); + } else { + // Give the .patch file the same owner, group, and mode of the + // original source file. + if (chmod(outname, source_to_use->st.st_mode) != 0) { + fprintf(stderr, "chmod of \"%s\" failed: %s\n", outname, strerror(errno)); + return 1; + } + if (chown(outname, source_to_use->st.st_uid, + source_to_use->st.st_gid) != 0) { + fprintf(stderr, "chown of \"%s\" failed: %s\n", outname, strerror(errno)); + return 1; + } - // Finally, rename the .patch file to replace the target file. - if (rename(outname, target_filename) != 0) { - fprintf(stderr, "rename of .patch to \"%s\" failed: %s\n", - target_filename, strerror(errno)); - return 1; + // Finally, rename the .patch file to replace the target file. + if (rename(outname, target_filename) != 0) { + fprintf(stderr, "rename of .patch to \"%s\" failed: %s\n", + target_filename, strerror(errno)); + return 1; + } } // If this run of applypatch created the copy, and we're here, we diff --git a/tools/applypatch/applypatch.h b/tools/applypatch/applypatch.h index 041ac2e152..e0320fb7d2 100644 --- a/tools/applypatch/applypatch.h +++ b/tools/applypatch/applypatch.h @@ -38,6 +38,11 @@ typedef struct _FileContents { // and use it as the source instead. #define CACHE_TEMP_SOURCE "/cache/saved.file" +// When writing to an MTD partition, we first put the output in this +// temp file, then copy it to the partition once the patching is +// finished (and the target sha1 verified). +#define MTD_TARGET_TEMP_FILE "/tmp/mtd-temp" + // applypatch.c size_t FreeSpaceForFile(const char* filename); diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index cd063a19d6..7e36da2c19 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -427,11 +427,12 @@ def Difference(tf, sf, diff_program): cmd.append(ptemp.name) p = common.Run(cmd) _, err = p.communicate() - if err: - raise ExternalError("failure running %s:\n%s\n" % (diff_program, err)) + if err or p.returncode != 0: + print "WARNING: failure running %s:\n%s\n" % (diff_program, err) + return None diff = ptemp.read() - ptemp.close() finally: + ptemp.close() stemp.close() ttemp.close() @@ -478,8 +479,9 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): if tf.name.endswith(".gz"): diff_method = "imgdiff" d = Difference(tf, sf, diff_method) - print fn, tf.size, len(d), (float(len(d)) / tf.size) - if len(d) > tf.size * OPTIONS.patch_threshold: + if d is not None: + print fn, tf.size, len(d), (float(len(d)) / tf.size) + if d is None or len(d) > tf.size * OPTIONS.patch_threshold: # patch is almost as big as the file; don't bother patching tf.AddToZip(output_zip) verbatim_targets.append((fn, tf.size)) @@ -503,11 +505,13 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): '"ro.build.fingerprint=%s") == "true"') % (source_fp, target_fp)) - source_boot = common.BuildBootableImage( - os.path.join(OPTIONS.source_tmp, "BOOT")) - target_boot = common.BuildBootableImage( - os.path.join(OPTIONS.target_tmp, "BOOT")) - updating_boot = (source_boot != target_boot) + source_boot = File("/tmp/boot.img", + common.BuildBootableImage( + os.path.join(OPTIONS.source_tmp, "BOOT"))) + target_boot = File("/tmp/boot.img", + common.BuildBootableImage( + os.path.join(OPTIONS.target_tmp, "BOOT"))) + updating_boot = (source_boot.data != target_boot.data) source_recovery = File("system/recovery.img", common.BuildBootableImage( @@ -543,12 +547,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.append("run_program PACKAGE:applypatch -c /%s %s %s" % (fn, tf.sha1, sf.sha1)) - if patch_list: - script.append("run_program PACKAGE:applypatch -s %d" % - (largest_source_size,)) - script.append("copy_dir PACKAGE:patch CACHE:../tmp/patchtmp") - IncludeBinary("applypatch", target_zip, output_zip) - if updating_recovery: d = Difference(target_recovery, source_recovery, "imgdiff") print "recovery target: %d source: %d diff: %d" % ( @@ -561,6 +559,23 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): (source_recovery.size, source_recovery.sha1, target_recovery.size, target_recovery.sha1)) + if updating_boot: + d = Difference(target_boot, source_boot, "imgdiff") + print "boot target: %d source: %d diff: %d" % ( + target_boot.size, source_boot.size, len(d)) + + output_zip.writestr("patch/boot.img.p", d) + + script.append(("run_program PACKAGE:applypatch -c " + "MTD:boot:%d:%s:%d:%s") % + (source_boot.size, source_boot.sha1, + target_boot.size, target_boot.sha1)) + + if patch_list or updating_recovery or updating_boot: + script.append("run_program PACKAGE:applypatch -s %d" % + (largest_source_size,)) + script.append("copy_dir PACKAGE:patch CACHE:../tmp/patchtmp") + IncludeBinary("applypatch", target_zip, output_zip) script.append("\n# ---- start making changes here\n") @@ -570,8 +585,17 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): DeleteFiles(script, [SubstituteRoot(i[0]) for i in verbatim_targets]) if updating_boot: - script.append("format BOOT:") - output_zip.writestr("boot.img", target_boot) + # Produce the boot image by applying a patch to the current + # contents of the boot partition, and write it back to the + # partition. + script.append(("run_program PACKAGE:applypatch " + "MTD:boot:%d:%s:%d:%s - " + "%s %d %s:/tmp/patchtmp/boot.img.p") + % (source_boot.size, source_boot.sha1, + target_boot.size, target_boot.sha1, + target_boot.sha1, + target_boot.size, + source_boot.sha1)) print "boot image changed; including." else: print "boot image unchanged; skipping." @@ -654,10 +678,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): # permissions. script.extend(temp_script) - if updating_boot: - script.append("show_progress 0.1 5") - script.append("write_raw_image PACKAGE:boot.img BOOT:") - if OPTIONS.extra_script is not None: script.append(OPTIONS.extra_script) From a0f9bd1ef84b66813de40520180e5ec5d608b26d Mon Sep 17 00:00:00 2001 From: Scott Main Date: Tue, 2 Jun 2009 15:41:16 -0700 Subject: [PATCH 101/143] fix build break by reincluding empty method calls that were moved to macros.cs --- tools/droiddoc/templates/customization.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/droiddoc/templates/customization.cs b/tools/droiddoc/templates/customization.cs index d437c2cd36..85204deac5 100644 --- a/tools/droiddoc/templates/customization.cs +++ b/tools/droiddoc/templates/customization.cs @@ -24,3 +24,6 @@ def:custom_masthead() ?> + + + \ No newline at end of file From 653726a40ae4ed0b54c32262dbc7bb86fd22c6ad Mon Sep 17 00:00:00 2001 From: Scott Main Date: Tue, 2 Jun 2009 20:58:23 -0700 Subject: [PATCH 102/143] fix the SDK build for real this time. the missing macros weren't declared in the proper order last time. --- tools/droiddoc/templates/customization.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/droiddoc/templates/customization.cs b/tools/droiddoc/templates/customization.cs index 85204deac5..1988a890c8 100644 --- a/tools/droiddoc/templates/customization.cs +++ b/tools/droiddoc/templates/customization.cs @@ -2,6 +2,10 @@ + + + +
    From 802965380c5c4bc25dc6f793097d97cc69ae2b88 Mon Sep 17 00:00:00 2001 From: Sriram Raman Date: Mon, 22 Jun 2009 17:16:37 -0700 Subject: [PATCH 133/143] Don't install afar and dexpreopt-wrapper on system while building tests. --- tools/dexpreopt/afar/Android.mk | 2 +- tools/dexpreopt/dexopt-wrapper/Android.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dexpreopt/afar/Android.mk b/tools/dexpreopt/afar/Android.mk index d224675b40..9f1b987acb 100644 --- a/tools/dexpreopt/afar/Android.mk +++ b/tools/dexpreopt/afar/Android.mk @@ -24,6 +24,6 @@ LOCAL_C_INCLUDES := external/zlib LOCAL_SHARED_LIBRARIES := libz LOCAL_MODULE := afar -LOCAL_MODULE_TAGS := tests +LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) diff --git a/tools/dexpreopt/dexopt-wrapper/Android.mk b/tools/dexpreopt/dexopt-wrapper/Android.mk index e6ca389c6a..ae2b6a3e76 100644 --- a/tools/dexpreopt/dexopt-wrapper/Android.mk +++ b/tools/dexpreopt/dexopt-wrapper/Android.mk @@ -31,6 +31,6 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE := dexopt-wrapper -LOCAL_MODULE_TAGS := tests +LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) From 9d9f367895655411c42123177ae1c32f104b3c01 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Mon, 22 Jun 2009 18:15:38 -0700 Subject: [PATCH 134/143] Java 1.5 is required. Enforce it. --- core/main.mk | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/core/main.mk b/core/main.mk index bee8c7b00b..fb1a58f7a3 100644 --- a/core/main.mk +++ b/core/main.mk @@ -85,6 +85,44 @@ $(warning ************************************************************) $(error Directory names containing spaces not supported) 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[\. "$$]') +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 $(space)) +$(info Please follow the machine setup instructions at) +$(info $(space)$(space)$(space)$(space)http://source.android.com/download) +$(info ************************************************************) +$(error stop) +endif + +# Check for the correct version of javac +javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.5[\. "$$]') +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 $(space)) +$(info Please follow the machine setup instructions at) +$(info $(space)$(space)$(space)$(space)http://source.android.com/download) +$(info ************************************************************) +$(error stop) +endif + +endif # windows + # These are the modifier targets that don't do anything themselves, but # change the behavior of the build. # (must be defined before including definitions.make) From 9fc74c7823182c4121f32114a7f83ae3fa7e4346 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 23 Jun 2009 16:27:38 -0700 Subject: [PATCH 135/143] don't fail if no required bootloaders are defined Generic targets don't have a list of defined bootloaders. Instead of failing to build an OTA package, just omit the constraint. Fix bad references to ExternalError. --- tools/releasetools/ota_from_target_files | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 1a6ebbf73b..73eccd453f 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -288,11 +288,9 @@ def AppendAssertions(script, input_zip): info = input_zip.read("OTA/android-info.txt") m = re.search(r"require\s+version-bootloader\s*=\s*(\S+)", info) - if not m: - raise ExternalError("failed to find required bootloaders in " - "android-info.txt") - bootloaders = m.group(1).split("|") - script.AssertSomeBootloader(*bootloaders) + if m: + bootloaders = m.group(1).split("|") + script.AssertSomeBootloader(*bootloaders) def WriteFullOTAPackage(input_zip, output_zip): @@ -415,7 +413,7 @@ def GetBuildProp(property, z): return bp m = re.search(re.escape(property) + r"=(.*)\n", bp) if not m: - raise ExternalException("couldn't find %s in build.prop" % (property,)) + raise common.ExternalError("couldn't find %s in build.prop" % (property,)) return m.group(1).strip() @@ -467,7 +465,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): if sf is None or fn in OPTIONS.require_verbatim: # This file should be included verbatim if fn in OPTIONS.prohibit_verbatim: - raise ExternalError("\"%s\" must be sent verbatim" % (fn,)) + raise common.ExternalError("\"%s\" must be sent verbatim" % (fn,)) print "send", fn, "verbatim" tf.AddToZip(output_zip) verbatim_targets.append((fn, tf.size)) From e1c31bacae7be6da140066966e6d2bbadd9331e9 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 23 Jun 2009 17:40:35 -0700 Subject: [PATCH 136/143] make building recovery and boot images optional If the source target-files zip omits files needed to build the recovery and/or boot images, leave them out instead of dying with an error. This lets build like "generic-userdebug" work. --- tools/releasetools/common.py | 41 ++++++++++++++++++------ tools/releasetools/ota_from_target_files | 15 ++++++--- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index afb61a353a..a07ff7c36e 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -63,18 +63,29 @@ def LoadBoardConfig(fn): def BuildAndAddBootableImage(sourcedir, targetname, output_zip): """Take a kernel, cmdline, and ramdisk directory from the input (in 'sourcedir'), and turn them into a boot image. Put the boot image - into the output zip file under the name 'targetname'.""" + into the output zip file under the name 'targetname'. Returns + targetname on success or None on failure (if sourcedir does not + appear to contain files for the requested image).""" print "creating %s..." % (targetname,) img = BuildBootableImage(sourcedir) + if img is None: + return None CheckSize(img, targetname) ZipWriteStr(output_zip, targetname, img) + return targetname def BuildBootableImage(sourcedir): """Take a kernel, cmdline, and ramdisk directory from the input (in - 'sourcedir'), and turn them into a boot image. Return the image data.""" + 'sourcedir'), and turn them into a boot image. Return the image + data, or None if sourcedir does not appear to contains files for + building the requested image.""" + + if (not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK) or + not os.access(os.path.join(sourcedir, "kernel"), os.F_OK)): + return None ramdisk_img = tempfile.NamedTemporaryFile() img = tempfile.NamedTemporaryFile() @@ -89,15 +100,25 @@ def BuildBootableImage(sourcedir): assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,) assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,) - cmdline = open(os.path.join(sourcedir, "cmdline")).read().rstrip("\n") - p = Run(["mkbootimg", - "--kernel", os.path.join(sourcedir, "kernel"), - "--cmdline", cmdline, - "--ramdisk", ramdisk_img.name, - "--output", img.name], - stdout=subprocess.PIPE) + cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")] + + fn = os.path.join(sourcedir, "cmdline") + if os.access(fn, os.F_OK): + cmd.append("--cmdline") + cmd.append(open(fn).read().rstrip("\n")) + + fn = os.path.join(sourcedir, "base") + if os.access(fn, os.F_OK): + cmd.append("--base") + cmd.append(open(fn).read().rstrip("\n")) + + cmd.extend(["--ramdisk", ramdisk_img.name, + "--output", img.name]) + + p = Run(cmd, stdout=subprocess.PIPE) p.communicate() - assert p.returncode == 0, "mkbootimg of %s image failed" % (targetname,) + assert p.returncode == 0, "mkbootimg of %s image failed" % ( + os.path.basename(sourcedir),) img.seek(os.SEEK_SET, 0) data = img.read() diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 73eccd453f..547c65c55b 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -310,8 +310,12 @@ def WriteFullOTAPackage(input_zip, output_zip): script.ShowProgress(0.1, 0) - common.ZipWriteStr(output_zip, "radio.img", input_zip.read("RADIO/image")) - script.WriteFirmwareImage("radio", "radio.img") + try: + common.ZipWriteStr(output_zip, "radio.img", input_zip.read("RADIO/image")) + script.WriteFirmwareImage("radio", "radio.img") + except KeyError: + print "warning: no radio image in input target_files; not flashing radio" + script.ShowProgress(0.5, 0) if OPTIONS.wipe_user_data: @@ -324,9 +328,10 @@ def WriteFullOTAPackage(input_zip, output_zip): symlinks = CopySystemFiles(input_zip, output_zip) script.MakeSymlinks(symlinks) - common.BuildAndAddBootableImage(os.path.join(OPTIONS.input_tmp, "RECOVERY"), - "system/recovery.img", output_zip) - Item.Get("system/recovery.img", dir=False) + if common.BuildAndAddBootableImage( + os.path.join(OPTIONS.input_tmp, "RECOVERY"), + "system/recovery.img", output_zip): + Item.Get("system/recovery.img", dir=False) FixPermissions(script) From 67bae7fc6842db2c2718fd668dde173321ed9b0b Mon Sep 17 00:00:00 2001 From: Brett Chabot Date: Fri, 26 Jun 2009 14:41:30 -0700 Subject: [PATCH 137/143] Change cts makefile to bundle junit.jar. --- core/tasks/cts.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk index 33cdf93bf0..eed9beb737 100644 --- a/core/tasks/cts.mk +++ b/core/tasks/cts.mk @@ -25,6 +25,8 @@ else endif CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar +junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar + CTS_CORE_CASE_LIST := android.core.tests.annotation \ android.core.tests.archive \ android.core.tests.concurrent \ @@ -76,7 +78,9 @@ CTS_CASE_LIST := \ DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans -$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) | $(ACP) +$(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar) + +$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(ACP) # Make necessary directory for CTS @rm -rf $(PRIVATE_CTS_DIR) @mkdir -p $(TMP_DIR) @@ -87,6 +91,8 @@ $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) | $(ACP) # Copy executable to CTS directory $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools +# Copy junit jar + $(hide) $(ACP) -fp $(PRIVATE_JUNIT_HOST_JAR) $(PRIVATE_DIR)/tools # Change mode of the executables $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH)) $(foreach apk,$(CTS_CASE_LIST), \ From 0f3298a497e32f6c2325a0071124a62d031fae6f Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 30 Jun 2009 08:16:58 -0700 Subject: [PATCH 138/143] delete source files not in target Incremental OTAs were not removing files from the old build that don't exist in the new build. Fix. --- tools/releasetools/ota_from_target_files | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 547c65c55b..ea4c752ab3 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -580,7 +580,9 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.FormatPartition("userdata") script.Print("Removing unneeded files...") - script.DeleteFiles(["/"+i[0] for i in verbatim_targets]) + script.DeleteFiles(["/"+i[0] for i in verbatim_targets] + + ["/"+i for i in sorted(source_data) + if i not in target_data]) if updating_boot: # Produce the boot image by applying a patch to the current From c74bbeecd059ae7cdeb14508e068111ccbc713dd Mon Sep 17 00:00:00 2001 From: Chung-yih Wang Date: Thu, 2 Jul 2009 00:36:44 +0800 Subject: [PATCH 139/143] Add the JNI library of CertTool for handling certificates. --- core/prelink-linux-arm.map | 1 + 1 file changed, 1 insertion(+) diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map index 8925e22b30..75c05e5ed9 100644 --- a/core/prelink-linux-arm.map +++ b/core/prelink-linux-arm.map @@ -149,3 +149,4 @@ libUAPI_jni.so 0x9A500000 librpc.so 0x9A400000 libtrace_test.so 0x9A300000 libsrec_jni.so 0x9A200000 +libcerttool_jni.so 0x9A100000 From 6e9c1a6dd0042e123941e59ad5da6fc569093fbb Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 1 Jul 2009 14:18:59 -0700 Subject: [PATCH 140/143] remove some accidentally-submitted debug logging --- tools/applypatch/applypatch.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tools/applypatch/applypatch.c b/tools/applypatch/applypatch.c index 49ec97ff62..185d3de3b7 100644 --- a/tools/applypatch/applypatch.c +++ b/tools/applypatch/applypatch.c @@ -541,14 +541,6 @@ size_t FreeSpaceForFile(const char* filename) { // TODO: make the interface more sensible for use as a library. int applypatch(int argc, char** argv) { - - printf("applypatch argc %d\n", argc); - int xx; - for (xx = 0; xx < argc; ++xx) { - printf("%d %p %s\n", xx, argv[xx], argv[xx]); - fflush(stdout); - } - if (argc < 2) { return 2; } From a8c14e8c33c5af8a388f40517dfb40d6305c6386 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Thu, 2 Jul 2009 08:41:48 -0400 Subject: [PATCH 141/143] Also look in vendor/*/build for vendorsetup.sh --- envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index 541bb11427..984167e458 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1009,7 +1009,7 @@ fi unset _xarray # Execute the contents of any vendorsetup.sh files we can find. -for f in `/bin/ls vendor/*/vendorsetup.sh 2> /dev/null` +for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/build/vendorsetup.sh 2> /dev/null` do echo "including $f" . $f From 4647f12a4ff9dc54247184f17ff3de1cc423f213 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 2 Jul 2009 09:00:54 -0700 Subject: [PATCH 142/143] fix image size tests There are currently two errors in the way we test the size of built images against the size of the partition on the hardware: - the limits in BoardConfig.mk are set with the data size only, but images contain an extra 64 bytes per 2048-byte page. This means we think the partition is about 1/32 smaller than it really is. - when we deliver a build via OTA, the system partition ends up with one more file than when it's flashed via fastboot. That file is a copy of the recovery image. In order to be able to OTA a build, we need to make sure the system partition has enough room for all the system files plus the recovery image as well. For the kila system partition, these errors are roughly the same order of magnitude -- about 2MB, one in the "safe" direction, one in the "unsafe" direction. This change fixes both to give us a more accurate notion of how close we are to the limit. Make the build emit a warning (but not fail) when the size is within 32kb of the limit. Also, include the values of the partition size limits in an info file in the target-files package, so post-processing tools can use them without parsing the BoardConfig.mk file. --- core/Makefile | 183 ++++++++++++++++++++++---------------------- core/definitions.mk | 38 +++++---- 2 files changed, 117 insertions(+), 104 deletions(-) diff --git a/core/Makefile b/core/Makefile index 20522942fd..ea556311cb 100644 --- a/core/Makefile +++ b/core/Makefile @@ -497,6 +497,91 @@ else INTERNAL_MKUSERFS := $(MKYAFFS2) endif +# ----------------------------------------------------------------- +# Recovery image +INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img + +recovery_initrc := $(call include-path-for, recovery)/etc/init.rc +recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system +recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img +recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) +recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery +recovery_resources_common := $(call include-path-for, recovery)/res +recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) +recovery_resource_deps := $(shell find $(recovery_resources_common) \ + $(recovery_resources_private) -type f) + +ifeq ($(recovery_resources_private),) + $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) +endif + +INTERNAL_RECOVERYIMAGE_ARGS := \ + $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ + --kernel $(recovery_kernel) \ + --ramdisk $(recovery_ramdisk) + +# Assumes this has already been stripped +ifdef BOARD_KERNEL_CMDLINE + INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" +endif +ifdef BOARD_KERNEL_BASE + INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) +endif + +# Keys authorized to sign OTA packages this build will accept. The +# build always uses test-keys for this; release packaging tools will +# substitute other keys for this one. +OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem + +# Generate a file containing the keys that will be read by the +# recovery binary. +RECOVERY_INSTALL_OTA_KEYS := \ + $(call intermediates-dir-for,PACKAGING,ota_keys)/keys +DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar +$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) +$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) + @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" + @rm -rf $@ + @mkdir -p $(dir $@) + java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ + +$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ + $(INSTALLED_RAMDISK_TARGET) \ + $(INSTALLED_BOOTIMAGE_TARGET) \ + $(recovery_binary) \ + $(recovery_initrc) $(recovery_kernel) \ + $(INSTALLED_2NDBOOTLOADER_TARGET) \ + $(recovery_build_prop) $(recovery_resource_deps) \ + $(RECOVERY_INSTALL_OTA_KEYS) + @echo ----- Making recovery image ------ + rm -rf $(TARGET_RECOVERY_OUT) + mkdir -p $(TARGET_RECOVERY_OUT) + mkdir -p $(TARGET_RECOVERY_ROOT_OUT) + mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc + mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp + echo Copying baseline ramdisk... + cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) + echo Modifying ramdisk contents... + cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ + cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ + cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ + $(foreach item,$(recovery_resources_private), \ + cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) + cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys + cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ + > $(TARGET_RECOVERY_ROOT_OUT)/default.prop + $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) + $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ + @echo ----- Made recovery image -------- $@ + $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE)) + +else +INSTALLED_RECOVERYIMAGE_TARGET := +endif + +.PHONY: recoveryimage +recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) + # ----------------------------------------------------------------- # system yaffs image # @@ -552,10 +637,10 @@ else SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) endif -$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) | $(ACP) +$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ACP) @echo "Install system fs image: $@" $(copy-file-to-target) - $(hide) $(call assert-max-file-size,$@,$(BOARD_SYSTEMIMAGE_MAX_SIZE)) + $(hide) $(call assert-max-file-size,$@ $(INSTALLED_RECOVERYIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_MAX_SIZE)) systemimage: $(INSTALLED_SYSTEMIMAGE) @@ -651,91 +736,6 @@ userdatatarball-nodeps: $(FS_GET_STATS) # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) -# ----------------------------------------------------------------- -# Recovery image -INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img - -recovery_initrc := $(call include-path-for, recovery)/etc/init.rc -recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system -recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img -recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) -recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery -recovery_resources_common := $(call include-path-for, recovery)/res -recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) -recovery_resource_deps := $(shell find $(recovery_resources_common) \ - $(recovery_resources_private) -type f) - -ifeq ($(recovery_resources_private),) - $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) -endif - -INTERNAL_RECOVERYIMAGE_ARGS := \ - $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ - --kernel $(recovery_kernel) \ - --ramdisk $(recovery_ramdisk) - -# Assumes this has already been stripped -ifdef BOARD_KERNEL_CMDLINE - INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)" -endif -ifdef BOARD_KERNEL_BASE - INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) -endif - -# Keys authorized to sign OTA packages this build will accept. The -# build always uses test-keys for this; release packaging tools will -# substitute other keys for this one. -OTA_PUBLIC_KEYS := $(SRC_TARGET_DIR)/product/security/testkey.x509.pem - -# Generate a file containing the keys that will be read by the -# recovery binary. -RECOVERY_INSTALL_OTA_KEYS := \ - $(call intermediates-dir-for,PACKAGING,ota_keys)/keys -DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar -$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) -$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) - @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS)" - @rm -rf $@ - @mkdir -p $(dir $@) - java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) > $@ - -$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ - $(INSTALLED_RAMDISK_TARGET) \ - $(INSTALLED_BOOTIMAGE_TARGET) \ - $(recovery_binary) \ - $(recovery_initrc) $(recovery_kernel) \ - $(INSTALLED_2NDBOOTLOADER_TARGET) \ - $(recovery_build_prop) $(recovery_resource_deps) \ - $(RECOVERY_INSTALL_OTA_KEYS) - @echo ----- Making recovery image ------ - rm -rf $(TARGET_RECOVERY_OUT) - mkdir -p $(TARGET_RECOVERY_OUT) - mkdir -p $(TARGET_RECOVERY_ROOT_OUT) - mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc - mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp - echo Copying baseline ramdisk... - cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) - echo Modifying ramdisk contents... - cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ - cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ - cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/ - $(foreach item,$(recovery_resources_private), \ - cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) - cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys - cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ - > $(TARGET_RECOVERY_ROOT_OUT)/default.prop - $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) - $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@ - @echo ----- Made recovery image -------- $@ - $(hide) $(call assert-max-file-size,$@,$(BOARD_RECOVERYIMAGE_MAX_SIZE)) - -else -INSTALLED_RECOVERYIMAGE_TARGET := -endif - -.PHONY: recoveryimage -recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) - # ----------------------------------------------------------------- # bring in the installer image generation defines if necessary ifeq ($(TARGET_USE_DISKINSTALLER),true) @@ -799,7 +799,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_RADIOIMAGE_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ - $(BUILT_SYSTEMIMAGE) \ + $(INSTALLED_SYSTEMIMAGE) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(built_ota_tools) \ @@ -857,6 +857,11 @@ endif $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt $(hide) echo "$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/recovery-api-version.txt + $(hide) echo "blocksize $(BOARD_FLASH_BLOCK_SIZE)" > $(zip_root)/META/imagesizes.txt + $(hide) echo "boot $(BOARD_BOOTIMAGE_MAX_SIZE)" >> $(zip_root)/META/imagesizes.txt + $(hide) echo "recovery $(BOARD_RECOVERYIMAGE_MAX_SIZE)" >> $(zip_root)/META/imagesizes.txt + $(hide) echo "system $(BOARD_SYSTEMIMAGE_MAX_SIZE)" >> $(zip_root)/META/imagesizes.txt + $(hide) echo "userdata $(BOARD_USERDATAIMAGE_MAX_SIZE)" >> $(zip_root)/META/imagesizes.txt @# Zip everything up, preserving symlinks $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) @@ -882,7 +887,6 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools @echo "Package OTA: $@" $(hide) ./build/tools/releasetools/ota_from_target_files \ -p $(HOST_OUT) \ - -b $(TARGET_DEVICE_DIR)/BoardConfig.mk \ -k $(KEY_CERT_PAIR) \ $(BUILT_TARGET_FILES_PACKAGE) $@ @@ -1008,7 +1012,6 @@ $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools @echo "Package: $@" $(hide) ./build/tools/releasetools/img_from_target_files \ -p $(HOST_OUT) \ - -b $(TARGET_DEVICE_DIR)/BoardConfig.mk \ $(BUILT_TARGET_FILES_PACKAGE) $@ .PHONY: updatepackage diff --git a/core/definitions.mk b/core/definitions.mk index 1d9dd74b15..485c2ae7ac 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1540,8 +1540,16 @@ ifndef get-file-size $(error HOST_OS must define get-file-size) endif -# $(1): The file to check (often $@) -# $(2): The maximum size, in decimal bytes +# Convert a partition data size (eg, as reported in /proc/mtd) to the +# size of the image used to flash that partition (which includes a +# 64-byte spare area for each 2048-byte page). +# $(1): the partition data size +define image-size-from-data-size +$(shell echo $$(($(1) / 2048 * (2048+64)))) +endef + +# $(1): The file(s) to check (often $@) +# $(2): The maximum total image size, in decimal bytes # # If $(2) is empty, evaluates to "true" # @@ -1550,19 +1558,21 @@ endif # next whole flash block size. define assert-max-file-size $(if $(2), \ - fileSize=`$(call get-file-size,$(1))`; \ - maxSize=$(2); \ - onePct=`expr "(" $$maxSize + 99 ")" / 100`; \ - onePct=`expr "(" "(" $$onePct + $(BOARD_FLASH_BLOCK_SIZE) - 1 ")" / \ - $(BOARD_FLASH_BLOCK_SIZE) ")" "*" $(BOARD_FLASH_BLOCK_SIZE)`; \ - reserve=`expr 2 "*" $(BOARD_FLASH_BLOCK_SIZE)`; \ - if [ "$$onePct" -gt "$$reserve" ]; then \ - reserve="$$onePct"; \ + size=$$(for i in $(1); do $(call get-file-size,$$i); done); \ + total=$$(( $$( echo "$$size" | tr '\n' + ; echo 0 ) )); \ + printname=$$(echo -n "$(1)" | tr " " +); \ + echo "$$printname total size is $$total"; \ + img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \ + twoblocks=$$((img_blocksize * 2)); \ + onepct=$$((((($(2) / 100) - 1) / img_blocksize + 1) * img_blocksize)); \ + reserve=$$((twoblocks > onepct ? twoblocks : onepct)); \ + maxsize=$$(($(2) - reserve)); \ + if [ "$$total" -gt "$$maxsize" ]; then \ + echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \ + false; \ fi; \ - maxSize=`expr $$maxSize - $$reserve`; \ - if [ "$$fileSize" -gt "$$maxSize" ]; then \ - echo "error: $(1) too large ($$fileSize > [$(2) - $$reserve])"; \ - false; \ + if [ "$$total" -gt $$((maxsize - 32768)) ]; then \ + echo "WARNING: $$printname approaching size limit ($$total now; limit $$maxsize)"; \ fi \ , \ true \ From 8cebf1ff7836a5dc365e49f7a14d7546a651d9c7 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Tue, 7 Jul 2009 17:14:25 -0700 Subject: [PATCH 143/143] fix mislaid 'if' in recovery When I moved the building of the recovery image upwards in the file, I moved an 'endif' surrounding it but not the matching 'if'. How did this ever work? --- core/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index ea556311cb..107d0c1354 100644 --- a/core/Makefile +++ b/core/Makefile @@ -499,6 +499,10 @@ endif # ----------------------------------------------------------------- # Recovery image + +# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true +ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) + INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img recovery_initrc := $(call include-path-for, recovery)/etc/init.rc @@ -733,9 +737,6 @@ userdatatarball-nodeps: $(FS_GET_STATS) $(build-userdatatarball-target) -# If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true -ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) - # ----------------------------------------------------------------- # bring in the installer image generation defines if necessary ifeq ($(TARGET_USE_DISKINSTALLER),true)