• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE][COMPLETE]How to build ROM with Google Cloud

Search This thread

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
What is this Tutorial?
This tutorial will help you learn about building a custom ROM from source on Google Cloud.

Who this tutorial is for?
This tutorial is for those who want to build a custom ROM from source, but are unable to do that because of following reasons:
1. Low network speed
2. Limited bandwidth
3. Irregular power supply which obstructs the repo sync (yes, this is a reason in some countries ;))

What is needed for you to start with this thread?
1. A google account
2. A credit card – This is a must to start using Google Cloud Update: I read that people have successfully used debit cards as well.; so try your luck
With you card you can activate free trial and use Google Cloud without any charges for 12 months. Your card will be charged for $1 for verification purpose (and that’s it, the charges on my credit card got reversed in a day- I’m not sure about the reversal of the charges on debit card charges will be reversed on the cards [But I'm not responsible if they don't revert it ;)]).
3. A PC with good (average will also do, I used 512 kbps connection) internet connection (to access Google Cloud, your bandwidth will not be used much).
4. Common sense ;) (you should have it as you are reading this thread)
5. Willingness to read, search and ask right questions in right forums, communities

So, let’s start our journey!

Part – I
Activating Google Cloud FREE Trial
1. Go to Google Cloud website: https://cloud.google.com/ and click on Free Trial button
tz27LHx.png


2. Login with your Google account username and password.
mgEf2dv.png


3. Click on SIGN UP FOR FREE TRIAL
9qOMBwV.png


Enter all the details and click on Accept and start free trial button
GH2OA8Q.png


4. It will start your free trial and create first project for you
BzFeEqB.png


Congratulations! You have completed the most important Part – I of the process and you are now ready to setup the environment for building your ROM!
Update: Now the free trial validity is 1 year so more time to learn how to build the ROM :)

Part – II
Creating Virtual machine on Google Compute Engine
1. Click on the 2 lines menu displayed on the left top corner to bring on the Products and Services list on left side.
biULzBF.png


2. In this menu, click on Compute Engine
RIPTqDJ.png


3. It’ll show following page, click on Create Instance button
4TXdFra.png


4. On Create Instance page, specify the details like Name, Zone (if you want to change them). In Machine Type combo, select a machine configuration that you would like to have.
I use 4 cores and 15 GB memory
WhWrNF7.png


5. In Boot disk section, click on Change button.
UGOwFl1.png


6. On Boot disk details page, select the OS that you want to have on VM Instance. I always used Ubuntu 14.04 LTS (and it never let me down). Update: Now I use 16.04 LTS
yP8GGAM.png


Enter the size of disk. I used 500 GB so that I can sync 2-3 ROMs in the same VM Instance ;) Then click on Select button.
Note: With this configuration I was able to clean build a ROM in around 70 minutes. The repo sync took around 25-30 minutes (which would have taken a week on my slow internet connection)
7. It’ll take you back to Create Instance page. Here you can specify the Firewall by checking both the check boxes. Finally click on Create button to create the VM Instance.
oFGBz2G.png


8. It’ll take a minute or two and create the VM instance. It’ll be in running state as indicated by the Green check box in front of the VM Name.
Note: You can start or stop the instance by selecting it and then clicking on stop or start button. It is advised to stop the VM instance once you are done with using it.
i23zi1r.png


9. Click on the 3 dots menu near SSH and select option Open in browser window.
10. It’ll start the SSH connection to the VM Instance that you have created.
04ISl7i.png


11. Run following command to get su
Code:
sudo –s

RvIEXeI.png


Now you are ready to install the required packages to build the ROM from source. You can follow this nice guide created by @jackeagle to start:
http://forum.xda-developers.com/showpost.php?p=54118614&postcount=2
That was it!
Wish you all the best for building your first ROM :D
 
Last edited:

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
How to upload the ROM zip on internet?

Many guys, who were able to build the ROM successfully, were asking about how to get the ROM zip on phone :D

Thanks @hackslash for this nice post: http://forum.xda-developers.com/showpost.php?p=68750149&postcount=146

Upload to AFH: https://forum.xda-developers.com/showpost.php?p=73420609&postcount=315

You can also upload it on Google drive by following these steps:
http://olivermarshall.net/how-to-upload-a-file-to-google-drive-from-the-command-line/ (thanks @Papdya for sharing this link)

Nitin
 
Last edited:

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
Awesome guide. I'm sure it'll help out those who are trying hard to build their first ROM and get involved in building stuff. Just a suggestion though
I find @akhilnarang script to be easy to setup server and it's just few commands away. It'd be nice if you include that
Link : github.com/akhilnarang/scripts

-ThugLife™

Sure buddy! I'll have a look an include them.

I suffered a lot to build my first ROM (you know that)... So thought to share this easy and fast way to build the ROM. I observed that initially we have to build many times due to errors (coming from lack of knowledge about building). This will reduce the time that is required for "build - error - fix- rebuild" cycle and learn ROM building quickly :fingers-crossed:
 

allanlgz

