am e39ee4d5: am cb48497f: HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
* commit 'e39ee4d5e043872b3ef8053678a9c6020d82d4b6':
HOST_linux-x86: Avoid doubly define macro _FORTIFY_SOURCE
diff --git a/core/Makefile b/core/Makefile
index a81c981..2aab143 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -603,21 +603,19 @@
ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS)
-INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
-
-# $(1): src directory
-# $(2): output file
-# $(3): mount point
-# $(4): ext variant (ext2, ext3, ext4)
-# $(5): size of the partition
-define build-userimage-ext-target
- @mkdir -p $(dir $(2))
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5)
-endef
else
INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2)
endif
+INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
+
+# $(1): the path of the output dictionary file
+define generate-userimage-prop-dictionary
+$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
+$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
+$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
+$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
+$(if $(mkyaffs2_extra_flags),$(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(1))
+endef
# -----------------------------------------------------------------
# Recovery image
@@ -772,25 +770,16 @@
$(call intermediates-dir-for,PACKAGING,systemimage)
BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
-ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
-## generate an ext image
# $(1): output file
define build-systemimage-target
- @echo "Target system fs image: $(1)"
- $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ @echo "Target system fs image: $(1)"
+ @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
+ $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt)
+ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
+ ./build/tools/releasetools/build_image.py \
+ $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1)
endef
-else # INTERNAL_USERIMAGES_USE_EXT != true
-
-## generate a yaffs2 image
-# $(1): output file
-define build-systemimage-target
- @echo "Target system fs image: $(1)"
- @mkdir -p $(dir $(1))
- $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1)
-endef
-endif # INTERNAL_USERIMAGES_USE_EXT
-
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
$(call build-systemimage-target,$@)
@@ -890,28 +879,21 @@
INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
-ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
-## Generate an ext2 image
-define build-userdataimage-target
- $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
- @mkdir -p $(TARGET_OUT_DATA)
- $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),data,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
- $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
-endef
-
-else # INTERNAL_USERIMAGES_USE_EXT != true
-
-## Generate a yaffs2 image
-define build-userdataimage-target
- $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
- @mkdir -p $(TARGET_OUT_DATA)
- $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET)
- $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
-endef
-endif # INTERNAL_USERIMAGES_USE_EXT
-
+userdataimage_intermediates := \
+ $(call intermediates-dir-for,PACKAGING,userdata)
BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
+define build-userdataimage-target
+ $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
+ @mkdir -p $(TARGET_OUT_DATA)
+ @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
+ $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt)
+ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
+ ./build/tools/releasetools/build_image.py \
+ $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET)
+ $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs)
+endef
+
# We just build this directly to the install location.
INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
$(INSTALLED_USERDATAIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) \
@@ -1100,23 +1082,12 @@
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
-ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE
- $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
- $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
$(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt
-ifdef mkyaffs2_extra_flags
- $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG
- $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt
-endif
$(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
ifdef PRODUCT_EXTRA_RECOVERY_KEYS
$(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
endif
+ $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
@# Zip everything up, preserving symlinks
$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
@# Run fs_config on all the system, boot ramdisk, and recovery ramdisk files in the zip, and save the output
diff --git a/core/build_id.mk b/core/build_id.mk
index 70bd235..40bb35d 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -23,7 +23,7 @@
# (like "TC1-RC5"). It must be a single word, and is
# capitalized by convention.
#
-BUILD_ID := MR1
+BUILD_ID := MASTER
# DISPLAY_BUILD_NUMBER should only be set for development branches,
# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 8c89143..89f61da 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -102,7 +102,7 @@
arch_include_dir := $(dir $(android_config_h))
TARGET_GLOBAL_CFLAGS += \
- -msoft-float -fpic \
+ -msoft-float -fpic -fPIE \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -114,11 +114,12 @@
-include $(android_config_h) \
-I $(arch_include_dir)
-# This warning causes dalvik not to build with gcc 4.6 and -Werror.
+# This warning causes dalvik not to build with gcc 4.6.x and -Werror.
# We cannot turn it off blindly since the option is not available
-# in gcc-4.4.x
-ifneq ($(filter 4.6.0%, $(shell $(TARGET_CC) --version)),)
-TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable
+# in gcc-4.4.x. We also want to disable sincos optimization globally
+# by turning off the builtin sin function.
+ifneq ($(filter 4.6.%, $(shell $(TARGET_CC) --version)),)
+TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin
endif
# This is to avoid the dreaded warning compiler message:
@@ -266,7 +267,7 @@
endef
define transform-o-to-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
@@ -287,7 +288,7 @@
endef
define transform-o-to-static-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
-Wl,--gc-sections \
-o $@ \
$(TARGET_GLOBAL_LD_DIRS) \
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 0fb6edc..f38c3d3 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -73,7 +73,7 @@
-Wa,--noexecstack \
-Werror=format-security \
-Wstrict-aliasing=2 \
- -fPIC \
+ -fPIC -fPIE \
-ffunction-sections \
-finline-functions \
-finline-limit=300 \
@@ -158,6 +158,7 @@
-nostdlib -Bdynamic \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,-z,nocopyreloc \
+ -fPIE -pie \
-o $@ \
$(TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
diff --git a/core/config.mk b/core/config.mk
index 41e60ea..d486ed3 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -117,7 +117,10 @@
# If this file doesn't exist, the environemnt variables will
# be used, and if that doesn't work, then the default is an
# arm build
--include $(TOPDIR)buildspec.mk
+ifndef ANDROID_BUILDSPEC
+ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
+endif
+-include $(ANDROID_BUILDSPEC)
# ---------------------------------------------------------------
# Define most of the global variables. These are the ones that
diff --git a/core/envsetup.mk b/core/envsetup.mk
index c3ae3b0..b564ce6 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -102,6 +102,14 @@
HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_ARCH)
endif
+# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
+# Define them here so they can be used in product config files.
+TARGET_COPY_OUT_SYSTEM := system
+TARGET_COPY_OUT_DATA := data
+TARGET_COPY_OUT_VENDOR := system/vendor
+TARGET_COPY_OUT_ROOT := root
+TARGET_COPY_OUT_RECOVERY := recovery
+
# Read the product specs so we an get TARGET_DEVICE and other
# variables that we need in order to locate the output files.
include $(BUILD_SYSTEM)/product_config.mk
@@ -182,7 +190,7 @@
TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
-TARGET_OUT := $(PRODUCT_OUT)/system
+TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin
TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin
TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib
@@ -195,7 +203,7 @@
TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
-TARGET_OUT_DATA := $(PRODUCT_OUT)/data
+TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)
TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES)
TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_JAVA_LIBRARIES)
@@ -206,7 +214,7 @@
TARGET_OUT_DATA_STATIC_LIBRARIES:= $(TARGET_OUT_STATIC_LIBRARIES)
TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
-TARGET_OUT_VENDOR := $(PRODUCT_OUT)/system/vendor
+TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
TARGET_OUT_VENDOR_EXECUTABLES:= $(TARGET_OUT_VENDOR)/bin
TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES:= $(TARGET_OUT_VENDOR)/xbin
TARGET_OUT_VENDOR_SHARED_LIBRARIES:= $(TARGET_OUT_VENDOR)/lib
@@ -221,13 +229,13 @@
TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin
TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
-TARGET_ROOT_OUT := $(PRODUCT_OUT)/root
+TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin
TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
-TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/recovery
+TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)
TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader
diff --git a/core/main.mk b/core/main.mk
index 569d4dc..e35f228 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -441,7 +441,6 @@
sdk/ide_common \
sdk/jarutils \
sdk/layoutlib_api \
- sdk/layoutopt \
sdk/ninepatch \
sdk/rule_api \
sdk/lint \
diff --git a/core/user_tags.mk b/core/user_tags.mk
index 2e7017e..b88e541 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -171,7 +171,6 @@
layoutlib_api \
layoutlib_create \
layoutlib_utils \
- layoutopt \
liba2dp \
libabi \
libandroid \
@@ -494,7 +493,6 @@
traceview \
tune2fs \
tune2fs_host \
- uix \
usbtest \
vdc \
vm-tests \
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index ceb1898..d2f4c09 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -77,7 +77,6 @@
ddms \
hierarchyviewer \
draw9patch \
- layoutopt \
traceview \
android \
dexdump \
@@ -95,8 +94,6 @@
ddmuilib \
draw9patch \
hierarchyviewer \
- layoutopt \
- uix \
traceview \
anttasks \
sdklib \
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
new file mode 100755
index 0000000..b5140a9
--- /dev/null
+++ b/tools/releasetools/build_image.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#
+# 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.
+
+"""
+Build image output_image_file from input_directory and properties_file.
+
+Usage: build_image input_directory properties_file output_image_file
+
+"""
+import os
+import subprocess
+import sys
+
+
+def BuildImage(in_dir, prop_dict, out_file):
+ """Build an image to out_file from in_dir with property prop_dict.
+
+ Args:
+ in_dir: path of input directory.
+ prop_dict: property dictionary.
+ out_file: path of the output image file.
+
+ Returns:
+ True iff the image is built successfully.
+ """
+ build_command = []
+ fs_type = prop_dict.get("fs_type", "")
+ if fs_type.startswith("ext"):
+ build_command = ["mkuserimg.sh"]
+ if "extfs_sparse_flag" in prop_dict:
+ build_command.append(prop_dict["extfs_sparse_flag"])
+ build_command.extend([in_dir, out_file, fs_type,
+ prop_dict["mount_point"]])
+ if "partition_size" in prop_dict:
+ build_command.append(prop_dict["partition_size"])
+ else:
+ build_command = ["mkyaffs2image", "-f"]
+ if prop_dict.get("mkyaffs2_extra_flags", None):
+ build_command.extend(prop_dict["mkyaffs2_extra_flags"].split())
+ build_command.append(in_dir)
+ build_command.append(out_file)
+
+ print "Running: ", " ".join(build_command)
+ p = subprocess.Popen(build_command);
+ p.communicate()
+ return p.returncode == 0
+
+
+def ImagePropFromGlobalDict(glob_dict, mount_point):
+ """Build an image property dictionary from the global dictionary.
+
+ Args:
+ glob_dict: the global dictionary from the build system.
+ mount_point: such as "system", "data" etc.
+ """
+ d = {}
+ common_props = (
+ "fs_type",
+ "extfs_sparse_flag",
+ "mkyaffs2_extra_flags",
+ )
+ for p in common_props:
+ if p in glob_dict:
+ d[p] = glob_dict[p]
+
+ d["mount_point"] = mount_point
+ if mount_point == "system":
+ if "system_size" in glob_dict:
+ d["partition_size"] = str(glob_dict["system_size"])
+ elif mount_point == "data":
+ if "userdata_size" in glob_dict:
+ d["partition_size"] = str(glob_dict["userdata_size"])
+
+ return d
+
+
+def LoadGlobalDict(filename):
+ """Load "name=value" pairs from filename"""
+ d = {}
+ f = open(filename)
+ for line in f:
+ line = line.strip()
+ if not line or line.startswith("#"):
+ continue
+ k, v = line.split("=", 1)
+ d[k] = v
+ f.close()
+ return d
+
+
+def main(argv):
+ if len(argv) != 3:
+ print __doc__
+ sys.exit(1)
+
+ in_dir = argv[0]
+ glob_dict_file = argv[1]
+ out_file = argv[2]
+
+ glob_dict = LoadGlobalDict(glob_dict_file)
+ image_filename = os.path.basename(out_file)
+ mount_point = ""
+ if image_filename == "system.img":
+ mount_point = "system"
+ elif image_filename == "userdata.img":
+ mount_point = "data"
+
+ image_properties = ImagePropFromGlobalDict(glob_dict, mount_point)
+ if not BuildImage(in_dir, image_properties, out_file):
+ print >> sys.stderr, "error: failed to build %s from %s" % (out_file, in_dir)
+ exit(1)
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index c5b9886..4388f69 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -47,6 +47,7 @@
if not hasattr(os, "SEEK_SET"):
os.SEEK_SET = 0
+import build_image
import common
OPTIONS = common.OPTIONS
@@ -64,27 +65,13 @@
os.mkdir(user_dir)
img = tempfile.NamedTemporaryFile()
- build_command = []
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
+ "data")
fstab = OPTIONS.info_dict["fstab"]
- if fstab and fstab["/data"].fs_type.startswith("ext"):
- build_command = ["mkuserimg.sh"]
- if "extfs_sparse_flag" in OPTIONS.info_dict:
- build_command.append(OPTIONS.info_dict["extfs_sparse_flag"])
- build_command.extend([user_dir, img.name,
- fstab["/data"].fs_type, "data"])
- if "userdata_size" in OPTIONS.info_dict:
- build_command.append(str(OPTIONS.info_dict["userdata_size"]))
- else:
- build_command = ["mkyaffs2image", "-f"]
- extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None)
- if extra:
- build_command.extend(extra.split())
- build_command.append(user_dir)
- build_command.append(img.name)
-
- p = common.Run(build_command);
- p.communicate()
- assert p.returncode == 0, "build userdata.img image failed"
+ if fstab:
+ image_props["fs_type" ] = fstab["/data"].fs_type
+ succ = build_image.BuildImage(user_dir, image_props, img.name)
+ assert succ, "build userdata.img image failed"
common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
output_zip.write(img.name, "userdata.img")
@@ -115,28 +102,14 @@
if (e.errno == errno.EEXIST):
pass
- build_command = []
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
+ "system")
fstab = OPTIONS.info_dict["fstab"]
- if fstab and fstab["/system"].fs_type.startswith("ext"):
-
- build_command = ["mkuserimg.sh"]
- if "extfs_sparse_flag" in OPTIONS.info_dict:
- build_command.append(OPTIONS.info_dict["extfs_sparse_flag"])
- build_command.extend([os.path.join(OPTIONS.input_tmp, "system"), img.name,
- fstab["/system"].fs_type, "system"])
- if "system_size" in OPTIONS.info_dict:
- build_command.append(str(OPTIONS.info_dict["system_size"]))
- else:
- build_command = ["mkyaffs2image", "-f"]
- extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None)
- if extra:
- build_command.extend(extra.split())
- build_command.append(os.path.join(OPTIONS.input_tmp, "system"))
- build_command.append(img.name)
-
- p = common.Run(build_command)
- p.communicate()
- assert p.returncode == 0, "build system.img image failed"
+ if fstab:
+ image_props["fs_type" ] = fstab["/system"].fs_type
+ succ = build_image.BuildImage(os.path.join(OPTIONS.input_tmp, "system"),
+ image_props, img.name)
+ assert succ, "build system.img image failed"
img.seek(os.SEEK_SET, 0)
data = img.read()
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index bed0333..cd9e332 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -42,7 +42,7 @@
long posn;
bool hasDD;
- //LOGV("initFromCDE ---\n");
+ //ALOGV("initFromCDE ---\n");
/* read the CDE */
result = mCDE.read(fp);
@@ -280,50 +280,50 @@
bool ZipEntry::compareHeaders(void) const
{
if (mCDE.mVersionToExtract != mLFH.mVersionToExtract) {
- LOGV("cmp: VersionToExtract\n");
+ ALOGV("cmp: VersionToExtract\n");
return false;
}
if (mCDE.mGPBitFlag != mLFH.mGPBitFlag) {
- LOGV("cmp: GPBitFlag\n");
+ ALOGV("cmp: GPBitFlag\n");
return false;
}
if (mCDE.mCompressionMethod != mLFH.mCompressionMethod) {
- LOGV("cmp: CompressionMethod\n");
+ ALOGV("cmp: CompressionMethod\n");
return false;
}
if (mCDE.mLastModFileTime != mLFH.mLastModFileTime) {
- LOGV("cmp: LastModFileTime\n");
+ ALOGV("cmp: LastModFileTime\n");
return false;
}
if (mCDE.mLastModFileDate != mLFH.mLastModFileDate) {
- LOGV("cmp: LastModFileDate\n");
+ ALOGV("cmp: LastModFileDate\n");
return false;
}
if (mCDE.mCRC32 != mLFH.mCRC32) {
- LOGV("cmp: CRC32\n");
+ ALOGV("cmp: CRC32\n");
return false;
}
if (mCDE.mCompressedSize != mLFH.mCompressedSize) {
- LOGV("cmp: CompressedSize\n");
+ ALOGV("cmp: CompressedSize\n");
return false;
}
if (mCDE.mUncompressedSize != mLFH.mUncompressedSize) {
- LOGV("cmp: UncompressedSize\n");
+ ALOGV("cmp: UncompressedSize\n");
return false;
}
if (mCDE.mFileNameLength != mLFH.mFileNameLength) {
- LOGV("cmp: FileNameLength\n");
+ ALOGV("cmp: FileNameLength\n");
return false;
}
#if 0 // this seems to be used for padding, not real data
if (mCDE.mExtraFieldLength != mLFH.mExtraFieldLength) {
- LOGV("cmp: ExtraFieldLength\n");
+ ALOGV("cmp: ExtraFieldLength\n");
return false;
}
#endif
if (mCDE.mFileName != NULL) {
if (strcmp((char*) mCDE.mFileName, (char*) mLFH.mFileName) != 0) {
- LOGV("cmp: FileName\n");
+ ALOGV("cmp: FileName\n");
return false;
}
}
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 62c9383..9e5ee42 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -253,7 +253,7 @@
if (buf[i] == 0x50 &&
ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature)
{
- LOGV("+++ Found EOCD at buf+%d\n", i);
+ ALOGV("+++ Found EOCD at buf+%d\n", i);
break;
}
}
@@ -303,7 +303,7 @@
/*
* Loop through and read the central dir entries.
*/
- LOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries);
+ ALOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries);
int entry;
for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) {
ZipEntry* pEntry = new ZipEntry;
@@ -334,7 +334,7 @@
result = UNKNOWN_ERROR;
goto bail;
}
- LOGV("+++ EOCD read check passed\n");
+ ALOGV("+++ EOCD read check passed\n");
}
bail:
@@ -799,7 +799,7 @@
/* only read if the input buffer is empty */
if (zstream.avail_in == 0 && !atEof) {
- LOGV("+++ reading %d bytes\n", (int)kBufSize);
+ ALOGV("+++ reading %d bytes\n", (int)kBufSize);
if (data) {
getSize = size > kBufSize ? kBufSize : size;
memcpy(inBuf, data, getSize);
@@ -813,7 +813,7 @@
}
}
if (getSize < kBufSize) {
- LOGV("+++ got %d bytes, EOF reached\n",
+ ALOGV("+++ got %d bytes, EOF reached\n",
(int)getSize);
atEof = true;
}
@@ -840,7 +840,7 @@
if (zstream.avail_out == 0 ||
(zerr == Z_STREAM_END && zstream.avail_out != (uInt) kBufSize))
{
- LOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf));
+ ALOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf));
if (fwrite(outBuf, 1, zstream.next_out - outBuf, dstFp) !=
(size_t)(zstream.next_out - outBuf))
{