Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python, Cortex-A53 & other revisions (hope some of my changes are useful to whoever) #10

Open
wants to merge 10 commits into
base: lp5.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1673,13 +1673,17 @@ ifneq ($(TARGET_UNIFIED_DEVICE),)
endif
endif

ifneq ($(OLD_OTA),true)
$(INTERNAL_OTA_PACKAGE_TARGET): block_ota := --block
endif

$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
@echo "$(OTA_FROM_TARGET_SCRIPT)" > $(PRODUCT_OUT)/ota_script_path
@echo "$(override_device)" > $(PRODUCT_OUT)/ota_override_device
@echo -e ${CL_YLW}"Package OTA:"${CL_RST}" $@"
$(hide) MKBOOTIMG=$(MKBOOTIMG) \
$(OTA_FROM_TARGET_SCRIPT) -v \
--block \
$(block_ota) \
-p $(HOST_OUT) \
-k $(KEY_CERT_PAIR) \
--backup=$(backuptool) \
Expand Down
5 changes: 5 additions & 0 deletions core/combo/arch/arm64/armv8-a.mk
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
arch_variant_cflags :=

ifeq ($(TARGET_CPU_CORTEX_A53),true)
arch_variant_ldflags := -Wl,--fix-cortex-a53-843419 \
-Wl,--fix-cortex-a53-835769
endif
8 changes: 8 additions & 0 deletions core/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver generic cortex-a53))
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a53))
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES += needfix_835769
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := $(subst $(space),$(comma),$(strip $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)))
endif
endif

ifdef TARGET_2ND_ARCH
Expand All @@ -569,6 +573,10 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_2ND_CPU_VARI
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
ifneq (,$(filter $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver cortex-a53))
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
ifneq (,$(filter $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT),cortex-a53))
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES += needfix_835769
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := $(subst $(space),$(comma),$(strip $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)))
endif
endif
endif

Expand Down
20 changes: 15 additions & 5 deletions core/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ dont_bother_goals := clean clobber dataclean installclean \
ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
dont_bother := true
endif
ifeq ($(MAKECMDGOALS),cleaner)
dont_bother := true
endif

# Targets that provide quick help on the build system.
include $(BUILD_SYSTEM)/help.mk
Expand Down Expand Up @@ -324,10 +327,11 @@ endif

user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
WITH_DEXPREOPT := false
tags_to_install :=
ifneq (,$(user_variant))
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0

ifeq ($(user_variant),userdebug)
# Pick up some extra useful tools
Expand All @@ -337,7 +341,7 @@ ifneq (,$(user_variant))
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
else
# Disable debugging in plain user builds.
enable_target_debugging :=
enable_target_debugging := true
endif

# Turn on Dalvik preoptimization for libdvm.so user builds, but only if not
Expand All @@ -347,7 +351,7 @@ ifneq (,$(user_variant))
ifeq ($(DALVIK_VM_LIB),libdvm.so)
ifeq ($(user_variant),user)
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT := true
WITH_DEXPREOPT := false
endif
endif
endif
Expand Down Expand Up @@ -379,6 +383,7 @@ endif # !enable_target_debugging

ifeq ($(TARGET_BUILD_VARIANT),eng)
tags_to_install := debug eng
WITH_DEXPREOPT := false
ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),)
# Don't require the setup wizard on eng builds
ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
Expand Down Expand Up @@ -1054,14 +1059,19 @@ endif # samplecode in $(MAKECMDGOALS)
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)

.PHONY: clean
clean:
.PHONY: cleaner
cleaner:
@rm -rf $(OUT_DIR)/*
@echo -e ${CL_GRN}"Entire build directory removed."${CL_RST}

.PHONY: clobber
clobber: clean

.PHONY: clean
clean:
@rm -rf $(OUT_DIR)/target/product/*/
@echo -e ${CL_GRN}"Working device build directory removed."${CL_RST}

# The rules for dataclean and installclean are defined in cleanbuild.mk.

#xxx scrape this from ALL_MODULE_NAME_TAGS
Expand Down
5 changes: 0 additions & 5 deletions target/product/core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,24 @@ PRODUCT_PACKAGES += \
BasicDreams \
Browser \
Calculator \
Calendar \
CalendarProvider \
CaptivePortalLogin \
CertInstaller \
Contacts \
DeskClock \
DocumentsUI \
DownloadProviderUi \
Email \
Exchange2 \
ExternalStorageProvider \
FusedLocation \
InputDevices \
KeyChain \
Keyguard \
LatinIME \
ManagedProvisioning \
PicoTts \
PacProcessor \
libpac \
PrintSpooler \
ProxyHandler \
QuickSearchBox \
Settings \
SharedStorageBackup \
Telecom \
Expand Down
3 changes: 0 additions & 3 deletions target/product/full_base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ PRODUCT_AAPT_CONFIG := normal
# Get some sounds
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)

