[GUIDE][DEV][AOSP/LINARO]Compile SaberMod ROM on Ubuntu 12.04+ 64-bit

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
Hi all, I don't have a nexus 7 3G so I decided to post this guide for people that want to build their own ROMs using my AOSP source from github.

Working on both Ubuntu 12.04+


NOTE: DEPENDING ON YOUR COMPUTER'S HARDWARE, COMPILING TIME WILL BE DIFFERENT
If you have a MAC OSX, I do not have a guide for that as I don't have one.


EVERYTHING THAT IS IN A BOX, OPEN TERMINAL AND ENTER THE COMMAND IN THAT SECTION

Guide Requirements:
- Computer
- Common Sense
- Some Linux Experience
- Ubuntu 64-bit Installed
- At least 4GB of ram with a quad core processor.


Required Software to Install:

Code:
sudo apt-get install git-core gnupg flex bison python gawk p7zip-full gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool xsltproc wx2.8-doc lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-glx libreadline6-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils gcc-4.7 g++-4.7
Link libx11
Code:
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
1a. Use this guide to install it before continuing. Use java 1.7
http://forum.xda-developers.com/showpost.php?p=33061055&postcount=1

Setting Up Android SDK

2a. Download Android SDK at http://developer.android.com/sdk/index.html

2b. Extract it to your home folder [e. x. ~/android/sdk]

Setting Up the .bashrc file

Code:
gedit ~/.bashrc
Add this to the very bottom of the file:
Code:
export PATH=$PATH:~/bin:~/android/sdk:~/android/sdk/tools:~/android/sdk/platform-tools
Setup Workplace

3a. Downloading the Source
Code:
mkdir -p ~/bin
mkdir -p ~/android/SaberMod
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
(Open a new terminal window after this)

3b. Setup Necessary Source

Code:
cd ~/android/SaberMod
Code:
repo init -u https://github.com/SaberMod/android.git -b sm-jb-mr1
3c. Download Necessary Source. Put the number of cpu's you have where # is
Code:
repo sync -j#
3d. Set up ccache. The suggested cache size is 50-100GB. You will need to run the following commands once you have downloaded the source code:
Code:
prebuilts/misc/linux-x86/ccache/./ccache -M 50G
3e. Extract needed files for building a fully funtional ROM. I've added CyanogenMod's extraction scripts to the device tree for tilapia which is only needed to be run one time. Do not do this with every build. Make sure your device is plugged in and adb is working.
Code:
bash device/asus/tilapia/extract-files
3f. Building the source code
Building The Source
Code:
bash sm-tilapia
Checking for updates
Code:
repo sync -j#
My own current working builds for tilapia can be found HERE
Note which ones are for tilapia and which ones are for grouper


Gapps (optional add-on package) can be found HERE

Original thread for the device I own for a full list of changes is HERE

Full ROM source code including kernel is available from viewing on my github HERE
 
Last edited:

Synman

Recognized Developer
Nov 2, 2010
826
547
0
Outside Philadelphia
www.shellware.com
This is a great guide. I really like the CM extract-files script. If you go back far enough in AOSP commit history you can find the commit where the blobs file was deleted. Looking at the diff will get you the file before it was nerfed.

Also, unrelated, but figure I'd help support fellow devs as this drove me nuts. Not sure if it is already in CM but the following core res is required if you have any hope of getting network based location services going:

Code:
    <string-array name="config_locationProviderPackageNames" translatable="false">
        <!-- The standard AOSP fused location provider -->
        <item>com.android.location.fused</item>
        <!-- The Google Network Location Services location provider -->
        <item>com.google.android.location</item>
    </string-array>
Got that one from craigacgomes over at rootzwiki
http://rootzwiki.com/topic/36369-rompure-android-42-jelly-bean-aosp/page__st__160#entry1023485
 
  • Like
Reactions: PVL_93_RU

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
This is a great guide. I really like the CM extract-files script. If you go back far enough in AOSP commit history you can find the commit where the blobs file was deleted. Looking at the diff will get you the file before it was nerfed.

