Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save soupslurpr/40601841ea537dbe0aff511a411a6b8a to your computer and use it in GitHub Desktop.

Select an option

Save soupslurpr/40601841ea537dbe0aff511a411a6b8a to your computer and use it in GitHub Desktop.
how to update GrapheneOS (or other AOSP-based OS') for development

on Windows/WSL2, make sure the .wslconfig file in the Windows user directory has networkingMode=mirrored.
Mine looks like this:

[wsl2]

swap = 70G
nestedVirtualization = true
guiApplications = true
memory = 56GB
networkingMode=mirrored

[experimental]
autoMemoryReclaim=gradual

run adb server on the host (Windows).
adb server

a reboot is needed when updating some low level code that doesn't get stopped when adb shell stop runs.
m && (adb root; adb remount; adb shell stop; adb sync -z zstd; adb reboot)

otherwise, use the faster command that replaces adb reboot with adb shell start.
m && (adb root; adb remount; adb shell stop; adb sync -z zstd; adb shell start)

larger changes may need a full flash rather than an incremental update.

AOSP updates (https://grapheneos.org/build#updating-and-switching-branches-or-tags) requires redoing vendor.
rm -rf vendor/google_devices
then follow https://grapheneos.org/build#extracting-vendor-files-for-pixel-devices

on Windows/WSL2, use fastboot from the host (Windows).
set the ANDROID_PRODUCT_OUT env variable appropriately, then run the fastboot command.
$env:ANDROID_PRODUCT_OUT="\\wsl.localhost\Debian\home\user\grapheneos-VERSION\out\target\product\CODENAME"
CODENAME is the codename for the device. for example, the codename for Pixel 7a is lynx.

use fastboot. -w means it wipes before flashing.
fastboot flashall
OR
fastboot -w flashall

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