Post Reply

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

OP hnkotnis

28th February 2014, 03:24 PM   |  #1  
hnkotnis's Avatar
OP Senior Member
Flag Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Thanks Meter: 445
 
1,000 posts
Join Date:Joined: Jul 2013
More
GUIDE TO CREATE ODIN FLASHABLE
PREROOTED (and/or) PRETHEMED FIRMWARES


Guide by hnkotnis


Quote:

Featured On Portal! Thanks EAGLEEYETOM Sir.

http://www.xda-developers.com/androi...are-with-ease/


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.

Quote:
Originally Posted by hnkotnis

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)




Quote:

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


Quote:

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
# 2048M is the size of system.img
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
#Please add files which you get in step 4

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 by hnkotnis; 9th April 2014 at 03:34 PM.
The Following 29 Users Say Thank You to hnkotnis For This Useful Post: [ View ]
28th February 2014, 03:24 PM   |  #2  
hnkotnis's Avatar
OP Senior Member
Flag Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Thanks Meter: 445
 
1,000 posts
Join Date:Joined: Jul 2013
More
New ext4 Firmwares
Quote:

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
#Please add files which you get in step 4

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 by hnkotnis; 7th March 2014 at 07:33 AM.
The Following 5 Users Say Thank You to hnkotnis For This Useful Post: [ View ]
28th February 2014, 03:25 PM   |  #3  
hnkotnis's Avatar
OP Senior Member
Flag Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Thanks Meter: 445
 
1,000 posts
Join Date:Joined: Jul 2013
More
rfs Firmwares incompatible with simg2img
Quote:

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/stl9 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 LIST OF EXTRACTED FILES AND SYSTEM.IMG system.img

#Please add files which you get in step 4

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 by hnkotnis; 7th March 2014 at 07:34 AM.
The Following 4 Users Say Thank You to hnkotnis For This Useful Post: [ View ]
6th March 2014, 11:51 PM   |  #4  
snkycool's Avatar
Member
Flag District Heights, MD
Thanks Meter: 25
 
51 posts
Join Date:Joined: Jun 2009
More
I got my thinking cap on, and am ready to learn,
7th March 2014, 02:40 AM   |  #5  
Senior Member
Flag Bangkok
Thanks Meter: 20
 
198 posts
Join Date:Joined: Feb 2012
More
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!
7th March 2014, 03:17 AM   |  #6  
Senior Member
Thanks Meter: 156
 
207 posts
Join Date:Joined: Jan 2010
Would this work on the galaxy s4 with lock boot loader?
7th March 2014, 06:50 AM   |  #7  
Johrans's Avatar
Member
Flag Zeeland
Thanks Meter: 19
 
71 posts
Join Date:Joined: Jul 2012
Donate to Me
More
How can i split the xxxx_xxxx_HOME.tar.md5 to pda and modem and csc?
7th March 2014, 07:10 AM   |  #8  
hotdroid's Avatar
Senior Member
Thanks Meter: 388
 
282 posts
Join Date:Joined: Feb 2014
More
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..
The Following User Says Thank You to hotdroid For This Useful Post: [ View ]
7th March 2014, 07:25 AM   |  #9  
hnkotnis's Avatar
OP Senior Member
Flag Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Thanks Meter: 445
 
1,000 posts
Join Date:Joined: Jul 2013
More
Quote:
Originally Posted by Johrans

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.
7th March 2014, 07:27 AM   |  #10  
hnkotnis's Avatar
OP Senior Member
Flag Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Thanks Meter: 445
 
1,000 posts
Join Date:Joined: Jul 2013
More
Quote:
Originally Posted by hotdroid

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 )
Last edited by hnkotnis; 7th March 2014 at 07:36 AM.

The Following 2 Users Say Thank You to hnkotnis For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android General by ThreadRank