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

Guide To Building Custom Pixel 4a Roms(move if needed)

Search This thread

miko12312

Senior Member
Sep 11, 2009
1,168
113
Google Pixel 4a
This is a place holder for anyone that can assist in helping of building custom roms for our pixel 4a. Please note this will need Linux version on how to setup an environment for the build and how to build the roms,. Anyone please that can help add infor mation on how to do these as i know there are many guides but we need one specifically for our device to get development moving along. Please post on stock aosp roms, lineage roms , miui roms etc. i will also try to update as much as i can , hopefully this thread doesnt get moved.

This is the setup from google to setting up an environment to build android aosp

Establishing a Build Environment​


Important:Platform development on MacOS isn't supported as of June 22, 2021.
This section describes how to set up your local work environment to build the Android source files. You must use Linux; building under either MacOS or Windows isn't supported.
For an overview of the entire code-review and code-update process, see Life of a Patch.
Note: All commands in this site are preceded by a dollar sign ($) to differentiate them from output or entries within files. Use the Click to copyfeature located at the top right of each command box to copy all lines without the dollar signs, or triple-click each line to copy it individually without the dollar sign.

Choosing a branch​

Some requirements for the build environment are determined by the version of the source code that you plan to compile. For a full list of available branches, see Build Numbers. You can also choose to download and build the latest source code (called master), in which case you simply omit the branch specification when you initialize the repository.
After selecting a branch, follow the appropriate instructions below to set up your build environment.

Setting up a Linux build environment​

These instructions apply to all branches, including master.
The Android build is routinely tested in house on Ubuntu LTS (14.04) and Debian testing. Most other distributions should have the required build tools available.
For Gingerbread (2.3.x) and higher versions, including the master branch, a 64-bit environment is required. Older versions can be compiled on 32-bit systems.
Note: See Requirements for the complete list of hardware and software requirements, then follow the detailed instructions for Ubuntu below.

Installing required packages (Ubuntu 18.04)​

You need a 64-bit version of Ubuntu.

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

Installing required packages (Ubuntu 14.04)​

You need a 64-bit version of Ubuntu (14.04 is recommended).

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

Note: To use SELinux tools for policy analysis, also install the python-networkx package.Note:If you're using LDAP and want to run ART host tests, also install the libnss-sss:i386 package.

Installing required packages (Ubuntu 12.04)​

You may use Ubuntu 12.04 to build older versions of Android. Version 12.04 isn't supported on master or recent releases.

sudo apt-get install git 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 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Installing required packages (Ubuntu 10.04-11.10)​

Building on Ubuntu 10.04-11.10 is no longer supported, but may be useful for building older releases of AOSP.

sudo apt-get install git gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

On Ubuntu 10.10:

sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

On Ubuntu 11.10:

sudo apt-get install libx11-dev:i386

Configuring USB access​

Install a community-maintained default set of udev rules for all Android devices by following the instructions to Set up a device for development.

Using a separate output directory​

By default, the output of each build is stored in the out/ subdirectory of the matching source tree.
On some machines with multiple storage devices, builds are faster when storing the source files and the output on separate volumes. For additional performance, the output can be stored on a file system optimized for speed instead of crash robustness, because all files can be regenerated if the file system is corrupted.
To set this up, export the OUT_DIR_COMMON_BASE variable to point to the location where your output directories will be stored.

export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>

The output directory for each separate source tree is named after the directory holding the source tree. For instance, if you have source trees /source/master1 and /source/master2 and if OUT_DIR_COMMON_BASE is set to /output, the output directories are /output/master1 and /output/master2.
Avoid having multiple source trees stored in directories that have the same name, as the source trees would end up sharing an output directory, with unpredictable results. This is only supported on Jelly Bean (4.1) and higher, including the master branch.

Next: Download the source​

Your build environment is good to go!
 

miko12312

Senior Member
Sep 11, 2009
1,168
113
Google Pixel 4a

Downloading the Android Source

The AOSP is hosted on Git, so we’re going to use a tool called Repo to communicate with Git.

First we need to setup a /bin folder in your Home directory. Type the following commands into the Linux terminal:

$ mkdir ~/bin
$ PATH=~/bin:$PATH


Now we will download the Repo tool, so type into the Linux terminal:

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo


After Repo is installed, we must now create an empty directory to hold your work files. So type this into the Linux terminal:

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY


Now we’ll configure Git with your name and email address – use a Gmail address that you check regularly, otherwise you will not be able to use the Gerrit code-review tool.

$ git config –global user.name “Your Name”
$ git config –global user.email
[email protected]

Now we’ll tell Repo to pull the latest master manifest of AOSP from Git:

$ repo init -u https://android.googlesource.com/platform/manifest

If done successfully, you’ll receive a message that Repo has been initialized in your working directory. You’ll also find a “.repo” directory inside the client directory. So now we’ll download the Android source tree with:

$ repo sync

Building the Android Source

This is where the hardware binaries mentioned at the beginning of this guide come into play. Let’s head over to the AOSP drivers page and download the Pixel XL binaries for Android 7.1.0 (NDE63P). You want to download both the vendor image and the hardware components. These come as compressed archives, so extract them to your desktop and run the self-extracting script from the root folder. Choose to install the binaries to the root of the WORKING_DIRECTORY we created earlier.

Now type into your Linux terminal:

$ make clobber
$ source build/envsetup.sh


Now we’ll choose the target to build, so type:

$ lunch aosp_marlin-userdebug
$ setpaths
$ make –j4


There, we have now “built” an Android ROM from source. So let’s test it in the emulator, by typing into the terminal:

$ emulator

So play around in the emulator a bit. As you can see, a purely vanilla Android experience is quite minimal, and this is why manufacturers customize the AOSP to their needs. So you could flash this ROM we just built to your device if you wanted, but without adding any enhancements, a purely vanilla Android experience would be a very boring thing indeed.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    This is a place holder for anyone that can assist in helping of building custom roms for our pixel 4a. Please note this will need Linux version on how to setup an environment for the build and how to build the roms,. Anyone please that can help add infor mation on how to do these as i know there are many guides but we need one specifically for our device to get development moving along. Please post on stock aosp roms, lineage roms , miui roms etc. i will also try to update as much as i can , hopefully this thread doesnt get moved.

    This is the setup from google to setting up an environment to build android aosp

    Establishing a Build Environment​


    Important:Platform development on MacOS isn't supported as of June 22, 2021.
    This section describes how to set up your local work environment to build the Android source files. You must use Linux; building under either MacOS or Windows isn't supported.
    For an overview of the entire code-review and code-update process, see Life of a Patch.
    Note: All commands in this site are preceded by a dollar sign ($) to differentiate them from output or entries within files. Use the Click to copyfeature located at the top right of each command box to copy all lines without the dollar signs, or triple-click each line to copy it individually without the dollar sign.

    Choosing a branch​

    Some requirements for the build environment are determined by the version of the source code that you plan to compile. For a full list of available branches, see Build Numbers. You can also choose to download and build the latest source code (called master), in which case you simply omit the branch specification when you initialize the repository.
    After selecting a branch, follow the appropriate instructions below to set up your build environment.

    Setting up a Linux build environment​

    These instructions apply to all branches, including master.
    The Android build is routinely tested in house on Ubuntu LTS (14.04) and Debian testing. Most other distributions should have the required build tools available.
    For Gingerbread (2.3.x) and higher versions, including the master branch, a 64-bit environment is required. Older versions can be compiled on 32-bit systems.
    Note: See Requirements for the complete list of hardware and software requirements, then follow the detailed instructions for Ubuntu below.

    Installing required packages (Ubuntu 18.04)​

    You need a 64-bit version of Ubuntu.

    sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

    Installing required packages (Ubuntu 14.04)​

    You need a 64-bit version of Ubuntu (14.04 is recommended).

    sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

    Note: To use SELinux tools for policy analysis, also install the python-networkx package.Note:If you're using LDAP and want to run ART host tests, also install the libnss-sss:i386 package.

    Installing required packages (Ubuntu 12.04)​

    You may use Ubuntu 12.04 to build older versions of Android. Version 12.04 isn't supported on master or recent releases.

    sudo apt-get install git 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 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Installing required packages (Ubuntu 10.04-11.10)​

    Building on Ubuntu 10.04-11.10 is no longer supported, but may be useful for building older releases of AOSP.

    sudo apt-get install git gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc

    On Ubuntu 10.10:

    sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

    On Ubuntu 11.10:

    sudo apt-get install libx11-dev:i386

    Configuring USB access​

    Install a community-maintained default set of udev rules for all Android devices by following the instructions to Set up a device for development.

    Using a separate output directory​

    By default, the output of each build is stored in the out/ subdirectory of the matching source tree.
    On some machines with multiple storage devices, builds are faster when storing the source files and the output on separate volumes. For additional performance, the output can be stored on a file system optimized for speed instead of crash robustness, because all files can be regenerated if the file system is corrupted.
    To set this up, export the OUT_DIR_COMMON_BASE variable to point to the location where your output directories will be stored.

    export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>

    The output directory for each separate source tree is named after the directory holding the source tree. For instance, if you have source trees /source/master1 and /source/master2 and if OUT_DIR_COMMON_BASE is set to /output, the output directories are /output/master1 and /output/master2.
    Avoid having multiple source trees stored in directories that have the same name, as the source trees would end up sharing an output directory, with unpredictable results. This is only supported on Jelly Bean (4.1) and higher, including the master branch.

    Next: Download the source​

    Your build environment is good to go!
    2

    Downloading the Android Source

    The AOSP is hosted on Git, so we’re going to use a tool called Repo to communicate with Git.

    First we need to setup a /bin folder in your Home directory. Type the following commands into the Linux terminal:

    $ mkdir ~/bin
    $ PATH=~/bin:$PATH


    Now we will download the Repo tool, so type into the Linux terminal:

    $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    $ chmod a+x ~/bin/repo


    After Repo is installed, we must now create an empty directory to hold your work files. So type this into the Linux terminal:

    $ mkdir WORKING_DIRECTORY
    $ cd WORKING_DIRECTORY


    Now we’ll configure Git with your name and email address – use a Gmail address that you check regularly, otherwise you will not be able to use the Gerrit code-review tool.

    $ git config –global user.name “Your Name”
    $ git config –global user.email
    [email protected]

    Now we’ll tell Repo to pull the latest master manifest of AOSP from Git:

    $ repo init -u https://android.googlesource.com/platform/manifest

    If done successfully, you’ll receive a message that Repo has been initialized in your working directory. You’ll also find a “.repo” directory inside the client directory. So now we’ll download the Android source tree with:

    $ repo sync

    Building the Android Source

    This is where the hardware binaries mentioned at the beginning of this guide come into play. Let’s head over to the AOSP drivers page and download the Pixel XL binaries for Android 7.1.0 (NDE63P). You want to download both the vendor image and the hardware components. These come as compressed archives, so extract them to your desktop and run the self-extracting script from the root folder. Choose to install the binaries to the root of the WORKING_DIRECTORY we created earlier.

    Now type into your Linux terminal:

    $ make clobber
    $ source build/envsetup.sh


    Now we’ll choose the target to build, so type:

    $ lunch aosp_marlin-userdebug
    $ setpaths
    $ make –j4


    There, we have now “built” an Android ROM from source. So let’s test it in the emulator, by typing into the terminal:

    $ emulator

    So play around in the emulator a bit. As you can see, a purely vanilla Android experience is quite minimal, and this is why manufacturers customize the AOSP to their needs. So you could flash this ROM we just built to your device if you wanted, but without adding any enhancements, a purely vanilla Android experience would be a very boring thing indeed.