Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,899 Members 48,628 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
hnkotnis
Old
(Last edited by hnkotnis; 9th April 2014 at 03:34 PM.)
#1  
hnkotnis's Avatar
Senior Member - OP
Thanks Meter 432
Posts: 994
Join Date: Jul 2013
Location: Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Default [GUIDE] A Comprehensive Guide to Create Prerooted Odin Flashable Packages

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 View Post
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.
The Following 27 Users Say Thank You to hnkotnis For This Useful Post: [ Click to Expand ]
 
hnkotnis
Old
(Last edited by hnkotnis; 7th March 2014 at 07:33 AM.)
#2  
hnkotnis's Avatar
Senior Member - OP
Thanks Meter 432
Posts: 994
Join Date: Jul 2013
Location: Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Default 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.
The Following 5 Users Say Thank You to hnkotnis For This Useful Post: [ Click to Expand ]
 
hnkotnis
Old
(Last edited by hnkotnis; 7th March 2014 at 07:34 AM.)
#3  
hnkotnis's Avatar
Senior Member - OP
Thanks Meter 432
Posts: 994
Join Date: Jul 2013
Location: Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Default 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.
The Following 4 Users Say Thank You to hnkotnis For This Useful Post: [ Click to Expand ]
 
snkycool
Old
#4  
snkycool's Avatar
Member
Thanks Meter 23
Posts: 49
Join Date: Jun 2009
Location: District Heights, MD
I got my thinking cap on, and am ready to learn,
Sent From: GNoteIII: Pimpin', Pimpin'
The X Pile: Toss Pieces
GNII
SIII
 
body150165
Old
#5  
Senior Member
Thanks Meter 19
Posts: 180
Join Date: Feb 2012
Location: 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!
 
swgamez
Old
#6  
Senior Member
Thanks Meter 156
Posts: 207
Join Date: Jan 2010
Would this work on the galaxy s4 with lock boot loader?
 
Johrans
Old
#7  
Johrans's Avatar
Member
Thanks Meter 19
Posts: 71
Join Date: Jul 2012
Location: Zeeland

 
DONATE TO ME
How can i split the xxxx_xxxx_HOME.tar.md5 to pda and modem and csc?
[ROM] NexusHD2-JellyBean-4.1.2-CM10 V1.1
[NativeSD][Recognized
[Developer] Tytung
----------------------------------------------------------------------------------------------------------------------------------------------------------------

Playing with Nokia, Samsung, LG, Iphone, Sony .

Quote:
Who I Am............ watch this video
And You Kn0w It
I have ORD
 
hotdroid
Old
#8  
hotdroid's Avatar
Senior Member
Thanks Meter 375
Posts: 274
Join Date: Feb 2014
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: [ Click to Expand ]
 
hnkotnis
Old
#9  
hnkotnis's Avatar
Senior Member - OP
Thanks Meter 432
Posts: 994
Join Date: Jul 2013
Location: Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Quote:
Originally Posted by Johrans View Post
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.
 
hnkotnis
Old
(Last edited by hnkotnis; 7th March 2014 at 07:36 AM.)
#10  
hnkotnis's Avatar
Senior Member - OP
Thanks Meter 432
Posts: 994
Join Date: Jul 2013
Location: Sangli, Maharashtra, India, Asia, Earth, Solar System, Milky Way Galaxy, Local Galaxy Group,Universe
Quote:
Originally Posted by hotdroid View Post
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 )

The Following 2 Users Say Thank You to hnkotnis For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes