Skip to content

Instantly share code, notes, and snippets.

@JorgeMGuimaraes
Created May 18, 2022 00:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgeMGuimaraes/7a5bd9881cd38e83a0b7a19c0c055be4 to your computer and use it in GitHub Desktop.
Save JorgeMGuimaraes/7a5bd9881cd38e83a0b7a19c0c055be4 to your computer and use it in GitHub Desktop.
General steps to install/flash a new Android ROM.

Flash Android on Linux

General steps to install/flash a new Android ROM. v0.0

Pre requisites

Android 12:: before enter recovery, remove all lockscreen passwords/PINs in Android.

which adb
# /usr/bin/adb

which lsusb
# /usr/bin/lsusb

If not found

#Debian based
apt install android-tools-adb android-tools-fastboot usbutils

#Gentoo
echo "dev-util/android-tools python" >> /etc/portage/package.use/dev-util
echo "sys-apps/usbutils python" >> /etc/portage/package.use/sys-apps
emerge -av dev-util/android-tools sys-apps/usbutils

Give user correct permisisons

gpasswd -a <username> plugdev

Download firmware.zip, rom.zip, gapps.zip...

Go to Settings -> About -> Version Number a million times to unlock dev options. Then go to Settings -> System -> Dev options -> USB Debug.

Connect to phone

This procedure must be done for each phone state (recovery, adb sideload, file transfer...).

lsusb
# ...
# Bus 001 Device 022: ID abcd:1234 Google Inc. Nexus/Pixel Device (charging + debug)
# ...

Add a new udev rule

nano /etc/udev/rules.d/51-android.rules

UBSYSTEM=="usb", ATTR{idVendor}=="abcd", ATTR{idProduct}=="1234", MODE="0666", GROUP="plugdev"

Restart adb

adb kill-server
adb devices
#1077exxx         device

Install ROM (Clean Install)

adb reboot recovery

In OrangeFox

  • Wipe data, cache, ART/Dalvik cache (you'll lose all of you data!)
  • Format Data

Then

  • ADB/Sideload -> Sideload

    adb devices #1077exxx device #if none, repeat Connect to phone" to add new id (yes, a new one)

    adb sideload firmware.zip adb sideload rom.zip #adb sideload gapps/magisk/whatever.zip

Reboot

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