ota: Fix recovery-script cleanups in block mode

Change-Id: Iadb480f8062cfb7a0e6c9024e32ac0d71a7481d7
Build: Add support for specifying build variant in brunch/breakfast

This little modification allows specifying build variant in brunch/
breakfast commands. For example we can use "brunch i9300 user" to build
user variant instead of default userdebug.

When no extra argument is given, userdebug is default.

Change-Id: I935327252098ee74b34a815a023d2ac6b9a53a30
build: Clean up use of vendor/extra

 * extra_config.mk is not needed anymore
 * Include BoardConfigExtra.mk if available

Change-Id: Icd0db0852ceee5cb5c701c9a40b829e1f3ebd69e
build: qcom: Set QCOM_*_PATH variables for hardware/qcom-* projects

This consolidates a bunch of one-off logic scattered throughout the
code base.  Usage in Android.mk files is trivial:

At top level, use e.g. "ifeq ($(call my-dir),$(QCOM_AUDIO_PATH))".
This works for all variants, including non-variants (i.e. AOSP).

Within subdirs, use e.g. hardware/qcom/audio => $(QCOM_AUDIO_PATH)

Change-Id: Iee2497ea9a7efeb4ae9e861b84c532b19da7b69d

build: Introduce project pathmap and use it for qcom variants

The project pathmap tracks the path to the top level of a project.  The
following functions are provided:

 * project-set-path adds an entry.
 * project-set-path-variant adds a "variant" entry.
 * project-path-for retrieves an entry.

To use as a guard in Android.mk:

  ifeq ($(call my-dir),$(call project-path-for,projectname))

To use for include paths in Android.mk:

  LOCAL_C_INCLUDES += $(call project-path-for,projectname)/...

Set project pathmap for qcom project variants.

Change-Id: I8dceca72a1ba80fc7b1830c5ab285d444f530457

build: Set QCOM variants for non-QCOM_HARDWARE defined targets

* Nexus devices and others typically do not define the QCOM_HARDWARE
  flag, so the variant path should always default to the AOSP variant.
* Unconditionally set the variant to the AOSP HAL by default.

Change-Id: I714170897128f92718af266366cfcbf3136e8981
[HAX] Allow per-target dtbTool

 * Revert this when fixed

Change-Id: I97ecb0448ae7bd5859454be290c5dde6248b2859

build: Default to dtbToolCM

* The default dtbTool isn't the correct module name for the module that
  actually lives in device/qcom/common/dtbtool

Change-Id: I80b427e3652b99742573bc4d2829e51645a8822b
Redo BOARD_CUSTOM_BOOTIMG_MK support

Simplified version of the previous implementation. Recovery's ramdisk
is spun off from the main recovery target again to allow overriding
just the image-generation step
Consolidate bash version checks

There were two checks for bash version, the 2nd was superfluous; this
patch removes the duplicate checks, and shifts the bash version check to
being back after the "are we in bash" check.

Change-Id: I57ff8c1fedce80f739c06643d2976d2c1465db1b
envsetup: export ANDROID_BUILD_TOP earlier

Change-Id: Ia3497f61f4e9aaeeb793cecd3b4f488f0a48181a
build: fix bash completion sourcing

Sourcing functions in files from a function within a file being
sourced was giving bash a hard time. This fixes 'repo' command tab
completions.

Change-Id: Iac1b3078e20749fb474ed1270e0886cf435e24d9
Fix file-size stats on OSX

Kernel makefiles that the stat on the system is GNU stat. GNU stat uses the "-c" option to specify format.
Darwin stat uses the "-f" option to specify format. This discrepency will cause kernel build breaks.
On my system, I symlink stat to GNU stat. This causes the "get-file-size" define
to fail.
The fix for this is to detect "gstat", aka GNU stat, and use that appropriately.

Change-Id: I987c155b7dc3ff14ffe6da40edf834ca34b7df75

Fix up the get-file-size function that was broken due to the prior commit that made it utilize gnu stat (gstat)

Change-Id: I24bba2bfcb509ad1ad76d2260eedd685ba45c393
Define CONFIG_64BIT for LP64 target

Linux kernel uapi headers use CONFIG_64BIT flag. We need to define that if
__LP64__ flag is defined.

Change-Id: I2143ca8d91d70506485f3eb6f21a9e5243c495cc
build: Add support for device tree in boot.img

Add support for optional device tree image (dt.img)
to boot and recovery images.  Some devices use kernel device
tree and this adds the device tree image as a section within
the boot/recovery images.

Change-Id: I91431ef2f4b86485895678916e39a8572be878eb
Build: add DT image variable to Makefile

DT image variable is currently present in
generate_extra_images.mk.This file is moved to
build/tasks to support persist image generation
during parallel make. As build/tasks is called
at the end of Makefile, DT image variable is not
available for other images generation like boot and
recovery. Adding this variable in Makefile ensures
the variable is defined before usage

Change-Id: I21f675d8ce648dc1cf1f4f3aede33278300e08c9
CRs-fixed: 548299
Fix case where boot/recovery.img were being built with wrong params.

The boot and recovery images  now get built using the same params during ota package
generation as during a normal build.

Change-Id: I93d46e11a4245288f0e87c87a2e4bf45ac5aff69
Fix the extra dt.img compilation issue.

Add support for optional device tree image (dt.img)
for device that doesnt have TARGET_BOOTIMAGE_USE_EXT2

Change-Id: I6e07b3ca6d049a8ebdad7ea304b4f39e7c846151
Fixing Compilation issue

Change-Id: I1ad1e91498aee877c78cf85656fe704c585fb0cf
framework: adding security-bridge

adding security-bridge to FRAMEWORK_BASE_SUBDIRS
to make it compile as part of the framework/base java module

Change-Id: Ic96ba5549525fcaa58c274f918ac511f69cb0096
enable sdiv support in ART

ART looks for TARGET_CPU_VARIANT to determine hardware
instruction set support. QCOM chipsets set TARGET_CPU_VARIANT
as "generic", so we add it to ART's look-up list.

Change-Id: I07917f3f9c86dca15951698510024e39b1fee565
Fully expand eng/debug/tests module install files

When including eng, debug and tests modules that are tagged
using LOCAL_MODULE_TAGS, fully expand the install file list
from just the tagged module to all the module's INSTALLED
list.  This allows auto-generated files such as dex preopt
odex files tagged under the module's INSTALLED list to be
included.  This also makes the behavior of specifying a
module as debug using LOCAL_MODULE_TAGS to be the same as
specifying it as PRODUCT_PACKAGES_DEBUG when building
for userdebug or eng variant.

Change-Id: If9a24b62d8bee9e378f3e5f58e9490e963238302
Allow override of DEX_PREOPT_DEFAULT

Allow device-specific override of DEX_PREOPT_DEFAULT value
rather than dependent on the number of runtimes supported
by the system.  This allows force generation of
non-stripped packages even when dex pre-opt is enabled
with only 1 runtime.

Change-Id: I57573ce17dc46b7eccf1a3619b073ead1b77c134