Skip to content

Instantly share code, notes, and snippets.

@szampardi
Last active March 15, 2023 06:13
Show Gist options
  • Save szampardi/9baa5c076d9c2aceb47ea4cbb082703a to your computer and use it in GitHub Desktop.
Save szampardi/9baa5c076d9c2aceb47ea4cbb082703a to your computer and use it in GitHub Desktop.
grapheneOS build steps (pixel 5)
#!/bin/bash -ex
# https://developers.google.com/android/ota#redfin
export DEVICE=${1:-redfin}
# https://grapheneos.org/releases#redfin-stable
export TAG_NAME=${2}
export PATCH_LEVEL=$(cut -d'.' -f1,2,3 <<<"${TAG_NAME}")
_patch_level=$(tr '[:upper:]' '[:lower:]' <<<"${PATCH_LEVEL}")
mkdir grapheneos
cd grapheneos
repo init -u https://github.com/GrapheneOS/platform_manifest.git -b refs/tags/"${TAG_NAME}"
repo sync
# TODO: sed -i ... packages/apps/Updater/res/values/config.xml
export OFFICIAL_BUILD=true
yarn install --cwd vendor/adevtool/
source script/envsetup.sh
m aapt2
export OLD_BUILD_NUMBER="${OLD_BUILD_NUMBER}"
if [[ -z ${OLD_BUILD_NUMBER} ]]; then
printf 'must set OLD_BUILD_NUMBER to previous build EPOCH for OTA package generation\n'
exit 127
fi
vendor/adevtool/bin/run download vendor/adevtool/dl/ -d ${DEVICE} -b ${_patch_level} -t factory ota
sudo vendor/adevtool/bin/run generate-all vendor/adevtool/config/${DEVICE}.yml -c vendor/state/${DEVICE}.json -s vendor/adevtool/dl/${DEVICE}-${_patch_level}-*.zip
sudo chown -R $(logname):$(logname) vendor/{google_devices,adevtool}
vendor/adevtool/bin/run ota-firmware vendor/adevtool/config/${DEVICE}.yml -f vendor/adevtool/dl/${DEVICE}-ota-${_patch_level}-*.zip
choosecombo release "${DEVICE}" user
m target-files-package
m otatools-package
script/release.sh "${DEVICE}"
mkdir -vp "../grapheneos_releases/releases/${BUILD_NUMBER}"
mv -f "out/release-${DEVICE}-${BUILD_NUMBER}" "../grapheneos_releases/releases/${BUILD_NUMBER}/release-${DEVICE}-${BUILD_NUMBER}"
mv -f ../grapheneos_releases/releases .
script/generate_delta.sh "${DEVICE}" "${OLD_BUILD_NUMBER}" "${BUILD_NUMBER}"
mv -f releases ../grapheneos_releases/
ls "../grapheneos_releases/releases/${BUILD_NUMBER}/release-${DEVICE}-${BUILD_NUMBER}"
@szampardi
Copy link
Author

oh, thanks! CM/LOS habits :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment