This page is a work in progress, and so, the instructions and scripts may not work as intended. Please keep this in mind while you try it out.
This guide also assumes you are familiar with crave and the procedure building and signing android, and debugging issues that arise.
Let us know in the "Signed Builds" thread under ext-foss-aosp in the discord server
To begin with signing there are two parts:
Attention to Readers : This script is meant to be run on Devspace CLI not while building the ROM Neither sppidy, who made the script nor Crave team members are responsible if you run this script during build and leak your sensitive info
Note: For ease of use keys should not use a password. Password protecting keys can lead to some issues with the signing systems of some ROMs.
This script automates the process of generating, encrypting, and uploading Android certificates to Backblaze B2. It performs the following steps:
pipcd Lineage21/opt/crave/backblaze_keygen.sh
Source code to the script can be found here Upon successful execution, the script outputs a confirmation message and ensures that all temporary files and sensitive environment variables are cleared.
Enter the password: ********
Enter the Encryption Password: ********
Creating certificate directory: /tmp/android-certs.XYZ123
Encrypting password and storing it at: /tmp/android-certs.XYZ123/password.enc
Generating keys:
Generating key for bluetooth
Generating key for cyngn-app
Generating key for media
Generating key for networkstack
Generating key for platform
Generating key for releasekey
Generating key for sdk_sandbox
Generating key for shared
Generating key for testcert
Generating key for testkey
Generating key for verity
Generating APEX keys:
Generating key for com.android.adbd
Generating key for com.android.adservices
Generating key for com.android.adservices.api
Generating key for com.android.appsearch
Generating key for com.android.art
Generating key for com.android.bluetooth
Generating key for com.android.btservices
Generating key for com.android.cellbroadcast
Generating key for com.android.compos
Generating key for com.android.configinfrastructure
Generating key for com.android.connectivity.resources
Generating key for com.android.conscrypt
Generating key for com.android.devicelock
Generating key for com.android.extservices
Generating key for com.android.graphics.pdf
Generating key for com.android.hardware.biometrics.face.virtual
Generating key for com.android.hardware.biometrics.fingerprint.virtual
Generating key for com.android.hardware.boot
Generating key for com.android.hardware.cas
Generating key for com.android.hardware.wifi
Generating key for com.android.healthfitness
Generating key for com.android.hotspot2.osulogin
Generating key for com.android.i18n
Generating key for com.android.ipsec
Generating key for com.android.media
Generating key for com.android.media.swcodec
Generating key for com.android.mediaprovider
Generating key for com.android.nearby.halfsheet
Generating key for com.android.networkstack.tethering
Generating key for com.android.neuralnetworks
Generating key for com.android.ondevicepersonalization
Generating key for com.android.os.statsd
Generating key for com.android.permission
Generating key for com.android.resolv
Generating key for com.android.rkpd
Generating key for com.android.runtime
Generating key for com.android.safetycenter.resources
Generating key for com.android.scheduling
Generating key for com.android.sdkext
Generating key for com.android.support.apexer
Generating key for com.android.telephony
Generating key for com.android.telephonymodules
Generating key for com.android.tethering
Generating key for com.android.tzdata
Generating key for com.android.uwb
Generating key for com.android.uwb.resources
Generating key for com.android.virt
Generating key for com.android.vndk.current
Generating key for com.android.vndk.current.on_vendor
Generating key for com.android.wifi
Generating key for com.android.wifi.dialog
Generating key for com.android.wifi.resources
Generating key for com.google.pixel.camera.hal
Generating key for com.google.pixel.vibrator.hal
Generating key for com.qorvo.uwb
B2 CLI not found, installing...
Requirement already up-to-date: b2 in /usr/local/lib/python3.7/site-packages
Enter Bucket Name: my-bucket
Enter B2 Key Id: my-b2-key-id
Enter B2 App Key: my-b2-app-key
Authorizing B2...
B2 authorization successful
Uploading keys to Backblaze B2...
Upload complete
Keys have been generated, password protected, and uploaded to Backblaze B2.
Cleaning up...
Cleared Certificates from Devspace
Clearing ENV Variables
Cleared ENV Variables
This output indicates that the keys have been successfully generated, encrypted, uploaded, and that the temporary files and environment variables have been cleaned up.
This script called crave_sign.sh automates the process of signing Android APK and APEX files using keys stored in a Backblaze B2 bucket and also sign your builds using the release keys from Backblaze B2 Bucket. Below are the steps to use this script effectively.
BUCKET_NAMEKEY_ENCRYPTION_PASSWORDBKEY_IDBAPP_KEYCreate a crave.yaml inside .repo/manifests with the following contents:
LOS 21:
ignoreClientHostname: true
env:
BUCKET_NAME: your_bucket_name
KEY_ENCRYPTION_PASSWORD: your_key_encryption_password
BKEY_ID: your_bkey_id
BAPP_KEY: your_bapp_key
Replace "LOS 21" with your base project's name. Remember to use the correct name, get it from
crave clone listAlso remember to replace the placeholder credentials with actual values.
It is also recommended to set ignoreClientHostname to preserve workflow persistence. Read more about it here.
If you're using sounddrill's crave_aosp_builder github actions workflow, you can set crave.yaml through secrets. Steps:
/opt/crave/crave_sign.sh
Example:crave run --no-patch -- "rm -rf .repo/local_manifests; \
git clone https://github.com/sounddrill31/reponame --depth 1 -b branchname .repo/local_manifests; \
/opt/crave/resync.sh; \
source build/envsetup.sh; \
# Sign Script instead of mka bacon
breakfast oxygen userdebug; \
mka target-files-package otatools; \
/opt/crave/crave_sign.sh"
Source code to the script can be found here
After the script execution, it automatically cleans up by removing temporary files and unsetting environment variables to ensure no sensitive information is left in the environment.
Upon successful execution, the script outputs a signed OTA update package and confirms the completion of the signing process.