Skip to content

Patches used to build VoltageOS as Trebledroid GSI.

Notifications You must be signed in to change notification settings

ahnet-69/treble_voltage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building

You'll need to get familiar with Git and Repo as well as How to build a GSI.

Create Directories

As a first step, you'll have to create and enter a folder with the appropriate name. To do that, run these commands:

mkdir VoltageOS
cd VoltageOS

Initalise the Treble VoltageOS repo

repo init -u https://github.com/VoltageOS/manifest.git -b 14

Clone the Manifest

This adds necessary dependencies for the VoltageOS GSI.

git clone https://github.com/ahnet-69/treble_manifest.git -b voltage-14 .repo/local_manifests

Sync the repository

repo sync -c -j$(nproc --all) --force-sync --no-clone-bundle --no-tags

Apply the patches

Copy the patches folder to the ROM folder and copy the apply-patches.sh to the rom folder. and run this in the ROM folder:

apply-patches.sh . trebledroid

Run the above command replacing trebledroid for each folder in the patches directory

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.

Adapting for VoltageOS

Clone this repository and then copy Voltage.mk to device/phh/treble in the ROM folder. Then run the following commands:

 cd device/phh/treble
 bash generate.sh Voltage

Turn On Caching

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

Reduce File Sizes

BOARD_EXT4_SHARE_DUP_BLOCKS := true

This flag makes the blocks shared, and makes the build read-only. It ensures it fits on to all possible Treble-supported devices, since many devices have a small system partitions.

Compilation

In the ROM folder, run this for building GAPPS:

. build/envsetup.sh
ccache -M 50G -F 0
lunch treble_arm64_bgN-userdebug 
make systemimage -j$(nproc --all)

Compression

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 the system.img. In other words, you cannot flash this file directly.

cd out/target/product/tdgsi_arm64_ab
xz -9 -T0 -v -z system.img 

Troubleshooting

If you face any conflicts while applying patches, apply the patch manually. For any other issues, report them via the Issues tab.

Credits

These people have helped this project in some way or another, so they should be the ones who receive all the credit: