Skip to content

Instantly share code, notes, and snippets.

@micw
Last active April 15, 2024 10:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micw/d99d973736c901a58d5622d85f5b3720 to your computer and use it in GitHub Desktop.
Save micw/d99d973736c901a58d5622d85f5b3720 to your computer and use it in GitHub Desktop.
LinageOS on Samsgung Galaxy S5e WiFi from scratch from Linux with heimdall

LinageOS on Samsgung Galaxy S5e WiFi from scratch from Linux with heimdall

Compile a patched version of heimdall

cd /tmp
git clone https://github.com/Benjamin-Dobell/Heimdall.git
cd Heimdall
git fetch origin pull/478/head:pr478
git checkout pr478
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
  • The patched version of heimdall can be found in bin

Enable OEM unlock

  • Boot the device
  • In device info / software info tap 7 times on "Build number" - this will enable developer options
  • In developer options enable "OEM unlock" This option might not be available unless the device is connected to a wifi or mobile internet connection

Unlock the bootloader

  • power off the device
  • while pressing and holding Vol+ and Vol-, plug an USB cable (you might need to grow another hand to do so ^^)
  • A blue warning screen will appear with 3 options
    • Vol+: Continue
    • Vol+ long press: Device unlock mode
    • Vol-: Cancel
  • Use "Vol+ long press" to unlock the bootloader
  • On the next screen, confirm with "Vol+". This will unlock the boot loader and factory reset the device

Re-enable OEM unlock

  • After unlocking the bootloader, boot the device
  • Go through the android setup, connect the device to a wifi
  • Repeat the steps above to enable "OEM unlock"
  • In my case, "OEM onlock" was still enabled and grayed out. But be sure to have it checked.

Flash a modified version of vbmeta.img

  • power off the device
  • while pressing and holding Vol+ and Vol-, plug an USB cable
  • A blue warning screen will appear with the same 3 options as before
  • press "Vol+" to enter "download" mode
  • In the top left corner are some relevant information. Be sure that it correlates with the following, otherwise bad things will happen
    • FRP LOCK: Off
    • OEM Lock: OFF (U)
  • Download vbmeta.img from https://download.lineageos.org/devices/gts4lvwifi/builds
  • Using heimdal compiled in the initial step, now run ./bin/heimdall flash --VBMETA /tmp/vbmeta.img --verbose
  • After successfully flashing the image, the device reboots with a lot of warnings. It fails to boot into android and recommends a factory data reset
    • Follow the instructions to do the factory data reset
    • Android will now boot

Re-enable OEM unlock

  • After unlocking the bootloader, boot the device
  • Go through the android setup, connect the device to a wifi
  • Repeat the steps above to enable "OEM unlock"
  • In my case, "OEM onlock" was still enabled and grayed out. But be sure to have it checked.

Flash and boot recovery.img

  • Power off the device, hold Vol+ and Vol-, plug an USB device
  • On the blue screen press "Vol+" to enter "download" mode
  • Download recovery.img from https://download.lineageos.org/devices/gts4lvwifi/builds
  • Using heimdal compiled in the initial step, now run ./bin/heimdall flash --RECOVERY /tmp/recovery.img --verbose --no-reboot
  • The "no-reboot" option is very important. Do not let android boot at this stage!
  • Now good timing is required
    • Press and hold Power and Vol- until the device reboots
    • As soon as the screen turns black, press and hold Power and Vol+
  • If all went right, Lineage OS recovery is started. It is regognizable by thepink/purple colors and the Lineage OS logo on the top
  • Repeat the whole procesdure in this chapter if anything fails

Flash Lineage OS and optionally Google Apps

  • The device must be in Lineage OS recovery and be connected via USB
  • ADB must be installed on your computer
  • Download Lineage OS from https://download.lineageos.org/devices/gts4lvwifi/builds
    • On the device go to "Apply update", confirm with Power Key
    • Then go to "Apply from ADB", confirm with Power Key
    • Flash with adb sideload /tmp/lineage-21.0-20240320-nightly-gts4lvwifi-signed.zip
  • Optionally download a matching version of Google Apps from https://wiki.lineageos.org/gapps/. You neeed the ARM64 version
    • On the device go to "Apply update", confirm with Power Key
    • Then go to "Apply from ADB", confirm with Power Key
    • Flash with adb sideload /tmp/MindTheGapps-14.0.0-arm64-20240225_232108.zip
    • On the device confirm that the package shall be installed despite that the signature verification has failed.
  • Now you must do another factory data reset. Otherwise boot will fail until you do so.
  • After that you can boot into Lineage OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment