[GUIDE] A Comprehensive Guide to Create Prerooted Odin Flashable Packages

Search This thread

Thorjk

New member
Sep 3, 2014
1
0
Determine if rfs ext4 bad magic

Can you help me?
When I type:
mkuserimg.sh -s temp system.img ext4 tempdir 2048M

I got this error:

root@ubuntu:/home/thorjk/Desktop/I8200XXUANG1_I8200OXAANG1_I8200XXUANG1_HOME# mkuserimg.sh -s temp system.img ext4 tempdir 1536M
mkuserimg.sh: command not found
 
Last edited:

1619415

Senior Member
Mar 16, 2014
2,029
1,276
23
Will this still work on Samsung Lollipop?
 
Last edited:

chrisla95

New member
Feb 11, 2016
2
0
sorry for picking such an old thread, but I just tried creating a ROM for my S3 mini VE (GT-I8200n). I followed your tutorial step by step, just deleted some of the stock apps instead of rooting, but while flashing with Odin (v10.6) it says "FAIL!" shortly after starting to flash system.img. I also tried just to unpack and repack system.img without changing anything, but still get the same problem. Is there anything i am missing? Or does flashing only work with an specific version of Odin?

P.S.: just noticed that the repacked system.img is slightly bigger than the original one (about 9 megabyte), although I didn't change anything. Could that be the problem?
 

nunopenim

Senior Member
Jul 9, 2015
454
314
Lisboa
@hnkotnis My original firmware system is named as system.img.ext4, but I used case 3. When I compress everything back in a tar, do I leave it as system.img, or change to system.img.ext4? I am running a Galaxy Express 4G (GT-I8730). Thank you for your help
 

r3b31

Member
Sep 3, 2016
8
3
have u found the solution?

