Skip to content

Instantly share code, notes, and snippets.

@tobadia
Last active May 17, 2017 21:17
Show Gist options
  • Save tobadia/75d8e16d2f6bdd1bcaf48422fe953c9f to your computer and use it in GitHub Desktop.
Save tobadia/75d8e16d2f6bdd1bcaf48422fe953c9f to your computer and use it in GitHub Desktop.
# CM is dead, long live LineageOS
# Last update: 2017-05-08
# Initial state
Unlocked bootloader, any recovery, any rom, root enabled, TitaniumBackup installed
# Available documentation
LineageOS vanilla (official) https://forum.xda-developers.com/oneplus-one/orig-development/official-lineageos-14-1-oneplus-one-t3543489
LineageOS changelog (official) https://www.lineageoslog.com/14.1/bacon
TWRP (official) https://twrp.me
# Step 0 : requirements
- LineageOS latest nightly build: https://download.lineageos.org/bacon > OnePlus > One (bacon) [lineage-14.1-20170508-nightly-bacon-signed.zip]
- LineageOS permanent su addon: https://mirrorbits.lineageos.org/su/addonsu-arm-signed.zip [addonsu-arm-signed.zip]
- TWRP recovery: https://dl.twrp.me/bacon/twrp-3.1.0-0-bacon.img [twrp-3.1.0-0-bacon.img]
- OpenGApps 7.1 Nano: http://opengapps.org/ [open_gapps-arm-7.1-nano-20170506.zip]
- LineageOS unofficial debloater: https://forum.xda-developers.com/attachment.php?attachmentid=4039814&d=1486989119 [LineageOS_14.1_OfficialNightly_Debloater_survive.zip]
- Boeffla kernel (not mandatory): http://kernel.boeffla.de/bacon/boeffla-kernel-cm/cm14.0_download/Test/boeffla-kernel-6.0-beta14-Lineage14.1-bacon-anykernel.recovery.zip [boeffla-kernel-6.0-beta14-Lineage14.1-bacon-anykernel.recovery.zip]
- Boeffla config app (mandatory if Boeffla kernel): http://kernel.boeffla.de/bcv2/2.4.34-boeffla-config-v2.apk [2.4.34-boeffla-config-v2.apk]
# Step 1 : backup all the things!
Enter plane mode to avoid receiving SMS or calls
Remove SIM card to avoid receiving things after new ROM is not completely set-up
Run a FULL TB backup
Copy all relevant content of /sdcard/ to your computer
/sdcard/DCIM
/sdcard/Download
/sdcard/Pictures
/sdcard/TitaniumBackup
+random files in /sdcard/ like TB license, rsync keys etc...
# Step 2 : Flash latest TWRP recovery
adb reboot bootloader
fastboot flash recovery twrp-3.1.0-0-bacon.img
fastboot reboot
(hold Vol- key to boot directly to TWRP)
# Step 3 : "Format Data" to remove encryption header/footer
TWRP > Wipe > Format Data (This is NOT "Advanced wipe". Might take some time)
# Step 4 : Wipe everything else to nuke old partitions
TWRP > Wipe > Advanced wipe > Dalvik, Cache, System, Data, Internal Storage (Might take a while, sometimes 1+ hour)
Reboot > Recovery
# PRO-TIP :
# While this is running, take the time to tar -zcvf your whole backup, to send back later to your phone to untar with su rights
# This will allow to preserve the timestamps in all files, this preserving the chronological order of pictures in the gallery
# If the backup is big, tar it by folder (eg. DCIM.tar.gz, Pictures.tar.gz....)
# For details, see
# http://android.stackexchange.com/questions/35580/how-can-i-transfer-photos-to-my-android-jelly-bean-device-while-preserving-the-o
# If you already had JPEG files that suffered such thing due to previous pull/push operations, usea jhead -ft *.jpg on them
# For details, see
# http://photo.stackexchange.com/questions/27245/is-there-a-free-program-to-batch-change-photo-files-date-to-match-exif
# Step 5 : Switch to latest LineageOS weekly
adb push lineage-14.1-20170508-nightly-bacon-signed.zip /sdcard/
Install > /sdcard/lineage-14.1-20170508-nightly-bacon-signed.zip
Reboot > System
# Step 6 : Complete initial set-up without SIM card
Once set-up is finished, reboot to recovery
# Step 7 : Push and Flash supplementary files (do not flash kernel yet)
adb push open_gapps-arm-7.1-nano-20170506.zip /sdcard/
adb push addonsu-ar-signed.zip /sdcard/
adb push LineageOS_14.1_OfficialNightly_Debloater_survive.zip /sdcard/
adb push boeffla-kernel-6.0-beta14-Lineage14.1-bacon-anykernel.recovery.zip /sdcard/
adb push 2.4.34-boeffla-config-v2.apk /sdcard/
Install > /sdcard/open_gapps-arm-7.1-nano-20170506.zip
Install > /sdcard/addonsu-ar-signed.zip
Install > /sdcard/LineageOS_14.1_OfficialNightly_Debloater_survive.zip
# Step 8 : Edit debloater to keep packages of interest and reflash LineageOS on top to recover lost packages
Mount > System and return to TWRP home screen
adb pull /system/addon.d/74-brs.sh .
vi 74-brs.sh
Remove the `rm -rf` lines that delete packages you'd like to keep. I personally delete these ones:
Contacts
Eleven
Email
Exchange2
Messaging
adb push 74-brs.sh /system/addon.d/
Install > /sdcard/lineage-14.1-20170508-nightly-bacon-signed.zip
Install > /sdcard/boeffla-kernel-6.0-beta14-Lineage14.1-bacon-anykernel.recovery.zip
# Step 9 : Reboot to System and proceed with installing apps
Reboot > System
(...)
Settings > Device info > tap build numbers multiple times to enable developper options
Developper options > Root 'Applications and ADB', Enable ADB
Play Store > Install all apps you need (especially TitaniumBackup)
# Step 10 : Restore tar'd archives and untar AS ROOT !!!
adb shell
cd /sdcard/
mkdir tar
exit
adb push <ALL TAR FILES> /sdcard/tar/ (repeat for each .tar.gz file)
adb shell
su
tar -xvzf <ALL TAR FILES>
mv <ALL UNTARED FOLDERS> ../
# Step 11 : Restore data with TB. Reboot. Re-insert SIM card when done. Profit.
NB: I would refrain from encrypting again for a couple weeks.
it is possible that there's a bug in a driver leading to a full crash at random.
Symptoms: phone won't exit sleep, hard reboot goes to bootloop.
Fix: wipe /system and /data (+maybe Format Data?) and restore as in this guide.
Internal storage can be left in place (I think)
Not sure if it is related to encryption, but I'm investigating. Happened 2 times and I was encrypted.
I'm now unencrypted and we'll see if it occurs...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment