Activities/Android/UpcyclingWorkshops/FlashingSamsungPhones

Documentation for flashing Samsung phones.

Flashing Samsung Phones

Stock OS

Following different guides amongst others Flashing stock firmware onto a Samsung Galaxy S9+ (SM-G965F) on Ubuntu 18.04 using Heimdall.

Downloading Samsung firmware from official servers using samloader.

LineageOS

Following instructions on https://wiki.lineageos.org/devices/jfltexx/install, though, since a Windows machine is required according to the instructions, the instructions on https://wiki.lineageos.org/devices/ks01lte/install (Samsung Galaxy S4, different model) are followed using heimdall to flash partition images.

Prerequisites

Computer with

1. Heimdall

2. basic CLI utilties, i.e. curl, unzip, sha256sum

Stock OS

Additionally, python3 needs to be installed

Obtain factory image

Stock OS

The operating system to be installed is proprietary software from Samsung.

GT-I9505

Install samloader:

   1     python -m venv .venv
   2     # disable the default virtualenv prompt change
   3     VIRTUAL_ENV_DISABLE_PROMPT=1
   4     source .venv/bin/activate
   5     pip install git+https://github.com/samloader/samloader.git

Get the latest firmware version:

   1     samloader -m GT-I9505 -r DBT checkupdate

Download latest firmware version for specific region, we choose “DBT” for Germany:

A list of Country Specific Code (CSC) can be found here.

   1     samloader -m GT-I9505 -r DBT download -v  I9505XXUHPK2/I9505YBTHPK1/I9505XXUHPK2/I9505XXUHPK2 -O .

Decrypt firmware files:

   1     samloader -m GT-I9505 -r DBT decrypt -v  I9505XXUHPK2/I9505YBTHPK1/I9505XXUHPK2/I9505XXUHPK2 -V 4 -i GT-I9505_11_20170109205539_twvsagwmb6_fac.zip.enc4 -o GT-I9505_11_20170109205539_twvsagwmb6_fac.zip

Extract firmware files:

   1     unzip "GT-I9505_11_20170109205539_twvsagwmb6_fac.zip" -d GT-I9509

Extract firmware partition files:

   1     tar -xf *.tar.md5

LineageOS

GT-I9509

From their download page: https://download.lineageos.org/jfltexx

Download recovery image:

   1     curl -LO "https://mirrorbits.lineageos.org/recovery/jfltexx/20221020/lineage-18.1-20221020-recovery-jfltexx.img"

And verify its checksum:

   1     curl -L -o "lineage-18.1-20221020-recovery-jfltexx.img.sha256" "https://mirrorbits.lineageos.org/recovery/jfltexx/20221020/lineage-18.1-20221020-recovery-jfltexx.img?sha256"
   2     sha256sum -c "lineage-18.1-20221020-recovery-jfltexx.img.sha256"

Download LineageOS installation package:

   1     curl -LO "https://mirrorbits.lineageos.org/full/jfltexx/20221020/lineage-18.1-20221020-nightly-jfltexx-signed.zip"

And verify its checksum:

   1     curl -L -o "lineage-18.1-20221020-nightly-jfltexx-signed.zip.sha256" "https://mirrorbits.lineageos.org/full/jfltexx/20221020/lineage-18.1-20221020-nightly-jfltexx-signed.zip?sha256"
   2     sha256sum -c "lineage-18.1-20221020-nightly-jfltexx-signed.zip.sha256"

Reboot into download mode

GT-I9509

1. Unplug from USB and power off the phone.

2. Hold “Home” and both “Volume Down” and “Power”.

3. Press button that the onscreen instructions correlate to “Continue” and insert USB cable back into the device.

Flash factory image

Stock OS

GT-I9509

Check whether the device can be found:

   1     heimdall detect

Dump the PIT file:

   1     heimdall print-pit --no-reboot

Reboot into download mode, see section Reboot into download mode.

Flash firmware parition images:

   1     heimdall flash \
   2             --APNHLOS NON-HLOS.bin \
   3             --MDM modem.bin \
   4             --SBL1 sbl1.mbn \
   5             --SBL2 sbl2.mbn \
   6             --SBL3 sbl3.mbn \
   7             --ABOOT aboot.mbn \
   8             --RPM rpm.mbn \
   9             --TZ tz.mbn \
  10             --SYSTEM system.img.ext4 \
  11             --CACHE cache.img.ext4 \
  12             --BOOT boot.img \
  13             --RECOVERY recovery.img \
  14             --PERSDATA persdata.img.ext4 \
  15             --HIDDEN hidden.img.ext4

A blue transfer bar will appear on the device showing the progress of partition images being flashed.

The device reboots into the system.

LineageOS

Check whether the device can be found:

   1     heimdall detect

Flash recovery image

1. GT-I9509

Reboot into recovery

1. GT-I9509

  1. Unplug the USB cable from the device.
  2. Pull the device’s battery out and put it back in.

  3. Hold “Volume Down” and “Power” buttons for 8~10 seconds until screen turns black & release buttons immediately when it does.

  4. Hold “Volume Up” and both “Home” and “Power” & release “Power” button when phone vibrates, but keep holding the other two buttons.

Flash factory image

1. GT-I9509

Activities/Android/UpcyclingWorkshops/FlashingSamsungPhones (last edited 2022-11-14 17:26:58 by maxsc)