[Samsung Galaxy Nexus] MBQ_:
cd to your Desktop

command time: (copy/paste em)

mkdir ~/bin
export PATH=~/bin:$PATH
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo

then:

sudo gedit ~/.bashrc

put export PATH=~/bin:$PATH at the bottom, of it

to enable CCACHE, put this code at the bottom of your bash.rc

EXPORT USE_CCACHE=1
export CCACHE_DIR=/path/to/your/ccache/folder (mine is /home/mbq/Desktop/ccache
export CCACHE_LOGFILE=/path/to/your/ccache/ccache.log

save it

then:

mkdir ~/XYAOSP
cd ~/XYAOSP
repo init -u [url]https://github.com/XYAOSP/platform_manifest[/url] -b jb4.2
repo sync -j16 (or -j8, or -j32.. whichever you want)

then:

when youre synced up..

if you want to watch CCACHE to make sure it's working, cd to:

/path/to/your/XYAOSP/prebuilts/misc/linux-x86/cache

then:

ccache -s

to change the size of your CCACHE, cd to:

/path/to/your/XYAOSP/prebuilts/misc/linux-x86

then:

ccache -M 20

(20=20GB, you can set it all the way to 100)

make sure ccache is getting hits. (The first build will take way longer than usual, so be patient). :)

to call linaro out correctly, open your xylon folder, go to build, and edit envsetup.sh (if you see a lock on the file(s), enter this:

sudo chmod -R 777 /path/to/your/XYAOSP/build

then, find:

# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_EABI_TOOLCHAIN=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;

and change:

arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin

to:

arm) toolchaindir=linaro/bin

and:

unset ARM_EABI_TOOLCHAIN ARM_EABI_TOOLCHAIN_PATH
case $ARCH in
arm)
toolchaindir=arm/arm-eabi-$targetgccversion/bin
if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
export ARM_EABI_TOOLCHAIN="$gccprebuiltdir/$toolchaindir"
ARM_EABI_TOOLCHAIN_PATH=":$gccprebuiltdir/$toolchaindir"
fi
;;
mips) toolchaindir=mips/mips-eabi-4.4.3/bin
;;
*)
# No need to set ARM_EABI_TOOLCHAIN for other ARCHs
;;

change:

case $ARCH in
arm)
toolchaindir=arm/arm-eabi-$targetgccversion/bin

to:

case $ARCH in
arm)
toolchaindir=linaro/bin

(Make sure linaro is in

/path/to/your/XYAOSP/prebuilts/gcc/linux-x86/linaro

)

to enable -O3 optimizations, go to:

/path/to/your/XYAOSP/build/core/combo

open: select.mk

edit:

ifneq ($(TARGET_USE_02),true)
$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
else
$(combo_target)GLOBAL_CFLAGS := -O3 -g -Wstrict-aliasing=2
ifneq ($(combo_target),HOST_)
(combo_target)RELEASE_CFLAGS += -Werror=strict-aliasing
endif
endif
$(combo_target)GLOBAL_LDFLAGS := -Wl,-O3
$(combo_target)GLOBAL_ARFLAGS := crsP

change anything -O2 to -O3

save it

then: go to the build/core/combo

then: TARGET_linux-arm.mk

change:

ifeq ($(TARGET_USE_O3),true)
TARGET_arm_CFLAGS := -Os \
-fomit-frame-pointer \
-fstrict-aliasing \
-fno-tree-vectorize
else
TARGET_arm_CFLAGS := -O3 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
endif

to:

ifeq ($(TARGET_USE_O2),true)
TARGET_arm_CFLAGS := -Os \
-fomit-frame-pointer \
-fstrict-aliasing \
-fno-tree-vectorize
else
TARGET_arm_CFLAGS := -O3 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
endif

and:

ifeq ($(ARCH_ARM_HAVE_THUMB_SUPPORT),true)
ifeq ($(TARGET_USE_O2),true)
TARGET_thumb_CFLAGS := -mthumb \
-O2 \
-fomit-frame-pointer \
-fno-strict-aliasing \
-fno-tree-vectorize
else
TARGET_thumb_CFLAGS := -mthumb \
-O3 \
-fomit-frame-pointer \
-fno-strict-aliasing \
-fno-tree-vectorize
endif
else
TARGET_thumb_CFLAGS := $(TARGET_arm_CFLAGS)
endif

to:

ifeq ($(ARCH_ARM_HAVE_THUMB_SUPPORT),true)
ifeq ($(TARGET_USE_O3),true)
TARGET_thumb_CFLAGS := -mthumb \
-O3 \
-fomit-frame-pointer \
-fno-strict-aliasing \
-fno-tree-vectorize
else
TARGET_thumb_CFLAGS := -mthumb \
-O3 \
-fomit-frame-pointer \
-fno-strict-aliasing \
-fno-tree-vectorize
endif
else
TARGET_thumb_CFLAGS := $(TARGET_arm_CFLAGS)
endif

^^ Make any of these changes

prior

to building

to build with GCC 4.9, go to build/core/config.mk and find TARGET_GCC_VERSION := 4.7, change it to 4.9

to get linaro, download this: http://releases.linaro.org/13.04/co...13.04-2-2013-04-13_12-08-43-linux-x86.tar.bz2

then change the folders name to 'linaro'

move it to prebuilts/gcc/linux-x86

then, to build..

. build/envsetup.sh
croot
brunch device -j(2, 4, 8, 16, or 32, your choice)
*Note: Because CCACHE is enabled, it will take a while for your first build to complete. ~2-5 hours

Hope this helps!