# Get the TTS language packs
$(call inherit-product-if-exists, external/svox/pico/lang/all_pico_languages.mk)

# Get a list of languages.
$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)

Expand Down
2 changes: 0 additions & 2 deletions target/product/generic_no_telephony.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ PRODUCT_PACKAGES := \
Bluetooth \
Camera2 \
Gallery2 \
Email \
Exchange2 \
MusicFX \
OneTimeInitializer \
Provision \
Expand Down
8 changes: 0 additions & 8 deletions target/product/sdk_base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)

# include available languages for TTS in the system image
-include external/svox/pico/lang/PicoLangDeDeInSystem.mk
-include external/svox/pico/lang/PicoLangEnGBInSystem.mk
-include external/svox/pico/lang/PicoLangEnUsInSystem.mk
-include external/svox/pico/lang/PicoLangEsEsInSystem.mk
-include external/svox/pico/lang/PicoLangFrFrInSystem.mk
-include external/svox/pico/lang/PicoLangItItInSystem.mk

# locale. en_US is both first and in alphabetical order to
# ensure this is the default locale.
PRODUCT_LOCALES := \
Expand Down
16 changes: 16 additions & 0 deletions tools/releasetools/build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,22 @@ def BuildImage(in_dir, prop_dict, out_file,
build_command.extend(["-j", prop_dict["journal_size"]])
if "timestamp" in prop_dict:
build_command.extend(["-T", str(prop_dict["timestamp"])])
else:
#Timestamp not provided in property_dict.
#Lets try to find the build.prop file and get the timestamp from there
#instead
path = in_dir + "/build.prop"
if os.path.exists(path):
with open(path) as f:
lines = f.readlines()
for line in lines:
line = line.strip()
if line.startswith("ro.build.date.utc"):
name, value = line.split("=", 1)
print "read ro.build.date.utc from build.prop as ", value
build_command.extend(["-T", value])
else:
print "unable to open build.prop file..Image will be built using system time"
if fs_config is not None:
build_command.extend(["-C", fs_config])
if block_list is not None:
Expand Down
40 changes: 40 additions & 0 deletions tools/releasetools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,46 @@ def ReadFile(self):
return result


def ZipWrite(zip_file, filename, arcname=None, perms=0o644,
compress_type=None):
import datetime

# http://b/18015246
# Python 2.7's zipfile implementation wrongly thinks that zip64 is required
# for files larger than 2GiB. We can work around this by adjusting their
# limit. Note that `zipfile.writestr()` will not work for strings larger than
# 2GiB. The Python interpreter sometimes rejects strings that large (though
# it isn't clear to me exactly what circumstances cause this).
# `zipfile.write()` must be used directly to work around this.
#
# This mess can be avoided if we port to python3.
saved_zip64_limit = zipfile.ZIP64_LIMIT
zipfile.ZIP64_LIMIT = (1 << 32) - 1

if compress_type is None:
compress_type = zip_file.compression
if arcname is None:
arcname = filename

saved_stat = os.stat(filename)

try:
# `zipfile.write()` doesn't allow us to pass ZipInfo, so just modify the
# file to be zipped and reset it when we're done.
os.chmod(filename, perms)

# Use a fixed timestamp so the output is repeatable.
epoch = datetime.datetime.fromtimestamp(0)
timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds()
os.utime(filename, (timestamp, timestamp))

zip_file.write(filename, arcname=arcname, compress_type=compress_type)
finally:
os.chmod(filename, saved_stat.st_mode)
os.utime(filename, (saved_stat.st_atime, saved_stat.st_mtime))
zipfile.ZIP64_LIMIT = saved_zip64_limit


def ZipWriteStr(zip, filename, data, perms=0644, compression=None):
# use a fixed timestamp so the output is repeatable.
zinfo = zipfile.ZipInfo(filename=filename,
Expand Down
6 changes: 6 additions & 0 deletions tools/releasetools/img_from_target_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ def banner(s):

finally:
print "cleaning up..."
# http://b/18015246
# See common.py for context. zipfile also refers to ZIP64_LIMIT during
# close() when it writes out the central directory.
saved_zip64_limit = zipfile.ZIP64_LIMIT
zipfile.ZIP64_LIMIT = (1 << 32) - 1
output_zip.close()
zipfile.ZIP64_LIMIT = saved_zip64_limit
shutil.rmtree(OPTIONS.input_tmp)

print "done."
Expand Down