Setting up Arch Linux (VMware) for Custom ROM building – Part 3: Preparing the Custom ROM Kitchen / Environment

So you now have a working Arch Linux installation and an XFCE4 desktop environment to boot (well, if you followed my guide here and here). Nice! Now let us go and take a look on how to set up our Arch Linux for Android custom ROM development.

Preparing the development environment

To make sure we have all the development tools that we need in compiling Android tools from source, run a

sudo pacman -S –needed base-devel

This will install the development tools we need to compile the packages.

Install git

Then we also need to install git program. To do that, type

sudo pacman -S git

Git will help us download or clone a repository containing the PKGBUILD file and ultimately the source code.

Enable multilib

We also need to enable multilib just in case the package we are building are using 32-bit compatible libraries. Enabling multilib will allow us to run 32-bit applications to 64-bit installations of Arch Linux.

To do this type

sudo nano /etc/pacman.conf

and uncomment (delete the # in front)

[multilib]

Include = /etc/pacman.d/mirrorlist

The do a full system upgrade by typing

sudo pacman -Syu

pacman.conf: Enable multilib

pacman.conf: Enable multilib

Installing Android development tools

Remember how we download additional packages in our Ubuntu installation here? We are going to do pretty much the same. However, this time we will be utilizing Arch User Repository or AUR instead of the built in package manager.

Clone repositories

Since we are going to build Android development tools from source we are going to clone packages. First, we need to go to the following pages and copy the Git Clone URL into our favorite text editor:

After we have collected the .git URLs of these repositories, make an AUR working folder. I created mine in my home folder. Feel free to follow suit. Then after we have created the working folder go inside, right click and select “Open Terminal Here“. Afterwards, we need to do the following command to each .git URL we have just collected

git clone enterthegitcloneURLhere

where enterthegitcloneURLhere is the .git URLs that we have just collected.

This command will clone the repository and create different files and folders in the working folder. After we ran the commands in all four .git URL, type an

ls

and the directory should have the following folders (violet ones except for vivaldi)

AUR working directory

AUR working directory

Compile and install the Android build tools

With the cloning finished, we can now start compiling the tools from source one by one. The order of compilation and installation will be:

  1. ncurses5
  2. lib32-ncurses
  3. AOSP devel
  4. Lineage OS devel

To compile, go to a folder by typing

cd folder

and type

makepkg -si

This will download necessary sources needed, compile and install the specific package. We might encounter an error while building one of the packages such as this one.

ncurses PGP error

ncurses PGP error

In order to solve this, type

gpg –recv-keys 702353E0F7E48EDB

ncurses keys

ncurses keys

This command will install the appropriate keys needed to install ncurses. Now after we have installed the keys, we can redo the command and resume the build. It will then generate a lot of build text and after a while we will get a terminal screen like this

ncurses build successful

ncurses build successful

This means that the build was successful and we can now go and install the package. If you are asked what Java environment you would like to build, go for

  • jdk8-openJDK if you are building Nougat
  • jkd7-openJDK if you are going for Lollipop and Marshmallow
  • If you are building older versions, head here

Install additional tools

At this point we now have the base packages need to compile Android ROMs. However, we still need to download gradle, maven, and repo before we go and sync our custom ROM sources. To do this type

sudo pacman -S maven gradle repo

Pacman: gradle maven repo

Pacman: gradle maven repo

And with that installed, we can now go and sync ROM sources. Congratulations!

Confused what to do next? Check this post. It will guide you on how to sync your sources to your local machine and build Resurrection Remix ROM Nougat for Zuk Z1. Cheers!


Source:

Leave a Reply

Be the First to Comment!

Speak up you comment ninja! Let's talk. Leave a reply.

wpDiscuz
shares
%d bloggers like this: