View Poll Results: Do you want more in-depth tutorials?
Yes!!! 1 100.00%
No thanks, there is already an abundance of guides 0 0%
Voters: 1. You may not vote on this poll

Thread Closed

[HOW-TO] Sync Xylons source, build with GCC 4.9, Linaro, enable -O3, & use CCACHE

OP MBQ_

8th May 2013, 07:13 PM   |  #1  
OP Account currently disabled
Flag Phoenix, Arizona
Thanks Meter: 23,071
 
13,923 posts
Join Date:Joined: Sep 2011
Donate to Me
More
cd to your Desktop
command time: (copy/paste em)
Code:
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:
Code:
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
Code:
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:
Code:
mkdir ~/XYAOSP
cd ~/XYAOSP
repo init -u https://github.com/XYAOSP/platform_manifest -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:
Code:
/path/to/your/XYAOSP/prebuilts/misc/linux-x86/cache
then:
Code:
ccache -s
to change the size of your CCACHE, cd to:
Code:
/path/to/your/XYAOSP/prebuilts/misc/linux-x86
then:
Code:
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:
Code:
sudo chmod -R 777 /path/to/your/XYAOSP/build
then, find:
Code:
    # 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:
Code:
        arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
to:
Code:
        arm) toolchaindir=linaro/bin
and:
Code:
    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:
Code:
    case $ARCH in
        arm)
            toolchaindir=arm/arm-eabi-$targetgccversion/bin
to:
Code:
    case $ARCH in
        arm)
            toolchaindir=linaro/bin
(Make sure linaro is in
Code:
/path/to/your/XYAOSP/prebuilts/gcc/linux-x86/linaro
)

to enable -O3 optimizations, go to:
Code:
/path/to/your/XYAOSP/build/core/combo
open: select.mk

edit:
Code:
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:
Code:
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:
Code:
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:
Code:
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:
Code:
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/com...ux-x86.tar.bz2

then change the folders name to 'linaro'

move it to prebuilts/gcc/linux-x86

then, to build..
Code:
. 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!
Last edited by MBQ_; 8th May 2013 at 07:32 PM.
The Following 20 Users Say Thank You to MBQ_ For This Useful Post: [ View ]
8th May 2013, 07:30 PM   |  #2  
OP Account currently disabled
Flag Phoenix, Arizona
Thanks Meter: 23,071
 
13,923 posts
Join Date:Joined: Sep 2011
Donate to Me
More
Reserved! Just in case
The Following 3 Users Say Thank You to MBQ_ For This Useful Post: [ View ]
8th May 2013, 08:38 PM   |  #3  
RoyJ's Avatar
Senior Member
Flag 203
Thanks Meter: 1,610
 
2,682 posts
Join Date:Joined: Apr 2012
More
repo sync -j16 (or -j8, or -j32.. whichever you want)

What's the difference between them. Trying to build for toro wondering which one I should use, thanks
8th May 2013, 09:15 PM   |  #4  
OP Account currently disabled
Flag Phoenix, Arizona
Thanks Meter: 23,071
 
13,923 posts
Join Date:Joined: Sep 2011
Donate to Me
More
Quote:
Originally Posted by RoyJ

repo sync -j16 (or -j8, or -j32.. whichever you want)

What's the difference between them. Trying to build for toro wondering which one I should use, thanks

How many threads of each core is used

Sent from my Galaxy Nexus using xda premium
The Following User Says Thank You to MBQ_ For This Useful Post: [ View ]
9th May 2013, 09:30 AM   |  #5  
sert00's Avatar
Senior Member
Flag cesena,IT
Thanks Meter: 505
 
1,082 posts
Join Date:Joined: May 2011
More
if you have a 4x cpu you can go for -j8\-k16 and so on.i always used -j16 in the past,now it's big time i don't anything.
Great 3ad kyler,you explain all very well,especially the toolchain part rather that other guides out there.I stopped build for myself some months ago,but definetly a good howto for who have time and effort to try.
^__^
9th May 2013, 06:06 PM   |  #6  
beekay201's Avatar
Senior Member
Thanks Meter: 1,129
 
4,647 posts
Join Date:Joined: Nov 2010
More
If you change TARGET_GCC_VERSION to 4.9... You'll need to wget Linaro 4.9.. No?

Sent from my Nexus
9th May 2013, 06:59 PM   |  #7  
OP Account currently disabled
Flag Phoenix, Arizona
Thanks Meter: 23,071
 
13,923 posts
Join Date:Joined: Sep 2011
Donate to Me
More
Quote:
Originally Posted by bk201doesntexist

If you change TARGET_GCC_VERSION to 4.9... You'll need to wget Linaro 4.9.. No?

Sent from my Nexus

Not to my knowledge. Xylon uses Sabermods toolchain
9th May 2013, 09:35 PM   |  #8  
MisterSprinkles's Avatar
Senior Member
Flag Westmoreland
Thanks Meter: 228
 
221 posts
Join Date:Joined: May 2013
Donate to Me
More
Great guide! Thanks!!
12th May 2013, 03:28 AM   |  #9  
OP Account currently disabled
Flag Phoenix, Arizona
Thanks Meter: 23,071
 
13,923 posts
Join Date:Joined: Sep 2011
Donate to Me
More
Quote:
Originally Posted by MisterSprinkles

Great guide! Thanks!!

Thank you!

Sent from my Galaxy Nexus using xda premium
13th May 2013, 10:06 PM   |  #10  
frost866's Avatar
Senior Member
Flag GTA
Thanks Meter: 108
 
336 posts
Join Date:Joined: Nov 2010
More
should I dl the CCATCH separately? and what about ccatch.log? how to address that?

Thread Closed Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy Nexus General by ThreadRank