[GUIDE] [CUSTOM] How to Install Custom ROM using ODIN without TWRP [PHH] [LineageOS]

Search This thread

Vanshmalani123

New member
May 11, 2022
4
0
Hello,

This would be a short & sweet guide on how to install a custom ROM on your Samsung using ODIN. I'm going to tailored this guide for the S10e G9700 HK version (is the phone I own) I'm a linux user but Odin only runs on Windows so this works 100% on a Windows 10 VM an of course native on Windows.

1. Who is this for?
For people that can't or don't want to install TWRP on their devices. For example TWRP doesn't work with the S10E Snapdragon G9700 the HK/CHG version.​

2. Will this method work on my bootloader locked phone?
NO!​
Bootloader locked phones are locked in hardware there's no way to flash anything but carriers ROMs to them. If you can unlock the bootloader this guide will work for you.​

3. Can I use this only with the G9700 phone?
No you can use any device, but this guide is tailored to the s10e g9700; because the TWRP version for this phone doesnt work with Android10.​

4. Why not use Heimdall and do the guide entirely on Linux?
I use Manjaro [Arch] linux and tried to get Heimdall to work but couldn't, so choose the path of least resistance, so ODIN and windows is what we got :).​

5. Recommended ROMs?
I'm not a fan of Google Apps so my recommendations are these (2) ROMs:​
1. https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz (No bloat, Stock Android 10 with FOSS Apps replacements of Gapps, you can install your own on top, Like I use Google Maps (the only Gapp I use)​
2. https://sourceforge.net/projects/an...7-UNOFFICIAL-treble_arm64_bvN.img.xz/download (Lineage OS 17.1 - this is vanilla, you will have to install an App store like F-Droid or Aurora from the .apk files using ADB [FYI] - This is what I use as my daily driver!​
note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_experimentations/issues/592#issuecomment-519853332

6. If using a PHH based ROM from phhusoon set this to get Bluetooth Audio working?
Under Developer Options - toggle ON "Disable Bluetooth A2DP hardware offload"

Credit goes to (for their work) @phhusson @AndyYan (Project Treble PHH & LineageOS PHH) & @mkh.mourad (CMD Script)
https://forum.xda-developers.com/project-treble/trebleenabled-device-development

Requirements


Step-by-Step Process

  1. Get your phone Official Stock ROM - https://samfw.com/firmware/SM-G9700/TGY (this is the one for my phone)
  2. Extract the downloaded file (you'll have the BL, AP, CP, CSC) .TAR.MD5 files
  3. Using 7zip extract just the AP .tar.md5 (it'll have img.lz4 files: boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4)
  4. Download a clean vbmeta.img file from Google - https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
  5. Now we need to compress the vbmeta.img file (just downloaded from google) using LZ4.
  6. Go into the /bin folder inside the script zip file provided (or download LZ4 from https://github.com/lz4/lz4/releases)
  7. Run this command
    Code:
    lz4.exe -B6 --content-size vbmeta.img vbmeta.img.lz4
  8. Done with vbmeta.img (keep the vbmeta.img.lz4 file)
  9. Now download your favorite Custom ROM (https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz)
  10. Using 7zip extract the .img.xz file & Rename the file inside to system.img.ext4 (this is the system OS without lz4 compression)
  11. Now we need to compress the system.img.ext4 file (just renamed) using LZ4.
  12. Run this command
    Code:
    lz4.exe -B6 --content-size system.img.ext4 system.img.ext4.lz4
  13. Done with system.img.ext4 (keep the system.img.ext4.lz4 file)
  14. Want to Root the device? if yes continue on; if not skip to step 24
  15. Take the boot.img.lz4 extracted from the stock ROM (the AP.tar.md5 file)
  16. We need to decompress this file using LZ4.
  17. Run this command
    Code:
    lz4.exe -d boot.img.lz4 boot.img
  18. Transfer this boot.img file to a phone and run Magisk Manager (doesnt need to be a rooted phone) and patch the boot.img file
  19. Take the patched file on your phone and transfer to your computer
  20. Rename the patched Magisk file to boot.img
  21. Now we need to compress the boot.img file (just renamed) using LZ4.
  22. Run this command
    Code:
    lz4.exe -B6 --content-size boot.img boot.img.lz4
  23. Done with the renamed Magisk patched (keep the boot.img.lz4 file)
  24. Replace the stock boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4 with the new customize files
  25. Extract the files from tar-md5-script-tool.zip
  26. Copy or Move all files below to the tar-md5-script-tool folder
  27. Files are: (we don't need the meta-data folder with fota.zip)
    boot.img.lz4
    dqmdbg.img.ext4.lz4
    dtbo.img.lz4
    persist.img.ext4.lz4
    recovery.img.lz4
    system.img.ext4.lz4
    userdata.img.ext4.lz4
    vbmeta.img.lz4
    vendor.img.ext4.lz4
  28. Now we are going to build the AP file to use with Odin
  29. Run the batch.bat file from the tar-md5-script-tool folder
  30. Once it finishes go to the /tar-md5-script-tool/temp-folder/
  31. Inside you will find the AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5
  32. Flash the BL, CP, CSC (use HOME_CSC) from your Stock ROM & AP (using AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5)
  33. Done

Thanks to @Alberbeast for reaching out and encouragement to help the community and S10e G9700 owners :good: ;)
i tried the steps on my secondary samsung galaxy m40.. when odin started, it worked fine then the phone switched off and odin showed failed.. and then my phone showed " an error occured while updating"... i fixed it by flashing the stock rom.. the phone is fine but idk where i went wrong.. if anyone can prepare a video tutorial it would be better..
 

Shamiul133

New member
Jul 6, 2022
2
0
Hello,

This would be a short & sweet guide on how to install a custom ROM on your Samsung using ODIN. I'm going to tailored this guide for the S10e G9700 HK version (is the phone I own) I'm a linux user but Odin only runs on Windows so this works 100% on a Windows 10 VM an of course native on Windows.

1. Who is this for?
For people that can't or don't want to install TWRP on their devices. For example TWRP doesn't work with the S10E Snapdragon G9700 the HK/CHG version.​

2. Will this method work on my bootloader locked phone?
NO!​
Bootloader locked phones are locked in hardware there's no way to flash anything but carriers ROMs to them. If you can unlock the bootloader this guide will work for you.​

3. Can I use this only with the G9700 phone?
No you can use any device, but this guide is tailored to the s10e g9700; because the TWRP version for this phone doesnt work with Android10.​

4. Why not use Heimdall and do the guide entirely on Linux?
I use Manjaro [Arch] linux and tried to get Heimdall to work but couldn't, so choose the path of least resistance, so ODIN and windows is what we got :).​

5. Recommended ROMs?
I'm not a fan of Google Apps so my recommendations are these (2) ROMs:​
1. https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz (No bloat, Stock Android 10 with FOSS Apps replacements of Gapps, you can install your own on top, Like I use Google Maps (the only Gapp I use)​
2. https://sourceforge.net/projects/an...7-UNOFFICIAL-treble_arm64_bvN.img.xz/download (Lineage OS 17.1 - this is vanilla, you will have to install an App store like F-Droid or Aurora from the .apk files using ADB [FYI] - This is what I use as my daily driver!​
note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_experimentations/issues/592#issuecomment-519853332

6. If using a PHH based ROM from phhusoon set this to get Bluetooth Audio working?
Under Developer Options - toggle ON "Disable Bluetooth A2DP hardware offload"

Credit goes to (for their work) @phhusson @AndyYan (Project Treble PHH & LineageOS PHH) & @mkh.mourad (CMD Script)
https://forum.xda-developers.com/project-treble/trebleenabled-device-development

Requirements


Step-by-Step Process

  1. Get your phone Official Stock ROM - https://samfw.com/firmware/SM-G9700/TGY (this is the one for my phone)
  2. Extract the downloaded file (you'll have the BL, AP, CP, CSC) .TAR.MD5 files
  3. Using 7zip extract just the AP .tar.md5 (it'll have img.lz4 files: boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4)
  4. Download a clean vbmeta.img file from Google - https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
  5. Now we need to compress the vbmeta.img file (just downloaded from google) using LZ4.
  6. Go into the /bin folder inside the script zip file provided (or download LZ4 from https://github.com/lz4/lz4/releases)
  7. Run this command
    Code:
    lz4.exe -B6 --content-size vbmeta.img vbmeta.img.lz4
  8. Done with vbmeta.img (keep the vbmeta.img.lz4 file)
  9. Now download your favorite Custom ROM (https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz)
  10. Using 7zip extract the .img.xz file & Rename the file inside to system.img.ext4 (this is the system OS without lz4 compression)
  11. Now we need to compress the system.img.ext4 file (just renamed) using LZ4.
  12. Run this command
    Code:
    lz4.exe -B6 --content-size system.img.ext4 system.img.ext4.lz4
  13. Done with system.img.ext4 (keep the system.img.ext4.lz4 file)
  14. Want to Root the device? if yes continue on; if not skip to step 24
  15. Take the boot.img.lz4 extracted from the stock ROM (the AP.tar.md5 file)
  16. We need to decompress this file using LZ4.
  17. Run this command
    Code:
    lz4.exe -d boot.img.lz4 boot.img
  18. Transfer this boot.img file to a phone and run Magisk Manager (doesnt need to be a rooted phone) and patch the boot.img file
  19. Take the patched file on your phone and transfer to your computer
  20. Rename the patched Magisk file to boot.img
  21. Now we need to compress the boot.img file (just renamed) using LZ4.
  22. Run this command
    Code:
    lz4.exe -B6 --content-size boot.img boot.img.lz4
  23. Done with the renamed Magisk patched (keep the boot.img.lz4 file)
  24. Replace the stock boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4 with the new customize files
  25. Extract the files from tar-md5-script-tool.zip
  26. Copy or Move all files below to the tar-md5-script-tool folder
  27. Files are: (we don't need the meta-data folder with fota.zip)
    boot.img.lz4
    dqmdbg.img.ext4.lz4
    dtbo.img.lz4
    persist.img.ext4.lz4
    recovery.img.lz4
    system.img.ext4.lz4
    userdata.img.ext4.lz4
    vbmeta.img.lz4
    vendor.img.ext4.lz4
  28. Now we are going to build the AP file to use with Odin
  29. Run the batch.bat file from the tar-md5-script-tool folder
  30. Once it finishes go to the /tar-md5-script-tool/temp-folder/
  31. Inside you will find the AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5
  32. Flash the BL, CP, CSC (use HOME_CSC) from your Stock ROM & AP (using AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5)
  33. Done

Thanks to @Alberbeast for reaching out and en
Hello,

This would be a short & sweet guide on how to install a custom ROM on your Samsung using ODIN. I'm going to tailored this guide for the S10e G9700 HK version (is the phone I own) I'm a linux user but Odin only runs on Windows so this works 100% on a Windows 10 VM an of course native on Windows.

1. Who is this for?
For people that can't or don't want to install TWRP on their devices. For example TWRP doesn't work with the S10E Snapdragon G9700 the HK/CHG version.​

2. Will this method work on my bootloader locked phone?
NO!​
Bootloader locked phones are locked in hardware there's no way to flash anything but carriers ROMs to them. If you can unlock the bootloader this guide will work for you.​

3. Can I use this only with the G9700 phone?
No you can use any device, but this guide is tailored to the s10e g9700; because the TWRP version for this phone doesnt work with Android10.​

4. Why not use Heimdall and do the guide entirely on Linux?
I use Manjaro [Arch] linux and tried to get Heimdall to work but couldn't, so choose the path of least resistance, so ODIN and windows is what we got :).​

5. Recommended ROMs?
I'm not a fan of Google Apps so my recommendations are these (2) ROMs:​
1. https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz (No bloat, Stock Android 10 with FOSS Apps replacements of Gapps, you can install your own on top, Like I use Google Maps (the only Gapp I use)​
2. https://sourceforge.net/projects/an...7-UNOFFICIAL-treble_arm64_bvN.img.xz/download (Lineage OS 17.1 - this is vanilla, you will have to install an App store like F-Droid or Aurora from the .apk files using ADB [FYI] - This is what I use as my daily driver!​
note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_experimentations/issues/592#issuecomment-519853332

6. If using a PHH based ROM from phhusoon set this to get Bluetooth Audio working?
Under Developer Options - toggle ON "Disable Bluetooth A2DP hardware offload"

Credit goes to (for their work) @phhusson @AndyYan (Project Treble PHH & LineageOS PHH) & @mkh.mourad (CMD Script)
https://forum.xda-developers.com/project-treble/trebleenabled-device-development

Requirements


Step-by-Step Process

  1. Get your phone Official Stock ROM - https://samfw.com/firmware/SM-G9700/TGY (this is the one for my phone)
  2. Extract the downloaded file (you'll have the BL, AP, CP, CSC) .TAR.MD5 files
  3. Using 7zip extract just the AP .tar.md5 (it'll have img.lz4 files: boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4)
  4. Download a clean vbmeta.img file from Google - https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
  5. Now we need to compress the vbmeta.img file (just downloaded from google) using LZ4.
  6. Go into the /bin folder inside the script zip file provided (or download LZ4 from https://github.com/lz4/lz4/releases)
  7. Run this command
    Code:
    lz4.exe -B6 --content-size vbmeta.img vbmeta.img.lz4
  8. Done with vbmeta.img (keep the vbmeta.img.lz4 file)
  9. Now download your favorite Custom ROM (https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz)
  10. Using 7zip extract the .img.xz file & Rename the file inside to system.img.ext4 (this is the system OS without lz4 compression)
  11. Now we need to compress the system.img.ext4 file (just renamed) using LZ4.
  12. Run this command
    Code:
    lz4.exe -B6 --content-size system.img.ext4 system.img.ext4.lz4
  13. Done with system.img.ext4 (keep the system.img.ext4.lz4 file)
  14. Want to Root the device? if yes continue on; if not skip to step 24
  15. Take the boot.img.lz4 extracted from the stock ROM (the AP.tar.md5 file)
  16. We need to decompress this file using LZ4.
  17. Run this command
    Code:
    lz4.exe -d boot.img.lz4 boot.img
  18. Transfer this boot.img file to a phone and run Magisk Manager (doesnt need to be a rooted phone) and patch the boot.img file
  19. Take the patched file on your phone and transfer to your computer
  20. Rename the patched Magisk file to boot.img
  21. Now we need to compress the boot.img file (just renamed) using LZ4.
  22. Run this command
    Code:
    lz4.exe -B6 --content-size boot.img boot.img.lz4
  23. Done with the renamed Magisk patched (keep the boot.img.lz4 file)
  24. Replace the stock boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4 with the new customize files
  25. Extract the files from tar-md5-script-tool.zip
  26. Copy or Move all files below to the tar-md5-script-tool folder
  27. Files are: (we don't need the meta-data folder with fota.zip)
    boot.img.lz4
    dqmdbg.img.ext4.lz4
    dtbo.img.lz4
    persist.img.ext4.lz4
    recovery.img.lz4
    system.img.ext4.lz4
    userdata.img.ext4.lz4
    vbmeta.img.lz4
    vendor.img.ext4.lz4
  28. Now we are going to build the AP file to use with Odin
  29. Run the batch.bat file from the tar-md5-script-tool folder
  30. Once it finishes go to the /tar-md5-script-tool/temp-folder/
  31. Inside you will find the AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5
  32. Flash the BL, CP, CSC (use HOME_CSC) from your Stock ROM & AP (using AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5)
  33. Done

Thanks to @Alberbeast for reaching out and encouragement to help the community and S10e G9700 owners :good: ;)
Hello sir.I need your help.My phone is Samsung M12.My device does not have TWRP or any custom recovery.So i search this type of help by anyhow i want to flash gsi on my phone.So tried your method to flash GSI. I have created AP file as you said.But when i tried to flash it says,LZ4 is invalid what should i do sir.Please help me.i have given an attach file.Thank You.
 

Shamiul133

New member
Jul 6, 2022
2
0
Hello sir.I need your help.My phone is Samsung M12.My device does not have TWRP or any custom recovery.So i search this type of help by anyhow i want to flash gsi on my phone.So tried your method to flash GSI. I have created AP file as you said.But when i tried to flash it says,LZ4 is invalid what should i do sir.Please help me.i have given an attach file.Thank You.
 

Attachments

  • Annotation 2022-07-06 135440.png
    Annotation 2022-07-06 135440.png
    15.3 KB · Views: 53

meric57

Senior Member
Oct 2, 2017
289
56
Oeutrange
Samsung Galaxy Tab E
Hello Shamiul133, you do with S10 tutorial and your serious samsung M12 does not do anything before find out.
If your planted your M12 it's not the fault of the one who made the tutorial, it's you alone who don't watch the news.
 
  • Sad
Reactions: Shamiul133

Junior_AB

Member
Mar 30, 2021
5
1
My rom shows super.img.lz4, I couldn't find the file system.img.lz4
What do I do? Can I flash the system.img.lz4 instead of super.img.lz4?
 

Caaapri

Member
May 7, 2022
10
4
Samsung Galaxy A52 5G
At this point i've been struggling to get a gsi on my a52 5G for the better part of 8 hours, i cant tell if the constant struggles have given me brain damage or im just missing something. i cant figure out how to compress the files back into LZ4, no luck with 7zip. i see the commands you said to use but have no idea how to get them working, powershell and CMD give me unknown command errors. Can you please elaborate on how to compress the files back into lz4? i'm on Windows 11 64 Bit.
 

ehdh288

Member
Dec 23, 2017
7
0
Samsung Galaxy A12
Tried this method with aosp 12.1 and vbmeta from the 1st post. Didnt work, do i need to download a different vbmeta specific for my device?
Code:
<ID:0/006> Added!!
<ID:0/006> Odin engine v(ID:3.1401)..
<ID:0/006> File analysis..
<ID:0/006> skip file list for home binary
<ID:0/006> metadata.img
<ID:0/006> misc.bin
<ID:0/006> userdata.img
<ID:0/006> Home Binary Download
<ID:0/006> Total Binary size: 2192 M
<ID:0/006> SetupConnection..
<ID:0/006> Initialzation..
<ID:0/006> Get PIT for mapping..
<ID:0/006> Firmware update start..
<ID:0/006> NAND Write Start!!
<ID:0/006> SingleDownload.
<ID:0/006> sboot.bin
<ID:0/006> up_param.bin
<ID:0/006> ldfw.img
<ID:0/006> tzsw.img
<ID:0/006> keystorage.bin
<ID:0/006> tzar.img
<ID:0/006> vbmeta.img
<ID:0/006> boot.img
<ID:0/006> dtbo.img
<ID:0/006> recovery.img
<ID:0/006> super.img
<ID:0/006> FAIL!
<ID:0/006>
<ID:0/006> Complete(Write) operation failed.
<OSM> All threads completed. (succeed 0 / failed 1)

From download mode:
DEBORE: ON_FAIL_PARTITION_ID
my device: Galaxy A12 SM-A127F
 

GancySon

New member
Nov 12, 2022
1
0
Hello,

This would be a short & sweet guide on how to install a custom ROM on your Samsung using ODIN. I'm going to tailored this guide for the S10e G9700 HK version (is the phone I own) I'm a linux user but Odin only runs on Windows so this works 100% on a Windows 10 VM an of course native on Windows.

1. Who is this for?
For people that can't or don't want to install TWRP on their devices. For example TWRP doesn't work with the S10E Snapdragon G9700 the HK/CHG version.​

2. Will this method work on my bootloader locked phone?
NO!​
Bootloader locked phones are locked in hardware there's no way to flash anything but carriers ROMs to them. If you can unlock the bootloader this guide will work for you.​

3. Can I use this only with the G9700 phone?
No you can use any device, but this guide is tailored to the s10e g9700; because the TWRP version for this phone doesnt work with Android10.​

4. Why not use Heimdall and do the guide entirely on Linux?
I use Manjaro [Arch] linux and tried to get Heimdall to work but couldn't, so choose the path of least resistance, so ODIN and windows is what we got :).​

5. Recommended ROMs?
I'm not a fan of Google Apps so my recommendations are these (2) ROMs:​
1. https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz (No bloat, Stock Android 10 with FOSS Apps replacements of Gapps, you can install your own on top, Like I use Google Maps (the only Gapp I use)​
2. https://sourceforge.net/projects/an...7-UNOFFICIAL-treble_arm64_bvN.img.xz/download (Lineage OS 17.1 - this is vanilla, you will have to install an App store like F-Droid or Aurora from the .apk files using ADB [FYI] - This is what I use as my daily driver!​
note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_experimentations/issues/592#issuecomment-519853332

6. If using a PHH based ROM from phhusoon set this to get Bluetooth Audio working?
Under Developer Options - toggle ON "Disable Bluetooth A2DP hardware offload"

Credit goes to (for their work) @phhusson @AndyYan (Project Treble PHH & LineageOS PHH) & @mkh.mourad (CMD Script)
https://forum.xda-developers.com/project-treble/trebleenabled-device-development

Requirements


Step-by-Step Process

  1. Get your phone Official Stock ROM - https://samfw.com/firmware/SM-G9700/TGY (this is the one for my phone)
  2. Extract the downloaded file (you'll have the BL, AP, CP, CSC) .TAR.MD5 files
  3. Using 7zip extract just the AP .tar.md5 (it'll have img.lz4 files: boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4)
  4. Download a clean vbmeta.img file from Google - https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
  5. Now we need to compress the vbmeta.img file (just downloaded from google) using LZ4.
  6. Go into the /bin folder inside the script zip file provided (or download LZ4 from https://github.com/lz4/lz4/releases)
  7. Run this command
    Code:
    lz4.exe -B6 --content-size vbmeta.img vbmeta.img.lz4
  8. Done with vbmeta.img (keep the vbmeta.img.lz4 file)
  9. Now download your favorite Custom ROM (https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz)
  10. Using 7zip extract the .img.xz file & Rename the file inside to system.img.ext4 (this is the system OS without lz4 compression)
  11. Now we need to compress the system.img.ext4 file (just renamed) using LZ4.
  12. Run this command
    Code:
    lz4.exe -B6 --content-size system.img.ext4 system.img.ext4.lz4
  13. Done with system.img.ext4 (keep the system.img.ext4.lz4 file)
  14. Want to Root the device? if yes continue on; if not skip to step 24
  15. Take the boot.img.lz4 extracted from the stock ROM (the AP.tar.md5 file)
  16. We need to decompress this file using LZ4.
  17. Run this command
    Code:
    lz4.exe -d boot.img.lz4 boot.img
  18. Transfer this boot.img file to a phone and run Magisk Manager (doesnt need to be a rooted phone) and patch the boot.img file
  19. Take the patched file on your phone and transfer to your computer
  20. Rename the patched Magisk file to boot.img
  21. Now we need to compress the boot.img file (just renamed) using LZ4.
  22. Run this command
    Code:
    lz4.exe -B6 --content-size boot.img boot.img.lz4
  23. Done with the renamed Magisk patched (keep the boot.img.lz4 file)
  24. Replace the stock boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4 with the new customize files
  25. Extract the files from tar-md5-script-tool.zip
  26. Copy or Move all files below to the tar-md5-script-tool folder
  27. Files are: (we don't need the meta-data folder with fota.zip)
    boot.img.lz4
    dqmdbg.img.ext4.lz4
    dtbo.img.lz4
    persist.img.ext4.lz4
    recovery.img.lz4
    system.img.ext4.lz4
    userdata.img.ext4.lz4
    vbmeta.img.lz4
    vendor.img.ext4.lz4
  28. Now we are going to build the AP file to use with Odin
  29. Run the batch.bat file from the tar-md5-script-tool folder
  30. Once it finishes go to the /tar-md5-script-tool/temp-folder/
  31. Inside you will find the AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5
  32. Flash the BL, CP, CSC (use HOME_CSC) from your Stock ROM & AP (using AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5)
  33. Done

Thanks to @Alberbeast for reaching out and encouragement to help the community and S10e G9700 owners :good: ;)
it say " FAIL! LZ4 is invalid" how to fix it?
 

billy996

Member
Jun 18, 2017
9
1
Due to the differences and models of the firmware, I provide a suggestion to replace only System.img.
Proceed as follows:
1. Use Magisk to patch AP*. MD5
2. Unzip the Patched AP*. MD5
3. Use 7ZS to decompress super.img.lz4 to get super.img
4. Unpack Super.img
5. Replace system.img
6. Packing back to super.img
7. Use 7zs to compress super.img.lz4
8. Compress all files after step 2 to compress the script of KKOO to the fixedware that can be recognized by ODIN.
9. Use Odin to flash all the firmware.
 
Last edited:

mzlmm

New member
Apr 3, 2021
2
0
My device is a5070。I followed the steps,but while flashing ,It got stuck in system.img and didn't report any errors.
Is there any way to solve this?
 

Attachments

  • 1678888428749.jpg
    1678888428749.jpg
    4.4 MB · Views: 5

Top Liked Posts

  • There are no posts matching your filters.
  • 38
    Hello,

    This would be a short & sweet guide on how to install a custom ROM on your Samsung using ODIN. I'm going to tailored this guide for the S10e G9700 HK version (is the phone I own) I'm a linux user but Odin only runs on Windows so this works 100% on a Windows 10 VM an of course native on Windows.

    1. Who is this for?
    For people that can't or don't want to install TWRP on their devices. For example TWRP doesn't work with the S10E Snapdragon G9700 the HK/CHG version.​

    2. Will this method work on my bootloader locked phone?
    NO!
    Bootloader locked phones are locked in hardware there's no way to flash anything but carriers ROMs to them. If you can unlock the bootloader this guide will work for you.
    https://www.getdroidtips.com/how-to-unlock-bootloader-on-samsung-galaxy-phones/

    3. Can I use this only with the G9700 phone?
    No you can use any device, but this guide is tailored to the s10e g9700; because the TWRP version for this phone doesnt work with Android10.​

    4. Why not use Heimdall and do the guide entirely on Linux?
    I use Manjaro [Arch] linux and tried to get Heimdall to work but couldn't, so choose the path of least resistance, so ODIN and windows is what we got :).​

    5. Recommended ROMs?
    I'm not a fan of Google Apps so my recommendations are these (2) ROMs:

    1. https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz (No bloat, Stock Android 10 with FOSS Apps replacements of Gapps, you can install your own on top, Like I use Google Maps (the only Gapp I use)
    2. https://sourceforge.net/projects/an...7-UNOFFICIAL-treble_arm64_bvN.img.xz/download (Lineage OS 17.1 - this is vanilla, you will have to install an App store like F-Droid or Aurora from the .apk files using ADB [FYI] - This is what I use as my daily driver!

    note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_experimentations/issues/592#issuecomment-519853332

    6. If using a PHH based ROM from phhusoon set this to get Bluetooth Audio working?
    Under Developer Options - toggle ON "Disable Bluetooth A2DP hardware offload"

    Credit goes to (for their work) @phhusson @AndyYan (Project Treble PHH & LineageOS PHH) & @mkh.mourad (CMD Script)
    https://forum.xda-developers.com/project-treble/trebleenabled-device-development

    Requirements


    Step-by-Step Process

    1. Get your phone Official Stock ROM - https://samfw.com/firmware/SM-G9700/TGY (this is the one for my phone)
    2. Extract the downloaded file (you'll have the BL, AP, CP, CSC) .TAR.MD5 files
    3. Using 7zip extract just the AP .tar.md5 (it'll have img.lz4 files: boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4)
    4. Download a clean vbmeta.img file from Google - https://dl.google.com/developers/android/qt/images/gsi/vbmeta.img
    5. Now we need to compress the vbmeta.img file (just downloaded from google) using LZ4.
    6. Go into the /bin folder inside the script zip file provided (or download LZ4 from https://github.com/lz4/lz4/releases)
    7. Run this command
      Code:
      lz4.exe -B6 --content-size vbmeta.img vbmeta.img.lz4
    8. Done with vbmeta.img (keep the vbmeta.img.lz4 file)
    9. Now download your favorite Custom ROM (https://github.com/phhusson/treble_...ad/v219/system-quack-arm64-aonly-floss.img.xz)
    10. Using 7zip extract the .img.xz file & Rename the file inside to system.img.ext4 (this is the system OS without lz4 compression)
    11. Now we need to compress the system.img.ext4 file (just renamed) using LZ4.
    12. Run this command
      Code:
      lz4.exe -B6 --content-size system.img.ext4 system.img.ext4.lz4
    13. Done with system.img.ext4 (keep the system.img.ext4.lz4 file)
    14. Want to Root the device? if yes continue on; if not skip to step 24
    15. Take the boot.img.lz4 extracted from the stock ROM (the AP.tar.md5 file)
    16. We need to decompress this file using LZ4.
    17. Run this command
      Code:
      lz4.exe -d boot.img.lz4 boot.img
    18. Transfer this boot.img file to a phone and run Magisk Manager (doesnt need to be a rooted phone) and patch the boot.img file
    19. Take the patched file on your phone and transfer to your computer
    20. Rename the patched Magisk file to boot.img
    21. Now we need to compress the boot.img file (just renamed) using LZ4.
    22. Run this command
      Code:
      lz4.exe -B6 --content-size boot.img boot.img.lz4
    23. Done with the renamed Magisk patched (keep the boot.img.lz4 file)
    24. Replace the stock boot.img.lz4, vbmeta.img.lz4 & system.img.ext4.lz4 with the new customize files
    25. Extract the files from tar-md5-script-tool.zip
    26. Copy or Move all files below to the tar-md5-script-tool folder
    27. Files are: (we don't need the meta-data folder with fota.zip)
      boot.img.lz4
      dqmdbg.img.ext4.lz4
      dtbo.img.lz4
      persist.img.ext4.lz4
      recovery.img.lz4
      system.img.ext4.lz4
      userdata.img.ext4.lz4
      vbmeta.img.lz4
      vendor.img.ext4.lz4
    28. Now we are going to build the AP file to use with Odin
    29. Run the batch.bat file from the tar-md5-script-tool folder
    30. Once it finishes go to the /tar-md5-script-tool/temp-folder/
    31. Inside you will find the AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5
    32. Flash the BL, CP, CSC (use HOME_CSC) from your Stock ROM & AP (using AP_TAR_MD5_CUSTOM_FILE_ODIN.tar.md5)
    33. Done

    Thanks to @Alberbeast for reaching out and encouragement to help the community and S10e G9700 owners :good: ;)
    13
    note* the proximity sensor doesn't work with the S10E and PHH based ROMs - https://github.com/phhusson/treble_e...ment-519853332

    This issue has actually been fixed a long time ago, you need to select "Enable extra sensors" in Treble settings though.
    4
    If someone knows or provides a place where to upload a complete ROM I can upload the Complete AP.tar.md5 ROM for LOS 17.1 OS Rooted with Magisk and the Android Stock FOSS image just to use with Odin. Let me know! Thanks
    4
    wow this is awesome:laugh: thank you so much @kkoo for the effort to create this guide, it's a life saver for those of us who can't use twrp and want to try aosp.

    Thanks again bro!
    2
    Following OP doesnt trip knox and other Samsung stuff , correct ? Which means, I can reflash with Samsung stock rom with losing samsung functionality like samsung pay.

    You can always reflash back to Samsung Stock ROM. I don't use any Samsung App so never cared about knox, but I assume it does trip knox.

    Does it work with us or canadian version of the snapdragon?

    No it doesn't work with any North America Galaxy S10 as those have the bootloader locked!