FORUMS

Analysis & Opinion

Top Forum Discussions

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

1,032 posts
Thanks Meter: 487
 
By hnkotnis, Senior Member on 28th February 2014, 03:24 PM
Post Reply Subscribe to Thread Email Thread
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: 487
 
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: 487
 
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: 30
 
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: 53
 
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
 
More
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
 
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: 399
 
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: 487
 
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: 487
 
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 ]
7th March 2014, 08:54 AM |#11  
rebel1699's Avatar
Senior Member
Flag Oklahoma
Thanks Meter: 1,387
 
More
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 by rebel1699; 7th March 2014 at 11:58 PM.

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android General by ThreadRank