A workshop about flashing lineageOS on a Samsung Galaxy S3.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
6.3 KiB

  1. # Steps to flash microG LineageOS on Samsung Galaxy S5
  2. download latest TWRP image from https://eu.dl.twrp.me/klte/
  3. download latest lineageOS from https://download.lineage.microg.org/klte/
  4. download latest Magisk.zip from https://github.com/topjohnwu/Magisk/releases
  5. ## Unlock the Bootloader / OEM
  6. Attach phone to PC. Use a good micro USB cable; make sure that you can use it
  7. to copy data.
  8. enable developer options
  9. enable USB debugging in developer options
  10. allow USB debugging access for your PC
  11. ## Flash Recovery
  12. *Right now, flashing recovery only works with Odin; Odin only runs on Windows.
  13. Guide how to flash TWRP with Odin:
  14. https://www.cyanogenmods.org/forums/topic/install-twrp-recovery-samsung-android-using-odin/
  15. Otherwise, there is also this guide to build a patched version of heimdall,
  16. which works with the S5:
  17. https://github.com/Benjamin-Dobell/Heimdall/pull/225#issuecomment-180961953
  18. Actually, Heimdall might work with some S5s, just not with mine.
  19. If Heimdall works:*
  20. Power off the your device and connect the USB adapter to the computer (but not to the device, yet).
  21. Boot into download mode:
  22. With the device powered off, hold Volume Down + Home + Power.
  23. Accept the disclaimer, then insert the USB cable into the device.
  24. `heimdall flash --RECOVERY twrp-3.3.1-0-klte.img`
  25. Now we don't want to boot into the system, we want into the new recovery
  26. directly - so turn off the phone with the power button, and then boot into
  27. recovery by holding the power button, the home button, and volume up for a few
  28. seconds. Release them only when you see the blue "Recovery" writing in the top
  29. left of the screen.
  30. Then go to Wipe + Advanced Wipe to wipe the following partitions:
  31. * System
  32. * Data
  33. * Cache
  34. * Dalvik
  35. Then go to Advanced/ADB Sideload, swipe to the right, and execute `adb sideload lineage-xxx.zip` on your computer.
  36. * When it shows something like `Total xfer: 1.00x` or `adb: failed to read command: Success` on the PC, and `Exit code: 1.000000` in TWRP, it has suceeded.
  37. <!--
  38. On lineageOS 17.1, addonsu doesn't work anymore. That's why we have to flash Magisk instead.
  39. Don't reboot yet, we still want to flash addonsu to root the phone:
  40. Go to Advanced/ADB Sideload, swipe to the right, and execute `adb sideload addonsu-16.0-arm-signed.zip` on your computer.
  41. * When it shows something like `Total xfer: 1.00x` or `adb: failed to read command: Success` on the PC, and `Exit code: 1.000000` in TWRP, it has suceeded.
  42. -->
  43. Don't reboot yet, we still want to flash Magisk to root the phone.
  44. First go to Backup and select only the Boot partition. Under "Select Storage",
  45. select "Internal Storage". Swipe to backup. Now copy the backup to your PC with
  46. `adb pull /sdcard/TWRP`.
  47. Then go to Advanced/ADB Sideload, check "Wipe Cache" and "Wipe Dalvik", swipe
  48. to the right, and execute `adb sideload Magisk-*.zip` on your computer.
  49. * When it shows something like `Total xfer: 1.60x` or `adb: failed to read
  50. command: Success` on the PC, and `- Flashing new boot image` in combination
  51. with `- Done` in TWRP, it has suceeded.
  52. Reboot to start LineageOS!
  53. ### Finish Installation
  54. Go through the setup screen and choose what you want. You can be as restrictive
  55. as you want. Make sure to choose a Wi-Fi, so you can proceed with the next
  56. steps; you can also do this at any later time.
  57. You should also choose a screen lock pin. Patterns are not very secure (you can
  58. often see them by holding the phone into the light at the right angle).
  59. Passwords are a bit inconvenient (but most secure). Do *not* use a fingerprint
  60. sensor, they are really insecure.
  61. Tip: if you use LineageOS 17.1 or higher, you should disable the storage
  62. manager in the settings - it deletes videos & photos automatically after 90
  63. days. This is a very weird default setting.
  64. ## Device Encryption
  65. Charge the phone to 100%.
  66. Go to the Security Settings and encrypt the phone. During the process, it
  67. reboots once and asks you for the device PIN. It can take a while, but not soo
  68. long actually.
  69. ### Secure the device encryption
  70. You usually want to have a long password for your device encryption, which you
  71. only have to enter when the phone boots, and a shorter PIN for your lockscreen.
  72. By design, Android doesn't allow this; this is a workaround to make it possible
  73. still.
  74. We will also install an app which shuts down the phone when you get the unlock
  75. code wrong 5 times in a row.
  76. #### Wrong PIN Shutdown
  77. Open the F-Droid app, wait until it is done with "Updating repositories".
  78. Install the app "Wrong PIN Shutdown".
  79. Now go to the developer settings, and enable root for Apps and ADB.
  80. Open "Wrong PIN Shutdown", grant Admin rights until forever, activate the
  81. function, and set it to shut down the phone after 5 wrong tries to enter the
  82. PIN. You can try it out directly - if you enter your PIN wrong 5 times, does it
  83. shut down?
  84. #### Change the encryption password to a long password
  85. First you need to enable USB debugging again. You can enable the developer
  86. options at "About Phone", tap the "build number" seven times. After you enabled
  87. it, you can find the Developer options in the settings at "System > Advanced >
  88. Developer Options". Enable USB debugging and reboot into the bootloader mode:
  89. Then go to the Security settings and set the PIN you want to use for your
  90. lockscreen.
  91. Now you have to backup the files where it is saved. To do so, execute these
  92. commands with adb - you need to be connected to a PC with a proper USB cable:
  93. ```
  94. adb root
  95. adb pull /data/system_de/0/spblob/
  96. adb pull /data/misc/keystore/user_0/1000_USRPKEY_synthetic_password_* # the file has a different name; just remove the * and press tab before executing it
  97. adb pull /data/system/locksettings.db
  98. ```
  99. Now, go to the Security settings again, and change your PIN to the password you
  100. want to use for the encryption. Unfortunately you can use maximally 17
  101. characters.
  102. Finally, you use adb again to restore the backup of the PIN, which changes your
  103. lockscreen PIN, but not your encryption passphrase:
  104. ```
  105. adb push locksettings.db /data/system/locksettings.db
  106. adb push 1000_USRPKEY_synthetic_password_* /data/misc/keystore/user_0/ # the filename will be different with your device
  107. adb push spblob/ /data/system_de/0/
  108. ```
  109. When you try to unlock your screen now, you will realize that you still have to
  110. enter the encryption passphrase. So reboot the phone; enter the encryption
  111. passphrase at startup, as desired. When the phone has booted, you can use the
  112. (shorter) PIN to unlock your phone.