Senior Member
May 19, 2014
138
29
To make sure i understand, technically I could build roms on a chromebook with this guide? And the guide listed at the end, do we download all those things on our computer or on the cloud platform? Thanks!
 

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
To make sure i understand, technically I could build roms on a chromebook with this guide? And the guide listed at the end, do we download all those things on our computer or on the cloud platform? Thanks!

As @Shreesha.Murthy says, you do everything on Google cloud. That's the whole point of writing this thread :p

Sent from my Nexus 4 using XDA Free mobile app
 

allanlgz

Senior Member
May 19, 2014
138
29
Cloud platform m8 :wink:

-ThugLife™✌
Thanks m8. I've never built before but feel comfortable with all the commands and everything. Just one last question, if I want to build for the Sprint LG G3 ls990, I'd have to use the device tree and everything device specific from CM for ls990 (or any other that has all device specific things) to get it to work on my ls990, correct?

Also, thanks so much for the guide it looks really helpful :D
 

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
Thanks m8. I've never built before but feel comfortable with all the commands and everything. Just one last question, if I want to build for the Sprint LG G3 ls990, I'd have to use the device tree and everything device specific from CM for ls990 (or any other that has all device specific things) to get it to work on my ls990, correct?

Also, thanks so much for the guide it looks really helpful :D

Yes, you can use the device trees from CM. Do it... :fingers-crossed:
 

allanlgz

Senior Member
May 19, 2014
138
29
Trying to build
I use the guide link posted at the end however when trying to run the commands I get these errors:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zli
b1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-
dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos pyt
hon-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncu
rses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev
libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.
8-dev python
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
E: Unable to locate package zlib1g-dev
E: Unable to locate package libx11-dev
E: Unable to locate package libreadline6-dev
E: Unable to locate package libgl1-mesa-glx
E: Unable to locate package libreadline6-dev
E: Unable to locate package libreadline6
[email protected]:~# sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory

Have followed instructions perfectly so far
 

Shreesha.Murthy

Recognized Developer / Inactive RC
Mar 1, 2014
611
6,883
127.1.1.0
Trying to build
I use the guide link posted at the end however when trying to run the commands I get these errors:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zli
b1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-
dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos pyt
hon-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncu
rses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev
libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.
8-dev python
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
E: Unable to locate package zlib1g-dev
E: Unable to locate package libx11-dev
E: Unable to locate package libreadline6-dev
E: Unable to locate package libgl1-mesa-glx
E: Unable to locate package libreadline6-dev
E: Unable to locate package libreadline6
[email protected]:~# sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory

Have followed instructions perfectly so far
Well, those guides are pretty outdated for now. Scroll up or see the 3rd post where I've mentioned about the script. It's automatic and saves you from headache

-ThugLife™✌
 

nitin.chobhe

Recognized Contributor
Jan 3, 2013
8,205
19,697
Pune
Google Pixel 2 XL
Trying to build
I use the guide link posted at the end however when trying to run the commands I get these errors:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zli
b1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-
dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos pyt
hon-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncu
rses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev
libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.
8-dev python
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
E: Unable to locate package zlib1g-dev
E: Unable to locate package libx11-dev
E: Unable to locate package libreadline6-dev
E: Unable to locate package libgl1-mesa-glx
E: Unable to locate package libreadline6-dev
E: Unable to locate package libreadline6
[email protected]:~# sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory

Have followed instructions perfectly so far

This has been answered in that thread. If you see closely, you'll find out that the packages that are showing error have :i386 in their name. Remove :i386 from their names and you should be good to go.

Or use the scripts that @Shreesha.Murthy has linked

Nitin
 
  • Like
Reactions: aalupatti

Kevinjoa

Inactive Recognized Developer
Jan 29, 2013
1,990
2,839
Luedenscheid
kevinhoerner.de
What should be noted that in european countries it seems to only work for people who have a buisiness, at least as per Tos u can't choose and/or use as private person, but most of us have decent internet and power supply and a good enough pc.
Just a note for those who may wonder. :)
 
  • Like
Reactions: nitin.chobhe

Top Liked Posts

  • There are no posts matching your filters.
  • 212
    What is this Tutorial?
    This tutorial will help you learn about building a custom ROM from source on Google Cloud.

    Who this tutorial is for?
    This tutorial is for those who want to build a custom ROM from source, but are unable to do that because of following reasons:
    1. Low network speed
    2. Limited bandwidth
    3. Irregular power supply which obstructs the repo sync (yes, this is a reason in some countries ;))

    What is needed for you to start with this thread?
    1. A google account
    2. A credit card – This is a must to start using Google Cloud Update: I read that people have successfully used debit cards as well.; so try your luck
    With you card you can activate free trial and use Google Cloud without any charges for 12 months. Your card will be charged for $1 for verification purpose (and that’s it, the charges on my credit card got reversed in a day- I’m not sure about the reversal of the charges on debit card charges will be reversed on the cards [But I'm not responsible if they don't revert it ;)]).
    3. A PC with good (average will also do, I used 512 kbps connection) internet connection (to access Google Cloud, your bandwidth will not be used much).
    4. Common sense ;) (you should have it as you are reading this thread)
    5. Willingness to read, search and ask right questions in right forums, communities

    So, let’s start our journey!

    Part – I
    Activating Google Cloud FREE Trial
    1. Go to Google Cloud website: https://cloud.google.com/ and click on Free Trial button
    tz27LHx.png


    2. Login with your Google account username and password.
    mgEf2dv.png


    3. Click on SIGN UP FOR FREE TRIAL
    9qOMBwV.png


    Enter all the details and click on Accept and start free trial button
    GH2OA8Q.png


    4. It will start your free trial and create first project for you
    BzFeEqB.png


    Congratulations! You have completed the most important Part – I of the process and you are now ready to setup the environment for building your ROM!
    Update: Now the free trial validity is 1 year so more time to learn how to build the ROM :)

    Part – II
    Creating Virtual machine on Google Compute Engine
    1. Click on the 2 lines menu displayed on the left top corner to bring on the Products and Services list on left side.
    biULzBF.png


    2. In this menu, click on Compute Engine
    RIPTqDJ.png


    3. It’ll show following page, click on Create Instance button
    4TXdFra.png


    4. On Create Instance page, specify the details like Name, Zone (if you want to change them). In Machine Type combo, select a machine configuration that you would like to have.
    I use 4 cores and 15 GB memory
    WhWrNF7.png


    5. In Boot disk section, click on Change button.
    UGOwFl1.png


    6. On Boot disk details page, select the OS that you want to have on VM Instance. I always used Ubuntu 14.04 LTS (and it never let me down). Update: Now I use 16.04 LTS
    yP8GGAM.png


    Enter the size of disk. I used 500 GB so that I can sync 2-3 ROMs in the same VM Instance ;) Then click on Select button.
    Note: With this configuration I was able to clean build a ROM in around 70 minutes. The repo sync took around 25-30 minutes (which would have taken a week on my slow internet connection)
    7. It’ll take you back to Create Instance page. Here you can specify the Firewall by checking both the check boxes. Finally click on Create button to create the VM Instance.
    oFGBz2G.png


    8. It’ll take a minute or two and create the VM instance. It’ll be in running state as indicated by the Green check box in front of the VM Name.
    Note: You can start or stop the instance by selecting it and then clicking on stop or start button. It is advised to stop the VM instance once you are done with using it.
    i23zi1r.png


    9. Click on the 3 dots menu near SSH and select option Open in browser window.
    10. It’ll start the SSH connection to the VM Instance that you have created.
    04ISl7i.png


    11. Run following command to get su
    Code:
    sudo –s

    RvIEXeI.png


    Now you are ready to install the required packages to build the ROM from source. You can follow this nice guide created by @jackeagle to start:
    http://forum.xda-developers.com/showpost.php?p=54118614&postcount=2
    That was it!
    Wish you all the best for building your first ROM :D
    44
    How to upload the ROM zip on internet?

    Many guys, who were able to build the ROM successfully, were asking about how to get the ROM zip on phone :D

    Thanks @hackslash for this nice post: http://forum.xda-developers.com/showpost.php?p=68750149&postcount=146

    Upload to AFH: https://forum.xda-developers.com/showpost.php?p=73420609&postcount=315

    You can also upload it on Google drive by following these steps:
    http://olivermarshall.net/how-to-upload-a-file-to-google-drive-from-the-command-line/ (thanks @Papdya for sharing this link)

    Nitin
    33
    I have successfully built my ROM on Azure instead. Now I want to upload it somewhere, I tried setting up FTP but failed miserably, can someone please guide me with terminal commands on how to upload it? Thank you

    No need to use FTP. I use MEGA and upload all my builds directly to MEGA. Follow the instructions below:
    1. Create an account at www.mega.nz
    2. In your VM, install ruby and gem
      Code:
      sudo apt-get install ruby gem
    3. Install rmega gem (you can see the source code here https://github.com/topac/rmega)
      Code:
      gem install rmega
    4. Now to upload your build, just cd to the directory and execute this command:
      Code:
      rmega-up 'filename' -u 'email address'
      You'll be prompted to enter your password. Enter it and the specified file will be uploaded to your mega account. You can read this readme https://github.com/topac/rmega/blob/master/README.md for all switches and flags you can use.
    5. Now simply head to your MEGA account from your local computer and download the file.
    16
    Awesome guide. I'm sure it'll help out those who are trying hard to build their first ROM and get involved in building stuff. Just a suggestion though
    I find @akhilnarang script to be easy to setup server and it's just few commands away. It'd be nice if you include that
    Link : github.com/akhilnarang/scripts

    -ThugLife™✌
    13
    Just a small note to everyone building on cloud server:
    Don't close the SSH connection during the build. It's obvious as all processes will be terminated which means your build will be stopped.
    However, if electricity is unreliable (and you have no backup power supply), use screen!
    Before you start building type this in SSH terminal:
    Code:
    screen
    Screen biggest advantage is that it allows you to detach your current session allowing you to run it in background. So even if SSH connections is closed, the build is running in background.
    After you have executed the make command i.e. you have started the build press Ctrl + A + D. This will detach your current session and will allow it to run in background. Now you can simply logout from the SSH connection.
    If you want to jump back to that detached session enter this in terminal:
    Code:
    screen -r