Also, unrelated, but figure I'd help support fellow devs as this drove me nuts. Not sure if it is already in CM but the following core res is required if you have any hope of getting network based location services going:

Code:
        com.android.location.fused
        
        com.google.android.location
Got that one from craigacgomes over at rootzwiki
http://rootzwiki.com/topic/36369-rompure-android-42-jelly-bean-aosp/page__st__160#entry1023485
The fused location is already in there. And I got it from XDA not rootzwiki. I'll add the blobs file as well thanks for pointing that out. Wonder why it got removed :/

Sent from my Nexus 7 using Tapatalk 2
 
Last edited:

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
gotcha! thanks again for the share... It got me past my last hurdle building pure aosp
I'm really confused on what your talking about man... Are you trying to build my source? This guide is only for discussion of building my Rom source.

Sent from my Nexus 7 using Tapatalk 2
 

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
I added kernel building to the source yesterday so your name should be in the kernel version :)
This makes it 100x easier so I don't have to commit the prebuilt kernel into the source and build the kernel seperate from the ROM source.

Sent from my Nexus 7 using Tapatalk 2
 

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
Glad to hear. Some new features lockscreen shortcut targets and time/date shortcuts are in. Clicking on the time in notification drawer takes you to alarm settings. Clicking on date will take you to calendar. Long pressing either one will take you to date and time settings.


Sent from my Nexus 7 using Tapatalk 2
 
  • Like
Reactions: wesStyle

KemikalElite

Senior Member
Jan 28, 2011
642
222
0
I attempted to build the Xylon ROM for the Galaxy Nexus using the guide at the thread linked below. I tried using your GCC toolchain from the SaberMod github repo since it was the first Linaro 4.9 toolchain I found. It gave me a internal compiler error.

ROM Compile Guide (Galaxy Nexus): http://forum.xda-developers.com/showthread.php?t=2269825

Do you have any idea what might be causing it? Thanks in advance.