i am also getting fail msg on odin during flash when the system.img starts to flash. cache, recovery flashes but when system.img starts to flash, flashing stops with fail msg on odin. help would be appreciated. thanks
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    GUIDE TO CREATE ODIN FLASHABLE
    PREROOTED (and/or) PRETHEMED FIRMWARES


    Guide by hnkotnis




    Hello Everyone!

    All of us, who own a Samsung device, need Odin Flash to go back to stock firmware.
    This is done for various reasons like you want to flash a new ROM, so going to use stock ROM to serve as a base
    or simply love stock ROM because of its stability.

    However there is a catch. As soon as you flash the firmware, you lose root access.
    Then starts the process (oftenly boring as you do it many times) and not to mention wear and tear of hardware buttons in recovery.
    But this is easily solved by converting the firmwares into prerooted ones. You can put Superuser/SuperSU (and/or) busybox.

    I assume you use 3 file flashing. PDA, PHONE (that is MODEM) and CSC.

    For my Samsung Galaxy y, I split firmware using SplitFUS2, because Galaxy y does not support single file flashing. It requires PDA, PHONE,CSC

    But if your phone supports 1 file flashing, then rename xxxx_xxxx_HOME.tar.md5 to xxxx_xxxx_HOME.tar (I assume you know how to CHANGE FILE EXTENSION BY RENAMING)

    Then extract it by WinRAR/7zip anything. You will get boot.img, system.img etc. Then at last step you make tar of these extracted files.


    Now coming to the point, there are 3 cases.
    1) Firmwares which are in rfs and converted with simg2img
    2) Latest firmwares which are based on ext4 (These files when extracted they are named as system.img.ext4 etc.)
    3) Firmwares which show "bad magic" with simg2img (like galaxy y firmwares)




    Prerequisites:-

    1) Linux Environment (virtualbox can work) (I use Ubuntu 12.04 VBOX) (for case 3 cygwin will work)

    2) Ability to transfer files from Virtualbox to Host (Refer here)

    3) ext4_utils from here (They are required only for first 2 cases) (Put them in working folder)

    4) Usable brain (must be dual core) Download Link:- Error 404: File encrypted to keep trolls away :D


    CASE 1:- rfs format with simg2img support​
    Credits to dr.ketan

    1) Download 3 file firmware from XDA Forum of your device. (skip steps 2 & 3 if you have done this)

    2) Download firmware from Sammobile It will be named as xxxx_xxxx_HOME.tar.md5

    3) Split it if required into PDA, PHONE & CSC. (We need only PDA file, take it to Linux PC/VBOX)

    But if your phone firmware doesn't have PDA, CSC etc flashing, then rename xxxx_xxxx_HOME.tar.md5 to xxxx_xxxx_HOME.tar (I assume you know how to CHANGE FILE EXTENSION BY RENAMING)

    Then extract it by WinRAR/7zip anything. You will get boot.img, system.img etc. Then at last step you make tar of these extracted files.

    4) Extract it
    Code:
    tar xvf {your PDA file name here}.tar.md5

    5) Convert it to ext4 to make it mountable.
    Code:
    ./simg2img system.img newsys.img

    Then delete old system.img

    6) Create temp folder and mount it.
    Code:
    mkdir temp
    mount -o loop newsys.img temp

    7) Add root app (I am adding Superuser.apk), su binary and busybox.
    Code:
    cp su temp/xbin/su
    chmod 06755 temp/xbin/su
    
    cp Superuser.apk temp/app/Superuser.apk
    chmod 0644 temp/app/Superuser.apk
    
    cp busybox temp/xbin/busybox
    chmod 04755 temp/xbin/busybox

    8) Convert newsys.img to samsung system.img format.
    Code:
    ./mkuserimg.sh -s temp system.img ext4 tempdir 2048M
    [COLOR=green]# 2048M is the size of system.img[/COLOR]

    9) Unmount and delete temp folder.
    Code:
    umount temp
    rmdir temp

    10) Create tar file and add md5 checksum
    Code:
    tar cvf prerooted.tar boot.img cache.img hidden.img modem.bin recovery.img sboot.bin system.img tz.img
    #[COLOR="Green"][I]Please add files which you get in step 4[/I][/COLOR]
    
    md5sum -t prerooted.tar >> prerooted.tar
    mv prerooted.tar prerooted.tar.md5

    11) Now flash this output file from Odin.

    Press Thanks if helped.
    7
    New ext4 Firmwares

    CASE 2:- New ext4 Firmwares​

    1) Download 3 file firmware from XDA Forum of your device. (skip steps 2 & 3 if you have done this)

    2) Download firmware from Sammobile It will be named as xxxx_xxxx_HOME.tar.md5

    3) Split it if required into PDA, PHONE & CSC. (We need only PDA file, take it to Linux PC/VBOX) (I renamed PDA file to stock.tar.md5)

    But if your phone firmware doesn't have PDA, CSC etc flashing, then rename xxxx_xxxx_HOME.tar.md5 to xxxx_xxxx_HOME.tar (I assume you know how to CHANGE FILE EXTENSION BY RENAMING)

    Then extract it by WinRAR/7zip anything. You will get boot.img, system.img etc. Then at last step you make tar of these extracted files.

    YOU NEED ROOT ACCESS IN LINUX TERMINAL.

    4) Extract it to working folder.
    Code:
    tar xvf {your PDA file name here}.tar.md5

    5) Create temp folder and mount it.
    Code:
    mkdir temp
    sudo mount -o loop system.img.ext4 temp

    6) Add root app (I am adding Superuser.apk), su binary and busybox.
    Code:
    cp su temp/xbin/su
    chmod 06755 temp/xbin/su
    
    cp Superuser.apk temp/app/Superuser.apk
    chmod 0644 temp/app/Superuser.apk
    
    cp busybox temp/xbin/busybox
    chmod 04755 temp/xbin/busybox

    8) Convert newsys.img to samsung system.img format.
    Code:
    ./mkuserimg.sh -s temp system.img ext4 tempdir 2048M

    9) Unmount and delete temp folder.
    Code:
    umount temp
    rmdir temp

    10) Create tar file and add md5 checksum
    Code:
    tar -H ustar -c aboot.mbn boot.img cache.img.ext4 hidden.img.ext4 modem.bin NON-HLOS.bin recovery.img rpm.mbn sbl2.mbn sbl3.mbn system.img.ext4 tz.mbn > prerooted.tar
    #[COLOR="Green"][I]Please add files which you get in step 4[/I][/COLOR]
    
    md5sum -t prerooted.tar >> prerooted.tar
    mv prerooted.tar prerooted.tar.md5

    11) Now flash this output file from Odin.

    Press Thanks if helped.
    3
    rfs Firmwares incompatible with simg2img

    CASE 3:- rfs Firmwares incompatible with simg2img
    (Works with above type phones also)​

    1) Download 3 file firmware from XDA Forum of your device. (skip steps 2 & 3 if you have done this).

    2) Download firmware from Sammobile It will be named as xxxx_xxxx_HOME.tar.md5

    3) Split it if required into PDA, PHONE & CSC. (We need only PDA file, take it to Linux PC/VBOX) (I renamed PDA file to stock.tar.md5)

    But if your phone firmware doesn't have PDA, CSC etc flashing, then rename xxxx_xxxx_HOME.tar.md5 to xxxx_xxxx_HOME.tar (I assume you know how to CHANGE FILE EXTENSION BY RENAMING)

    Then extract it by WinRAR/7zip anything. You will get boot.img, system.img etc. Then at last step you make tar of these extracted files.

    YOU NEED ROOT ACCESS IN LINUX TERMINAL.

    4) Extract it
    Code:
    tar xvf {your PDA file name here}.tar.md5

    5) Flash your phone with stock firmware, root it, install busybox (You can also deodex and/or theme it).
    Know mount point of /system partition of your phone.
    In my Galaxy y it is stl9. So replace red coloured letters with your moint point.


    6) Go to terminal emulator on phone and type
    Code:
    su
    dd if=/dev/block/[COLOR="red"]stl9[/COLOR] of=/sdcard/system.img bs=4096

    7) Pull this file to your computer (Use any method, adb or mount card)

    8) Put this file in your working folder.

    9) In Linux/Cygwin Terminal, type
    Code:
    tar cvf prerooted.tar [COLOR="Green"]LIST OF EXTRACTED FILES AND SYSTEM.IMG[/COLOR] system.img
    
    #[COLOR="Green"][I]Please add files which you get in step 4[/I][/COLOR]
    
    md5sum -t prerooted.tar >> prerooted.tar
    mv prerooted.tar prerooted.tar.md5

    11) Now flash this output file from Odin.

    Press Thanks if helped.
    2
    hi.. how about the firmware that doesnt contain PDA, PHONE & CSC parts..? some firmware that contains *.img files inside it.. hope you can make guide for this one..
    thanks for your work.. great to see this on XDA Portal.. ;)

    Please read my comment above this post. It is for the case you are saying.
    Also I updated OP with this information. (I know searching OP is hard, OP is very long :D )
    1
    hi.. how about the firmware that doesnt contain PDA, PHONE & CSC parts..? some firmware that contains *.img files inside it.. hope you can make guide for this one..
    thanks for your work.. great to see this on XDA Portal.. ;)