You can always refer to Git and Repo as well as How to build a GSI.
As a newbie building GSI ROMS.
- I will be leaving you my own recap of How to build a GSI.
Beginners guide
- Use Ubuntu or WSL2
- Good laptop (12 cores and 16gb RAM at least) and patience (This is my experience)
In other words
-
If you're going with Ubuntu via dual boot, main OS or VM go directly to Steps for Begginers
-
If you're using windows and would like to try WSL2, go Using WSL
- Open powershell window with Admin privileges.
- Run below command.
wsl --install
- After done, reboot your laptop Note: by default Ubuntu LTS is installed, this is what we need
sudo apt update -y && sudo apt upgrade -y
In your HOME directory
sudo apt install unzip
mkdir platformtools
cd platformtools/
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip -d ~
Now we have to add adb
and fastboot
to our path. Open ~/.profile (nano ~/.profile
) and add the following:
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
Then, run this to update your environment. source ~/.profile
sudo apt-get install bc bison build-essential curl flex g++-multilib gcc-multilib git gnupg gperf libxml2 -y
sudo apt-get install lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-gtk3-dev imagemagick git -y
sudo apt-get install lunzip lzop schedtool squashfs-tools xsltproc zip zlib1g-dev openjdk-8-jdk python-is-python3 perl -y
sudo apt-get install xmlstarlet virtualenv xz-utils rr jq libncurses5 pngcrush lib32ncurses5-dev git-lfs libxml2 -y
sudo apt-get install openjdk-11-jdk-headless -y
sudo apt-get install ccache -y
Enter the following to download the repo binary and make it executable (runnable):
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Put the ~/bin directory in your path of execution In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):
nano ~/.profile
Verify that below lines exists otherwise add them.
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Then, use this to update your environment.
source ~/.profile
You’ll need to set up your git identity in order to sync the source, run these commands:
git config --global user.name "your username"
git config --global user.email yourmail@example.com
You can speed up subsequent builds by adding these lines to your ~/.bashrc OR ~/.zshrc file:
export USE_CCACHE=1
export CCACHE_COMPRESS=1
export CCACHE_MAXSIZE=50G # 50 GB
- I will also be recording my build times for you guys to get an estimate.
My experience building, my setup and timings
- Jobs: 16
- Repo Sync time : 2:10 hrs
- Build time : 5:50 hrs
- Jobs: 20
- Repo Sync time : 2:10 hrs
- Build time : 2:05 hrs
As a first step, you'll have to create and enter a folder with the appropriate name. To do that, run these commands:
mkdir evo
cd evo
repo init -u https://github.com/Evolution-X/manifest -b udc
This adds necessary dependencies for the Evolution-X GSI.
git clone https://github.com/eduardovicente/treble_manifest.git -b evo-udc .repo/local_manifests
repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
If you see any issue here let it do his work, after its done, run it again, you should get no errors
Copy the patches folder to the ROM folder, and run this in the ROM folder:
chmod +x patches/apply-patches.sh
patches/apply-patches.sh . trebledroid
patches/apply-patches.sh . personal
patches/apply-patches.sh . ponces
NOTE: It is recommended to apply patches manually by going to the respective directory of the patches, and applying them by using git am
, as the script often skips applying critical patches for some reason.
patches/apply-patches.sh . vicente
Clone this repository and then copy evo.mk to device/phh/treble in the ROM folder.
cd device/phh/treble
bash generate.sh evo
You can speed up subsequent builds by adding these lines to your ~/.bashrc
OR ~/.zshrc
file:
export USE_CCACHE=1
export CCACHE_COMPRESS=1
export CCACHE_MAXSIZE=50G # 50 GB
In the ROM folder, run this to start compilation:
source build/envsetup.sh
ccache -M 50G -F 0
lunch treble_arm64_bgN-userdebug
make systemimage -j$(nproc --all)
After compiling the GSI, you can run this to reduce the system.img
file size:
Warning
You will need to decompress the output file to flash thesystem.img
. In other words, you cannot flash this file directly.
cd out/target/product/tdgsi_arm64_ab
xz -9 -T0 -v -z system.img
If you face any conflicts while applying patches, apply the patch manually.
These people have helped this project in some way or another, so they should be the ones who receive all the credit: