• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

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

Search This thread
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.
 
Last edited:
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.
 
Last edited:
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.
 
Last edited:

body150165

Senior Member
Feb 16, 2012
405
67
Bangkok
It sounds feasible for me.

I will install vbox and ubuntu in it... how exciting... I might be able to make my own prerooted stock-app.

Great work!
 

hotdroid

Senior Member
Feb 16, 2014
282
403
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.. ;)
 
  • Like
Reactions: hnkotnis
How can i split the xxxx_xxxx_HOME.tar.md5 to pda and modem and csc?

It depends on your phone.

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.
 
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 )
 
Last edited:

rebel1699

Senior Member
Feb 13, 2008
2,066
1,468
Oklahoma
Google Pixel 3a XL
Google Pixel 4 XL
On Case 2, I am trying to mount the system.img. typing "sudo mount -o loop system.img.ext4 temp" only results in "you must specify the filesystem type".

Yeah, nevermind. The mkuserimg.sh has issues, needs work. Line 58 needs to be edited from "MAKE_EXT4FS" to "make_ext4fs" otherwise, it will return command not found. It also never actually builds the resulting image. No system.img.ext4 is ever found anywhere after running the script. Just still left with the original that you started with, with no changes. In addition, some image files with the ext4 extension ARE NOT IN EXT4 FORMAT. You still must rename to remove the ext4 extension, and sim2img in order to mount. Still, all pointless since the mkuserimg.sh is partially fragged. If you attempt to run "Case 2" one some system.img.ext4 images, you will fail. "Sudo mount -o loop system.img.ext4 temp" will result in no more than "you must specify the filesystem type"

Sent from my Nexus 7 using XDA Premium 4 mobile app
 
Last edited:

akkishayk

Member
Apr 28, 2013
8
2
Mumbai
hello frnds..
i have a galaxy star pro device
and i am trying to pre root my stock firmware using 1st case
all steps goes well but at the step of repack the system.img file i get following error

[email protected]:/home/akshay/Documents/ext4_utils# ./mkuserimg.sh -s temp system.img ext4 temp 1027M
+ echo 'in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ ENABLE_SPARSE_IMAGE=
+ '[' -s = -s ']'
+ ENABLE_SPARSE_IMAGE=-s
+ shift
+ '[' 5 -ne 5 -a 5 -ne 6 ']'
+ SRC_DIR=temp
+ '[' '!' -d temp ']'
+ OUTPUT_FILE=system.img
+ EXT_VARIANT=ext4
+ MOUNT_POINT=temp
+ SIZE=1027M
+ FC=
+ case $EXT_VARIANT in
+ '[' -z temp ']'
+ '[' -z 1027M ']'
+ '[' -n '' ']'
+ MAKE_EXT4FS_CMD='make_ext4fs -s -l 1027M -a temp system.img temp'
+ echo make_ext4fs -s -l 1027M -a temp system.img temp
make_ext4fs -s -l 1027M -a temp system.img temp
+ make_ext4fs -s -l 1027M -a temp system.img temp
./mkuserimg.sh: line 58: make_ext4fs: command not found
+ '[' 127 -ne 0 ']'
+ exit 4
[email protected]:/home/akshay/Documents/ext4_utils#


and if i change the mkuserimg.sh file as per the rebel1699 from MAKE_EXT4FS TO make_ext4fs
then i get the following output-


[email protected]:/home/akshay/Documents/ext4_utils# ./mkuserimg.sh -s temp system.img ext4 temp 1027M
+ echo 'in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ ENABLE_SPARSE_IMAGE=
+ '[' -s = -s ']'
+ ENABLE_SPARSE_IMAGE=-s
+ shift
+ '[' 5 -ne 5 -a 5 -ne 6 ']'
+ SRC_DIR=temp
+ '[' '!' -d temp ']'
+ OUTPUT_FILE=system.img
+ EXT_VARIANT=ext4
+ MOUNT_POINT=temp
+ SIZE=1027M
+ FC=
+ case $EXT_VARIANT in
+ '[' -z temp ']'
+ '[' -z 1027M ']'
+ '[' -n '' ']'
+ MAKE_EXT4FS_CMD='make_ext4fs -s -l 1027M -a temp system.img temp'
+ echo make_ext4fs -s -l 1027M -a temp system.img temp
make_ext4fs -s -l 1027M -a temp system.img temp
+ '[' 0 -ne 0 ']'
[email protected]:/home/akshay/Documents/ext4_utils#



no system.img file is created
so how to resolve this problem???
 
hello frnds..
i have a galaxy star pro device
and i am trying to pre root my stock firmware using 1st case
all steps goes well but at the step of repack the system.img file i get following error

[email protected]:/home/akshay/Documents/ext4_utils# ./mkuserimg.sh -s temp system.img ext4 temp 1027M
+ echo 'in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ ENABLE_SPARSE_IMAGE=
+ '[' -s = -s ']'
+ ENABLE_SPARSE_IMAGE=-s
+ shift
+ '[' 5 -ne 5 -a 5 -ne 6 ']'
+ SRC_DIR=temp
+ '[' '!' -d temp ']'
+ OUTPUT_FILE=system.img
+ EXT_VARIANT=ext4
+ MOUNT_POINT=temp
+ SIZE=1027M
+ FC=
+ case $EXT_VARIANT in
+ '[' -z temp ']'
+ '[' -z 1027M ']'
+ '[' -n '' ']'
+ MAKE_EXT4FS_CMD='make_ext4fs -s -l 1027M -a temp system.img temp'
+ echo make_ext4fs -s -l 1027M -a temp system.img temp
make_ext4fs -s -l 1027M -a temp system.img temp
+ make_ext4fs -s -l 1027M -a temp system.img temp
./mkuserimg.sh: line 58: make_ext4fs: command not found
+ '[' 127 -ne 0 ']'
+ exit 4
[email protected]:/home/akshay/Documents/ext4_utils#


and if i change the mkuserimg.sh file as per the rebel1699 from MAKE_EXT4FS TO make_ext4fs
then i get the following output-


[email protected]:/home/akshay/Documents/ext4_utils# ./mkuserimg.sh -s temp system.img ext4 temp 1027M
+ echo 'in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games'
in mkuserimg.sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ ENABLE_SPARSE_IMAGE=
+ '[' -s = -s ']'
+ ENABLE_SPARSE_IMAGE=-s
+ shift
+ '[' 5 -ne 5 -a 5 -ne 6 ']'
+ SRC_DIR=temp
+ '[' '!' -d temp ']'
+ OUTPUT_FILE=system.img
+ EXT_VARIANT=ext4
+ MOUNT_POINT=temp
+ SIZE=1027M
+ FC=
+ case $EXT_VARIANT in
+ '[' -z temp ']'
+ '[' -z 1027M ']'
+ '[' -n '' ']'
+ MAKE_EXT4FS_CMD='make_ext4fs -s -l 1027M -a temp system.img temp'
+ echo make_ext4fs -s -l 1027M -a temp system.img temp
make_ext4fs -s -l 1027M -a temp system.img temp
+ '[' 0 -ne 0 ']'
[email protected]:/home/akshay/Documents/ext4_utils#



no system.img file is created
so how to resolve this problem???

Use method 3. It is compatible with all Samsung phones.
 

manojkumar8552

Senior Member
Nov 9, 2013
664
497
AHEMADABAD

Press Thanks if helped.

i suggesting you to make a video guide as possible as you can do !!!

watching videos clears idea more than text files !!

would you like to make receipe by wwatching youtube or buy book and do it as shown in book ??????????


---------- Post added at 12:37 PM ---------- Previous post was at 12:36 PM ----------

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.




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)








Press Thanks if helped.


i suggesting you to make a video guide as possible as you can do !!!

watching videos clears idea more than text files !!

would you like to make receipe by wwatching youtube or buy book and do it as shown in book ??????????
 
i suggesting you to make a video guide as possible as you can do !!!

watching videos clears idea more than text files !!

would you like to make receipe by wwatching youtube or buy book and do it as shown in book ??????????


---------- Post added at 12:37 PM ---------- Previous post was at 12:36 PM ----------




i suggesting you to make a video guide as possible as you can do !!!

watching videos clears idea more than text files !!

would you like to make receipe by wwatching youtube or buy book and do it as shown in book ??????????

Why you are posting same thing double?

And no, I cannot make and upload video. It will take lot of time to upload. I have really bad internet.

Sent from my GT-I9001 Gadget of Mass Destruction with CM11 using XDA Developers App.
 

Androidwizzard

Inactive Recognized Contributor
Nov 22, 2013
4,271
7,193
Note 2 KitKat

I assume that this will not work an Note 2 Android 4.4.2, right?
Only changes in system.img won't pre-root any more afaik....
 

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.. ;)