Code:
external/aac/libAACenc/src/aacenc_tns.cpp: In function 'INT FDKaacEnc_TnsEncode(TNS_INFO*, TNS_DATA*, INT, const TNS_CONFIG*, INT, FIXP_DBL*, INT, INT)':
external/aac/libAACenc/src/aacenc_tns.cpp:1004:5: error: definition in block 48 follows the use
 INT FDKaacEnc_TnsEncode(
     ^
for SSA_NAME: value_155 in statement:
# DEBUG D#405 => MAX_EXPR <value_155, _111>
external/aac/libAACenc/src/aacenc_tns.cpp:1004:5: internal compiler error: verify_ssa failed
0xc2358c verify_ssa(bool)
	../.././../gcc/gcc-SaberMod/gcc/tree-ssa.c:1046
0x9f66e2 execute_function_todo
	../.././../gcc/gcc-SaberMod/gcc/passes.c:1970
0x9f704d execute_todo
	../.././../gcc/gcc-SaberMod/gcc/passes.c:2002
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [/home/kemikalelite/android/out/target/product/maguro/obj/STATIC_LIBRARIES/libFraunhoferAAC_intermediates/libAACenc/src/aacenc_tns.o] Error 1
Also: There should be a link to the other guide thread I used at the top my quote. This is the fourth fifth sixth attempt to post this at this thread due to a reply bug in Tapatalk. Putting this notice here in case it goes to the wrong thread again.
 

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
I attempted to build the Xylon ROM for the Galaxy Nexus using the guide at the thread linked below. I tried using your GCC toolchain from the SaberMod github repo since it was the first Linaro 4.9 toolchain I found. It gave me a internal compiler error.

ROM Compile Guide (Galaxy Nexus): http://forum.xda-developers.com/showthread.php?t=2269825

Do you have any idea what might be causing it? Thanks in advance.

Code:
external/aac/libAACenc/src/aacenc_tns.cpp: In function 'INT FDKaacEnc_TnsEncode(TNS_INFO*, TNS_DATA*, INT, const TNS_CONFIG*, INT, FIXP_DBL*, INT, INT)':
external/aac/libAACenc/src/aacenc_tns.cpp:1004:5: error: definition in block 48 follows the use
 INT FDKaacEnc_TnsEncode(
     ^
for SSA_NAME: value_155 in statement:
# DEBUG D#405 => MAX_EXPR <value_155, _111>
external/aac/libAACenc/src/aacenc_tns.cpp:1004:5: internal compiler error: verify_ssa failed
0xc2358c verify_ssa(bool)
	../.././../gcc/gcc-SaberMod/gcc/tree-ssa.c:1046
0x9f66e2 execute_function_todo
	../.././../gcc/gcc-SaberMod/gcc/passes.c:1970
0x9f704d execute_todo
	../.././../gcc/gcc-SaberMod/gcc/passes.c:2002
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [/home/kemikalelite/android/out/target/product/maguro/obj/STATIC_LIBRARIES/libFraunhoferAAC_intermediates/libAACenc/src/aacenc_tns.o] Error 1
Also: There should be a link to the other guide thread I used at the top my quote. This is the fourth fifth sixth attempt to post this at this thread due to a reply bug in Tapatalk. Putting this notice here in case it goes to the wrong thread again.
My toolchain is not Linaro, it's SaberMod toolchain I built myself. Er, this guide isn't for building Xylon it's for building SaberMod
 
V

vikas724

Guest
My toolchain is not Linaro, it's SaberMod toolchain I built myself. Er, this guide isn't for building Xylon it's for building SaberMod
EDIT - After 12 hours its finally done

sparksco I am following the guide of CI3kener to build your toolchain. I have repo synced eveything , but when I run the script to make the android eabi folder, it runs fine for first few minutes then hangs. I am using it in virtual box. Have assigned 6 gb ram and have 20 gb of swap size. But its getting forward in a snail's pace. It stops responding then after 15-20 minutes I see 3-4 lines in terminal then the same thing again. Good thing is it hasnt stopped however slow it maybe :p

Any suggestions.
 
Last edited:

DualJoe

Senior Member
Oct 12, 2011
2,046
927
193
de
EDIT - After 12 hours its finally done

sparksco I am following the guide of CI3kener to build your toolchain. I have repo synced eveything , but when I run the script to make the android eabi folder, it runs fine for first few minutes then hangs. I am using it in virtual box. Have assigned 6 gb ram and have 20 gb of swap size. But its getting forward in a snail's pace. It stops responding then after 15-20 minutes I see 3-4 lines in terminal then the same thing again. Good thing is it hasnt stopped however slow it maybe :p

Any suggestions.
Check 'Makefile.in'. Variable 'NUM_JOBS' is probably not declared resulting in infinite(!) jobs. Set manually as workaround. I have no clue how this should be handled properly. Maybe i'm missing a parent script here?

Edit: Fixed in latest releases.
 
Last edited:

sparksco

Inactive Recognized Developer
Feb 27, 2010
10,048
8,861
0
docs.google.com
EDIT - After 12 hours its finally done

sparksco I am following the guide of CI3kener to build your toolchain. I have repo synced eveything , but when I run the script to make the android eabi folder, it runs fine for first few minutes then hangs. I am using it in virtual box. Have assigned 6 gb ram and have 20 gb of swap size. But its getting forward in a snail's pace. It stops responding then after 15-20 minutes I see 3-4 lines in terminal then the same thing again. Good thing is it hasnt stopped however slow it maybe :p

Any suggestions.
I fixed the high resource issue. It was a commit from AOSP I reverted.
 

jianmushi

Member
Jul 17, 2013
17
0
0
Burlington
Hey, I am a beginer on ROM dev.
I was setting up AOSP build enviroment on Ubuntu 12.04 64 bit and I followed google's tutorial, when i was on the step

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386

There is error prompt up,

The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 9.0-0ubuntu1)
Recommends: libgl1-mesa-dri:i386 (>= 7.2)
E: Unable to correct problems, you have held broken packages.

I can't install libglapi-mesa:i386 or libgl1-mesa-dri:i386, as doing so would remove my xserver component. I am not sure what is the next step.