Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,768,414 Members 50,727 Now Online
XDA Developers Android and Mobile Development Forum
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

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

Tip us?
 
MBQ_
Old
(Last edited by MBQ_; 8th May 2013 at 07:32 PM.)
#1  
Account currently disabled - OP
Thanks Meter 23069
Posts: 13,923
Join Date: Sep 2011
Location: Phoenix, Arizona

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

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!
The Following 20 Users Say Thank You to MBQ_ For This Useful Post: [ Click to Expand ]
 
MBQ_
Old
#2  
Account currently disabled - OP
Thanks Meter 23069
Posts: 13,923
Join Date: Sep 2011
Location: Phoenix, Arizona

 
DONATE TO ME
Reserved! Just in case
The Following 3 Users Say Thank You to MBQ_ For This Useful Post: [ Click to Expand ]
 
RoyJ
Old
#3  
RoyJ's Avatar
Senior Member
Thanks Meter 1387
Posts: 2,465
Join Date: Apr 2012
Location: 203
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
*Click for device info
 

ROM: All of them at least once
KERNEL: Bricked Stable
RECOVERY: TWRP 2.3.6.4
Other Devices: Galaxy Nexus
 
MBQ_
Old
#4  
Account currently disabled - OP
Thanks Meter 23069
Posts: 13,923
Join Date: Sep 2011
Location: Phoenix, Arizona

 
DONATE TO ME
Quote:
Originally Posted by RoyJ View Post
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: [ Click to Expand ]
 
sert00
Old
#5  
sert00's Avatar
Senior Member
Thanks Meter 505
Posts: 1,082
Join Date: May 2011
Location: cesena,IT
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.
^__^
My current mobile devices:
Samsung galaxy nexus maguro version 16Gb
Asus transformer WiFi-only 16Gb
Asus nexus 7 WiFi-only 16Gb
My current system embedded boards in use:
Arduino UNO (x2)
Arduino Mega 2560 (ADK support with USBHost Shield)
My current ARM boards:
Raspberry Pi rev.B
Hardkernel odroid-U2 with Exynos4412 PRIME x2 and all optional addons
Hardkernel odroid-XU-E with Exynos5410 x1 and all optional addons
 
beekay201
Old
#6  
beekay201's Avatar
Senior Member
Thanks Meter 1126
Posts: 4,640
Join Date: Nov 2010
If you change TARGET_GCC_VERSION to 4.9... You'll need to wget Linaro 4.9.. No?

Sent from my Nexus
hammerhead/omni-KTU84P/stock#3.4.0/M8974A-2.0.50.1.13
maguro/aosp-KRT16O/custom#3.0.101/XXLJ1
manta/omni-KTU84P/custom#3.4.39
XDA forum rules here
bug report? logcat and /proc/kmsg, or it "never happened".
How TO Ask questions on the Internet
aosp-maguro READFIRST here (credit: efrant)
aosp-gnex READSECOND here (credit: efrant)
 
MBQ_
Old
#7  
Account currently disabled - OP
Thanks Meter 23069
Posts: 13,923
Join Date: Sep 2011
Location: Phoenix, Arizona

 
DONATE TO ME
Quote:
Originally Posted by bk201doesntexist View Post
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
 
MisterSprinkles
Old
#8  
MisterSprinkles's Avatar
Senior Member
Thanks Meter 228
Posts: 221
Join Date: May 2013
Location: Westmoreland

 
DONATE TO ME
Great guide! Thanks!!
 
MBQ_
Old
#9  
Account currently disabled - OP
Thanks Meter 23069
Posts: 13,923
Join Date: Sep 2011
Location: Phoenix, Arizona

 
DONATE TO ME
Quote:
Originally Posted by MisterSprinkles View Post
Great guide! Thanks!!
Thank you!

Sent from my Galaxy Nexus using xda premium
 
frost866
Old
#10  
frost866's Avatar
Senior Member
Thanks Meter 108
Posts: 336
Join Date: Nov 2010
Location: GTA
should I dl the CCATCH separately? and what about ccatch.log? how to address that?


THREAD CLOSED
Subscribe
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes