build: Handle custom boot images properly

When a pre-built image should be used, it should be stored in the
target files zip so that it can be used with external signing
processes.

Original-Change-Id: I2661af9ac58af30bb9314b552775046d3abf44e0
Change-Id: I10b3bd0bb33489b8ffb26d16d002f8dd6ff405ad
clang:compiling with O3 flag

Change-Id: Id4d56ee3b6b250674df852ff8b1c583c3c80f0fc
arm:thumb:compiling with  O2

The compiler was targeting -Os before this commit, now it targets -O2

Change-Id: I07929b161610acd0a2cebb63a383720b6078d59c
Pass O3 optimization flag to arm and thumb targets

Also passing two extra optimization flags : fgcse-sm and fgcse-las
The last two are not enabled by default by any optimization levels
Change-Id: I27b05be6a103ed1064859eff57f5ec87be7bb1be
No error on array-bounds

O3 flag raises an error when array subscript is above array bounds, passing Wno-array-bounds prevents the compiler to stop working when facing this error

Change-Id: Ide8d80360bb2ee351b8aa5bebb4a2c1f58a26ea7
build: Use project pathmap for recovery

Change-Id: I6339ac77b899a43db21261d587252b65cb58ad79
build: clean up otasigcheck

- Only mount and unmount /data if it was originally unmounted
- Don't use comparison hack, just check the result of the script

Change-Id: I4a22485d315cf91e95ce578907c49f5fa3a03222
ota: Let devices specify their own recovery-from-boot.p installer

Some devices apply transformations to the installed images, making
the sha1 checksums fail (or, worse, generating invalid images). If
"/system/etc/recovery-transform.sh" exists, run that instead, passing
the expected sizes and checksums as arguments in the form of

recovery-transform.sh <recovery_size> <recovery_sha1> <boot_size> <boot_sha1>

A direct emulation of the standard patcher could look like this, transformations
should be added as needed.

----------------
RECSIZE=$1
RECSHA1=$2
BOOTSIZE=$3
BOOTSHA1=$4

dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=$C/recovery.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=$C/boot.img

if ! applypatch -c EMMC:$C/recovery.img:$RECSIZE:$RECSHA1; then
  log -t recovery "Installing new recovery image"
  applypatch -b /system/etc/recovery-resource.dat EMMC:$C/boot.img:$BOOTSIZE:$BOOTSHA1 EMMC:$C/recovery.img $RECSHA1 $RECSIZE $BOOTSHA1:/system/recovery-from-boot.p || exit 1
else
  log -t recovery "Recovery image already installed"
fi
----------------

Conflicts:
	tools/releasetools/ota_from_target_files

Change-Id: Ie601841ca1cdad6b8f3b16e593d2718a92e8ca09
clang: added unsupported flags to CLANG_CONFIG_arm_UNKNOWN_CFLAGS

fgcse-las and fgcse-sm are not supported by clang, we have to notice the compiler to ignore them

Change-Id: I136dfc309c6f9801285458d134de8fcdc757b4bf
No errors on strict overflow

Wno-strict-overflow prevents the compilers to stop its compilation upon strict overflow

Change-Id: I5483325133002ab44034198c3f784f299e74cfd1
Merge remote-tracking branch 'cyanogen/cm-12.0' into HEAD
LD_FLAGS: use JustArchi V3's flags

Change-Id: I04e47f3f534f58244bb36929b8017a2da8481f84