Here's a collective list of things you can try to improve your builds. Have fun!
repo
optimization tipsBy default, repo
only utilizes four threads (or whatever the ROM manifest declares.) If you have a stronger machine with more threads, you can increase this number. So, for example, if you have 24 threads, you would type:
repo sync -j24
This should be set by default in your ROM manifest, but just in case, you can tell repo
to only fetch recent changes. This allows for smaller downloads, which makes the sync quicker. Add the flag:
repo sync -c
To disable syncing clone bundles and tags, use:
repo sync --no-clone-bundle --no-tags
More documentation on this required, but for most developers these flags will be OK to use. This makes the sync faster as there is less information to sync over.
repo sync -c -j24 --no-clone-bundle --no-tags
That's quite long! How about we add this to our .bashrc
as a alias? That way, we only have to type one phrase for bash
to automatically type that out for us.
Open up ~/.bashrc
and add these lines:
# Alias to sync alias reposync='repo sync -c -j24 --no-clone-bundle --no-tags'
This way, next time you want to sync, just type reposync
and bash
will substitute the command for you. Easy! Just don't forget to source ~/.bashrc
otherwise bash
will not know of this new alias.
WARNING: If you have any changes in your device trees, commit them and push them to a remote repository. This tip will permanently delete your local changes, so back them up!
While messing around with device specific folders, you may break something and the build process might not work. Or, you may have multiple devices synced and you want to delete it all and start over. This tip/command will let you delete only the device trees.
Add this function to your ~/.bashrc
:
# Remove all device trees/local manifests function resettree() { rm -rf device kernel vendor out .repo/local_manifests reposync }
Let's go over what this does, word by word:
rm -rf
: Destructive command to erase all of the following:device
folder: Holds all device-related fileskernel
folder: Holds all kernel-related files for devicesvendor
folder: Holds all vendor-related files for devices AND ROM-specific vendor customizationsout
folder: Stores artifacts of builds.repo/local_manifests
folder: Stores "manifest" information of devices to sync.reposync
: Executes the repo sync
alias we made earlier.The last line is important, because by deleting the vendor
folder, we also delete some crucial files for building Bliss. To fix that, we rerun a sync. Note that because we did not delete any other folders, syncing and updating files only take a fraction of a time compared to starting from scratch.
After running resettree
, make sure to initialize a new tree by running breakfast <devicename>
.
Thanks to @blueyes for providing the script!
Copy the following into your ~/.bashrc
:
function gcp() { COMMIT=`echo "$1" | cut -d/ -f6` GH=`echo "$1" | cut -d/ -f1-3` if [ "$COMMIT" != "commit" ]; then echo -e "Please use a commit URL." elif [ "$GH" != "https://github.com" ]; then echo -e "Please use an https://github.com/ URL." else PROJECT=`echo "$1" | cut -d/ -f1-5` git fetch $PROJECT CP=`echo "$1" | cut -d/ -f7` git cherry-pick $CP fi }
To use this, source ~/.bashrc
and then run gcp <GitHub commit URL here>
.