- Feb 25, 2012
- 4,850
- 12,938
I recently put together a tutorial on how to extract files from a stock TAR.MD5 and one of the questions that came up most was “how do I create my own TAR.MD5’s?” I’m going to show you how to do that here.
The standard disclaimer applies here. This tutorial is just the beginning. It does not make you into a Elite Developer, it does not give you everything you need to conquer the world or even make your own ROM. What it does do is give you some of the tools to get you headed in that direction.
So what does this do for you? Well if you have the information from this thread and a few other places you could in fact build a full ROM that is flashable through Odin rather than through a custom recovery. No more need to root your phone beforehand, you could just plug it in to your computer and flash a custom ROM. I myself am not going to show you how to do a custom ROM but I promise you that the tools and resources are out there. That's how I learned this!
I will also not be showing you how to make your own ROM. Yes, you could use this as a step in creating your own ROM but it involves more Linux than I know how to teach. The good news is that someone else far more talented than I has already put together the tools how to do it. For instructions on how to build your own factoryfs.img (this is where 99% of the ROM is stored in a TAR.MD5) please visit Chris41g's thread at http://xdaforums.com/showthread.php?t=1750295.
Now for the fun stuff!
If you feel you already have a working knowledge of what a TAR.MD5 is and how it works you can skip all the rest of this and go directly to www.rwilco12.com for the rest of the tutorial on how to create your own TAR.MD5.
In order to create a flashable TAR you should first understand the way they work. I’ll give you a semi-brief rundown.
Each Samsung device is setup with several partitions. These partitions all control different aspects of each device. AdamOutler put together a good list of all of them when the Epic 4G Touch first came out. I’ve used his list (http://xdaforums.com/showpost.php?p=17949633&postcount=8) as a base for my explanations.
For the Epic 4G Touch (SPH-D710) the partitions are as follows:
Now the other question I get is, “How is this different from flashing a ROM in a ZIP format?” The biggest difference is in how they flash. A TAR does one thing and the ZIP does another.
Essentially the TAR.MD5 is what is known as a TAR Ball. A TAR Ball is a compilation of multiple files into an ordered archive. You may not see the order when you open the archive as an archive but the way it is digitally signed determines the order the files are stored and accessed within the TAR (this is important when using Odin to flash). As we previously covered each of those files corresponds to a specific partition on the device. What you don't see is that the way that Odin works is it takes that partition image and completely replaces everything currently on the partition with the new partition image. That there is the major reason why a full TAR build will always wipe all data. The way around this is to remove the data.img and cache.img files. However, removing them from the TAR ball ruins the digital signature and corrupts it. So you can't just manually remove them from the TAR ball but you can pull out the files you need and rebuild a new one.
Now a ZIP ROM. Essentially the ZIP is a standard ZIP archive. The only difference is that CWM (or its variants) has a specific area that they look for a script. These are a bit trickier to understand. That script controls the flashing process. Generally you would write it in the script that a batch of files (based on file structure) goes to the same folder on a specific partition. For example, you have an app you want to flash to the system/apps folder. You create a folder within your ZIP archive that is called system, within that folder you create another called apps, and then you place the app in that folder. When CWM looks at the script in the archive it will tell CWM to mount the factoryfs.img partition and allow you to write to it. It then copies all the files from that given location to the same location on the device. In theory you could write a script that would pull the app from whatever folder in the archive and move it to another folder on the device but that just gets WAY too complicated. When flashing to factoryfs.img or data.img you generally are good to just flash, however there are times where you may want to flash a full ROM. In those cases it is better to wipe the partition (using CWM) before flashing so that there isn't any carryover or overlap between the two ROMs.
If you go into a modem or kernel ZIP archive you'll see that we just took the corresponding partition file and placed it directly in the ZIP. The script in this case acts much the same way as Odin and just replaces the full partition with the new image. Generally you only see four partitions mounted through CWM, modem.bin, zImage, factoryfs.img and data.img. You could mount the others but there isn't often a need to.
Now that there my friends gives you a basic understanding of how these work. Now if you still feel comfortable proceeding please go to www.rwilco12.com for the rest of the tutorial.
The standard disclaimer applies here. This tutorial is just the beginning. It does not make you into a Elite Developer, it does not give you everything you need to conquer the world or even make your own ROM. What it does do is give you some of the tools to get you headed in that direction.
So what does this do for you? Well if you have the information from this thread and a few other places you could in fact build a full ROM that is flashable through Odin rather than through a custom recovery. No more need to root your phone beforehand, you could just plug it in to your computer and flash a custom ROM. I myself am not going to show you how to do a custom ROM but I promise you that the tools and resources are out there. That's how I learned this!
Before we dig in I have to make one thing clear – This tutorial does not show you how to make an Odin One-Click.exe. I will most likely never post instructions on how to do so. Most people don’t realize this but whenever you flash an Odin One-Click.exe you are taking a substantial risk and have the very real and distinct possibility that it will in fact completely brick your phone. Now, if it is done correctly there is absolutely no chance of it bricking your phone but the process of creating the One-Click.exe is very detailed and complex, one wrong variable or incorrect field and the whole thing is ruined. Now that I’ve scared you, you can rest assured that every One-Click on my site has been very thoroughly tested and are safe. Those who work on those One-Clicks (myself included) are exceptionally detail oriented and test all of their work before posting them. A huge thanks goes to Garwynn, Mohogalore and Sfhub for taking the One-Click process and making it as safe as it is for all of us!
I will also not be showing you how to make your own ROM. Yes, you could use this as a step in creating your own ROM but it involves more Linux than I know how to teach. The good news is that someone else far more talented than I has already put together the tools how to do it. For instructions on how to build your own factoryfs.img (this is where 99% of the ROM is stored in a TAR.MD5) please visit Chris41g's thread at http://xdaforums.com/showthread.php?t=1750295.
Now for the fun stuff!
If you feel you already have a working knowledge of what a TAR.MD5 is and how it works you can skip all the rest of this and go directly to www.rwilco12.com for the rest of the tutorial on how to create your own TAR.MD5.
In order to create a flashable TAR you should first understand the way they work. I’ll give you a semi-brief rundown.
Each Samsung device is setup with several partitions. These partitions all control different aspects of each device. AdamOutler put together a good list of all of them when the Epic 4G Touch first came out. I’ve used his list (http://xdaforums.com/showpost.php?p=17949633&postcount=8) as a base for my explanations.
For the Epic 4G Touch (SPH-D710) the partitions are as follows:
boot.bin – The first piece of the Bootloader. It initiates the activation of your device's memory and starts the SBL.bin.
SBL.bin – The second piece of the Bootloader. This is essentially its own operating system and can control the building and changing of all other partitions. When you flash something through Odin this is what Odin is communicating with.
param.lfs – This is the third and final piece of the Bootloader. This houses Download Mode, startup images and is where SBL.bin stores all of its information.
zImage – The kernel.
recovery.bin – Generally this is where the recovery is stored. However, in the E4GT the recovery is included in the kernel. For all intents and purposes this partition is just wasted space.
cache.img – Your cache partition. Apps and the system store data here to speed up loading times and responsiveness.
modem.bin – The modem. Interestingly enough AdamOutler explains that the modem.bin is essentially a mini operating system all by itself and this is the reason we can talk, surf and play with apps all at the same time.
factoryfs.img – This contains all of the system folders from your device.
data.img – This is where all your app data as well as some other information is stored.
hidden.img – This is your preload folder.
So now we know what’s in the partitions themselves. Now what does this have to do with creating a TAR.MD5? Well each time you flash a TAR.MD5 it contains a given set of files. If you look at one of my Modem TAR.MD5’s you’ll see they contain only a modem.bin file. If you look at the kernel TAR.MD5’s you’ll just see a zImage. If you look at a full ROM (leaked or otherwise) you’ll generally see a full set of files with the same names as the partition files in the TAR.MD5. The reason for this is that each of those files in the TAR.MD5 is in fact a partition image. When you flash the TAR.MD5 it completely overwrites the existing partition and replaces it with the new one.SBL.bin – The second piece of the Bootloader. This is essentially its own operating system and can control the building and changing of all other partitions. When you flash something through Odin this is what Odin is communicating with.
param.lfs – This is the third and final piece of the Bootloader. This houses Download Mode, startup images and is where SBL.bin stores all of its information.
zImage – The kernel.
recovery.bin – Generally this is where the recovery is stored. However, in the E4GT the recovery is included in the kernel. For all intents and purposes this partition is just wasted space.
cache.img – Your cache partition. Apps and the system store data here to speed up loading times and responsiveness.
modem.bin – The modem. Interestingly enough AdamOutler explains that the modem.bin is essentially a mini operating system all by itself and this is the reason we can talk, surf and play with apps all at the same time.
factoryfs.img – This contains all of the system folders from your device.
data.img – This is where all your app data as well as some other information is stored.
hidden.img – This is your preload folder.
Now the other question I get is, “How is this different from flashing a ROM in a ZIP format?” The biggest difference is in how they flash. A TAR does one thing and the ZIP does another.
Essentially the TAR.MD5 is what is known as a TAR Ball. A TAR Ball is a compilation of multiple files into an ordered archive. You may not see the order when you open the archive as an archive but the way it is digitally signed determines the order the files are stored and accessed within the TAR (this is important when using Odin to flash). As we previously covered each of those files corresponds to a specific partition on the device. What you don't see is that the way that Odin works is it takes that partition image and completely replaces everything currently on the partition with the new partition image. That there is the major reason why a full TAR build will always wipe all data. The way around this is to remove the data.img and cache.img files. However, removing them from the TAR ball ruins the digital signature and corrupts it. So you can't just manually remove them from the TAR ball but you can pull out the files you need and rebuild a new one.
Now a ZIP ROM. Essentially the ZIP is a standard ZIP archive. The only difference is that CWM (or its variants) has a specific area that they look for a script. These are a bit trickier to understand. That script controls the flashing process. Generally you would write it in the script that a batch of files (based on file structure) goes to the same folder on a specific partition. For example, you have an app you want to flash to the system/apps folder. You create a folder within your ZIP archive that is called system, within that folder you create another called apps, and then you place the app in that folder. When CWM looks at the script in the archive it will tell CWM to mount the factoryfs.img partition and allow you to write to it. It then copies all the files from that given location to the same location on the device. In theory you could write a script that would pull the app from whatever folder in the archive and move it to another folder on the device but that just gets WAY too complicated. When flashing to factoryfs.img or data.img you generally are good to just flash, however there are times where you may want to flash a full ROM. In those cases it is better to wipe the partition (using CWM) before flashing so that there isn't any carryover or overlap between the two ROMs.
If you go into a modem or kernel ZIP archive you'll see that we just took the corresponding partition file and placed it directly in the ZIP. The script in this case acts much the same way as Odin and just replaces the full partition with the new image. Generally you only see four partitions mounted through CWM, modem.bin, zImage, factoryfs.img and data.img. You could mount the others but there isn't often a need to.
Now that there my friends gives you a basic understanding of how these work. Now if you still feel comfortable proceeding please go to www.rwilco12.com for the rest of the tutorial.
Last edited: