You'll need to get familiar with Git and Repo as well as How to build a GSI.
To get started, first make sure your system has all the necessary dependencies installed:
Run this command to install the essential tools:
sudo pacman -S --needed base-devel gcc sdl2 wxgtk3 lz4 libxml2 git gnupg gperf libxslt imagemagick zip python perl xmlstarlet xz ncurses jdk11-openjdk ccache unzip repo
yay -S android-platform-tools jdk8-openjdk rr virtualenv
Next, install 7-zip
from the AUR:
yay -S 7-zip
Now, create and navigate to a new directory for the build:
mkdir PixelOS
cd PixelOS
You’ll need to initialize the repository with the PixelOS AOSP manifest.
repo init -u https://github.com/PixelOS-AOSP/manifest.git -b fourteen --git-lfs
Now clone the necessary dependencies for the GSI:
git clone https://github.com/moxi-u7/treble_manifest.git .repo/local_manifests -b 14
Sync the repository to fetch the necessary source files for PixelOS:
repo sync --force-sync --optimized-fetch --no-tags --no-clone-bundle --prune -j$(nproc --all)
Generate private keys to sign your build. These keys must be generated without a password:
subject='/C=US/ST=State/L=City/O=Android/OU=Android/CN=Android/[email protected]'
for x in releasekey platform shared media networkstack verity otakey testkey sdk_sandbox bluetooth nfc; do \
./development/tools/make_key vendor/aosp/signing/keys/$x "$subject"; \
done
Explanation:
- C: Country code (e.g., US)
- ST: State
- L: City
- O: Organization
- OU: Organizational Unit
- CN: Common Name
- emailAddress: Your email address
Copy the patches
folder into the rom
folder and apply the patches:
bash patches/apply-patches.sh .
Clone the necessary repository, then copy the pixel.mk
file to the device/phh/treble
directory inside your ROM folder. Then, generate the makefile by running the following commands:
cd device/phh/treble
bash generate.sh pixel
You can speed up future builds by enabling ccache
. Add the following lines to your ~/.bashrc
or ~/.zshrc
file:
export USE_CCACHE=1
export CCACHE_COMPRESS=1
export CCACHE_MAXSIZE=50G # 50 GB
Now, set up the build environment and compile the systemimage
:
. build/envsetup.sh
ccache -M 50G -F 0
lunch treble_arm64_bN-ap2a-userdebug
make systemimage -j$(nproc --all)
Once the compilation is complete, you can compress the system.img
file using 7-zip
for faster transfer or backup. In the out/target/product/tdgsi_arm64_ab
directory, run:
cd out/target/product/tdgsi_arm64_ab
7zz a system.img.xz "system.img"
Finally, if you want to create a VNDK Lite variant, copy the resulting system.img
to the treble_adapter
folder and run:
sudo bash lite-adapter.sh 64 system.img
- If you run into any issues while applying patches, apply them manually by reviewing the patches folder and resolving conflicts.
The following contributors have helped make this project possible: