[HOW-TO / VIDEO / WIN-LIN-OSX] Extract System/Data files directly from a FTF - Sony Cross-Device General

Good morning family!
It's my very first time posting in this subforum, but I think this tutorial was actually something needed, since all threads everyone can found while Googling are quite old (like, from the Xperia S times ), and also I'm quite tired of infinite threads like this and this, so...
Today I bring you an extensive and unified guide on how to extract ANY SYSTEM FILE from a FlashTool's Firmware (FTF), whether it's from the userdata.sin or from the system.sin.
Since this is going to be a guide for all OSes, there are some programs you'll need in general,
Latest version available of FlashTools (for SIN dumping purposes).
A reader tool for the extracted image, which can be:
An EXT4 reader / mounter.
An Unyaffs2, if you're using this guide for an old device (like the already mentioned Xperia S, and older).
Some cups of coffee, and lots of patience [IMPORTANT].
But, some of them will be platform specific, so the thread will split in:
2nd post: WINDOWS
3rd post: LINUX
4th post: OSX
Here you've a video tutorial showing the whole process for the 3 OSes:
If you're enjoying it, don't forget to press Thanks button and rate this thread!​

WINDOWS GUIDE
Step 1 - Extract the SIN we need
Using your favourite archive manager (WinRAR, 7-Zip, etc), open the FTF you want to extract the files from. (FYI: an FTF is just a Zip file with renamed extension)
Now copy/extract the SIN you want to unpack to a folder of your preference.
Step 2 - Dump the SIN
I'll take into account you already had installed Flashtools and Java JRE, in which case I highly encourage you to update both to the latest version available.
Now, open Flashtools. Click on Tools, Sin Editor. Hit the [...] and locate the SIN you previously extracted. Now, hit the [Extract Data] button. After a couple of minutes the bar should start running.
Once finished, you can have 2 kind of files: a .yaffs2 or a .ext4/.ext3/.ext2 file, which require different procedures on how to see it's contents.
Step 3.a - Convert the file to a readable format - UnYaffs2
If the file you get is a .yaffs2 format file, you're going to need to extract it. For doing so, you need this tool, which contains a executable and a cygwin dll.
Extract this .rar contents to the very same folder where you placed the SIN, and thus, where the .yaffs2 is located.
Now, while you're in that folder press the shift key in your keyboard, and while you keep pressing it, right click on a blank space in that folder. In the menu choose Open a Command Prompt here.
To end the proccess, type
Code:
unyaffs2.exe [COLOR="DarkOrchid"]<the-name-of-the-yaffs2>[/COLOR]
Where <the-name-of-the-yaffs2> you must type the file name of the yaffs2 (e.g. system.yaffs2)
The files will get extracted and you'll be able to pick the ones you need.
Step 3.b - Mount the image - Linux Reader
There're many many tools to mount a EXT format image in Windows, but in this case, I'll use the Diskinternals Linux Reader, since it's free and it's compatible with all 3 possible formats you can encounter: .ext4/.ext3/.ext2.
Download it from here and install it. (It must be this version, since newer ones are broken.)
Once done, you should be perfectly able to double-click-to-mount the EXT file Flashtools generated without any trouble.

LINUX GUIDE
Step 1 - Extract the SIN we need
Using your favourite archive manager (Ark, Peazip, etc), open the FTF you want to extract the files from. (FYI: an FTF is just a Zip file with renamed extension)
Now copy/extract the SIN you want to unpack to a folder of your preference.
Step 2 - Dump the SIN
I'll take into account you already had installed Flashtools and Java JRE, in which case I highly encourage you to update both to the latest version available.
Now, open Flashtools. Click on Tools, Sin Editor. Hit the [...] and locate the SIN you previously extracted. Now, hit the [Extract Data] button. After a couple of minutes the bar should start running.
Once finished, you can have 2 kind of files: a .yaffs2 or a .ext4/.ext3/.ext2 file, which require different procedures on how to see it's contents.
Step 3.a - Convert the file to a readable format - UnYaffs2
If the file you get is a .yaffs2 format file, you're going to need an extra tool to extract it. For doing so, you are going to need the unyaffs2 tool.
You can download a pre-compiled binary from here, or you can compile your own using GCC with the source code, the header and the code below inside a Terminal (Ctrl+Alt+T to open it).
Code:
gcc -o unyaffs unyaffs.c
Once you've a working UnYaffs2 binary, just copy it to the very same folder where you placed the SIN, and thus, where the .yaffs2 is located, and type in a Terminal (Ctrl+Alt+T to open it).
Code:
cd [COLOR="DarkOrchid"]<file-route-of-the-sin>[/COLOR]
./unyaffs2 [COLOR="Blue"]<the-name-of-the-yaffs2>[/COLOR]
Where <file-route-of-the-sin> is where the SIN was located, and where <the-name-of-the-yaffs2> you must type the file name of the yaffs2 (e.g. system.yaffs2)
The files will get extracted and you'll be able to pick the ones you need.
Step 3.b - Mount the image
Since we're already in Linux, mounting a EXT image is not that hard. Just mount it using this commands in a Terminal (Ctrl+Alt+T to open it).
Code:
cd [COLOR="DarkOrchid"]<file-route-of-the-sin>[/COLOR]
mkdir android
sudo mount -t ext[color="RED"]*[/color] -o loop <name-of-the-image> android/
Where <file-route-of-the-sin> is where the SIN was located, where <the-name-of-the-image> you must type the file name of the ext image (e.g. system.ext4), and finally, where ext*, replace * with the version number of the EXT image you're mounting, usually, ext4
Now, once finished, to unmount it, type in a Terminal.
Code:
sudo umount android
rm -fr android

OSX GUIDE
Step 1 - Extract the SIN we need
Using your favourite archive manager (UnRarX, ZipEg, etc), open the FTF you want to extract the files from. (FYI: an FTF is just a Zip file with renamed extension)
Now copy/extract the SIN you want to unpack to a folder of your preference.
Step 2 - Dump the SIN
I'll take into account you already had installed Flashtools and Java JRE, in which case I highly encourage you to update both to the latest version available.
Now, open Flashtools. Click on Tools, Sin Editor. Hit the [...] and locate the SIN you previously extracted. Now, hit the [Extract Data] button. After a couple of minutes the bar should start running.
Once finished, you can have 2 kind of files: a .yaffs2 or a .ext4/.ext3/.ext2 file, which require different procedures on how to see it's contents.
Step 3.a - Convert the file to a readable format - UnYaffs2
If the file you get is a .yaffs2 format file, you're going to need an extra tool to extract it. For doing so, you are going to need the unyaffs2 tool.
You can download a pre-compiled binary from here, or you can install your own using Brew. From a Terminal (Command+Space, then type in Terminal) type the following commands.
Code:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null #This is just to Install Brew for the first time. If you already have it, it's not needed.
brew install unyaffs
If you chose using the UnYaffs2 binary, copy it to the very same folder where you placed the SIN, and thus, where the .yaffs2 is located.
If you chose the Brew installation, just continue.
Now, type in a Terminal (Command+Space, then type in Terminal).
Code:
cd [COLOR="DarkOrchid"]<file-route-of-the-sin>[/COLOR]
unyaffs2 [COLOR="Blue"]<the-name-of-the-yaffs2>[/COLOR]
Where <file-route-of-the-sin> is where the SIN was located, and thus, where the yaffs2 file is located; and where <the-name-of-the-yaffs2> you must type the file name of the yaffs2 (e.g. system.yaffs2)
The files will get extracted and you'll be able to pick the ones you need.
Step 3.b - Mount the image - Ext4FUSE
There're many many tools to mount a EXT format image in OSX, but in this case, since we don't need RW access, but just RO, I'll use ext4fuse, since it's free and it's more than compatible with our needs.
To install it you'll need Brew. To get things ready, type the following commands in a Terminal (Command+Space, then type in Terminal).
Code:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null #This is just to Install Brew for the first time. If you already have it, it's not needed.
brew tap homebrew/fuse
brew install Caskroom/cask/osxfuse
brew install ext4fuse
If you're on OSX Yosemite, El Capitan, or Leopard, you may need an extra command to add yourself to the Operator group, so that you can have readonly permissions to the disks.
Use it only if you get an error while trying to access the mounted EXT image later.
Code:
sudo dscl . append /Groups/operator GroupMembership [COLOR="red"]<your-user>[/COLOR]
Where your user <your-user> is your username.
Now, to mount the ext4 image, type in a Terminal (Command+Space, then type in Terminal).
Code:
mkdir android
ext4fuse [COLOR="DarkOrchid"]<path-to-the-ext4-image>[/COLOR] android
Where <path-to-the-ext4-image> you must type in the full path where the SIN was located, and thus, where the EXT4 image is located.
Use this as reference.

Reserved
In case I need it

Great job! Keep up the good work!!

Well. great guide.
Just a note, Microsoft officially released Bash on Ubuntu on Windows yesterday. Try it. It's a full fledged Linux subsystem but unfortunately only available to Windows Insiders. It would be the best alternate to cygwin.

Boot.img
How can i extract the boot.img
or is this applicable to every single .sin file present in the .ftf file

serajr said:
Great job! Keep up the good work!!
Click to expand...
Click to collapse
Thank you, I appreciate your words
mfbcool said:
Well. great guide.
Just a note, Microsoft officially released Bash on Ubuntu on Windows yesterday. Try it. It's a full fledged Linux subsystem but unfortunately only available to Windows Insiders. It would be the best alternate to cygwin.
Click to expand...
Click to collapse
I know, I saw the demonstration in the //build/, but since it hasn't been released for all yet (I guess it'll be for Redstone 2?), I didn't saw it necessary to be included.
sandeep.sethi said:
How can i extract the boot.img
or is this applicable to every single .sin file present in the .ftf file
Click to expand...
Click to collapse
No, this is only applicable for system.sin, userdata.sin, cache.sin and probably modem.sin.
However, if many of you request it, I could try making another for the kernel (boot.img)... But remember, every device doesn't have the same way/method to unpack the kernel, so making a generic tutorial for all wouldn't be possible

No, this is only applicable for system.sin, userdata.sin, cache.sin and probably modem.sin.
However, if many of you request it, I could try making another for the kernel (boot.img)... But remember, every device doesn't have the same way/method to unpack the kernel, so making a generic tutorial for all wouldn't be possible
Click to expand...
Click to collapse
if u can provide the guide it would be very helpful :fingers-crossed: :fingers-crossed:

This thread got featured in XDA Portal, thank you guys!

I tried extracting Xperia Pro's system SIN (can't remember the exact name but the one with the largest file size) using the latest version of Flashtool but wasn't successful. Like it's not supported yet.

Related

Error after sign Zip Files. "Can't find update script"

I followed each one of your steps. I get an error when trying to install the signed zip. "Can't find update script" Can anyone please help me with this.
thank you
I'm doing option 2. I get it signed just get an error "Can't find update script"
This quick guide will teach you how to sign ROMs!
WARNING : YOU WILL NEED AT LEAST A BASE KNOWLEDGE OF HOW TO USE COMMAND PROMPT.
The knowledge of signing ROMs can prove useful to anyone! By knowing how to sign ROMs, you can modify your favorite ROM to add or delete APKs, so when you flash the ROM your favorite apps will be present! Or you can delete apps you don't use so they will not be installed when flashing the ROM!
Before starting, you need a couple of things. First you will need Java SE Development Kit and Java SE Runtime Environment . You can download them HERE.
After you have downloaded and installed both, you will need a very useful tool made by someone at XDA-Developers (if you know who it is please let me know).
Download this tool (attached) and unzip everything inside of it into one common folder. I personally unzipped everything into my Android SDK folder.
Signing
Now run the autosign.bat. You will have to go through commands 1(Set PATH variable for SDK) ,2 (Set CLASSPATH variable for signing tool) and 3 (Install registry entries). They are very easy to use and just follow the instructions. If you are asked to confirm and/or replace a file, always select yes!
Now you are finally ready to sign! There are two options to sign the .zip
1)Find the ROM (.zip) and right click and select "Resign Zip". If you use this option a command prompt box should quickly appear and disappear.
OR
2) Using the Autosign.bat, select option 4, and then write the directory and file name of the ROM. For example,
D:\Android\ROMs\YourROMHere.zip
It will hang for a bit at the part where it says "signing", and then it should say something along the lines of "Successfully completed if no errors above"
If this helped you, comment below!
http://androidforums.com/developer-101/8665-how-signing-roms.html
Anyone...... I know someone knows
You have to zip the contents of the rom, not the rom itself. i.e. if you sign the rom folder, it will be ROM_Signed.zip->ROM->system/data/metainf... you get the picture. Go into the folder you want to zip and then sign, select the contents, and zip them. It will then be ROM_Signed.zip->/system/data/metainf. Then just sign it.
update-script is a script that tells the flash utility what to do. It is located in the zip as part of the following directory structure:
META-INF/com/google/android
The contents can vary. For Darktremor A2SD 2.6.1, here's the contents:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
PACKAGE is used by android to reference the actual zip file, or package file.
SYSTEM is used to represent /system
DATA is used to represent /data
CACHE is used to represent /cache
BOOT is used to represent the boot partition (which is where you flash boot.img)
RECOVERY is used to represent the recovery partition. Never actually seen this used. I guess it used for an update.zip that you would flash via fastboot.
The zip file has to be structured in the same way as the file system on your phone. If you want to install something to, say, /system/bin, you must have a system folder, which in turn has a bin folder.
What I would do is take one of the available ROMs and unzip it. Then look for their update-script. Usually ROM packages are more detailed in the update-script.
If you don't have update-script in your zip file, the flash utility in recovery won't know what to do.
networx2002 said:
I followed each one of your steps. I get an error when trying to install the signed zip. "Can't find update script" Can anyone please help me with this.
thank you
I'm doing option 2. I get it signed just get an error "Can't find update script"
This quick guide will teach you how to sign ROMs!
WARNING : YOU WILL NEED AT LEAST A BASE KNOWLEDGE OF HOW TO USE COMMAND PROMPT.
The knowledge of signing ROMs can prove useful to anyone! By knowing how to sign ROMs, you can modify your favorite ROM to add or delete APKs, so when you flash the ROM your favorite apps will be present! Or you can delete apps you don't use so they will not be installed when flashing the ROM!
Before starting, you need a couple of things. First you will need Java SE Development Kit and Java SE Runtime Environment . You can download them HERE.
After you have downloaded and installed both, you will need a very useful tool made by someone at XDA-Developers (if you know who it is please let me know).
Download this tool (attached) and unzip everything inside of it into one common folder. I personally unzipped everything into my Android SDK folder.
Signing
Now run the autosign.bat. You will have to go through commands 1(Set PATH variable for SDK) ,2 (Set CLASSPATH variable for signing tool) and 3 (Install registry entries). They are very easy to use and just follow the instructions. If you are asked to confirm and/or replace a file, always select yes!
Now you are finally ready to sign! There are two options to sign the .zip
1)Find the ROM (.zip) and right click and select "Resign Zip". If you use this option a command prompt box should quickly appear and disappear.
OR
2) Using the Autosign.bat, select option 4, and then write the directory and file name of the ROM. For example,
D:\Android\ROMs\YourROMHere.zip
It will hang for a bit at the part where it says "signing", and then it should say something along the lines of "Successfully completed if no errors above"
If this helped you, comment below!
http://androidforums.com/developer-101/8665-how-signing-roms.html
Click to expand...
Click to collapse
HeroMeng said:
You have to zip the contents of the rom, not the rom itself. i.e. if you sign the rom folder, it will be ROM_Signed.zip->ROM->system/data/metainf... you get the picture. Go into the folder you want to zip and then sign, select the contents, and zip them. It will then be ROM_Signed.zip->/system/data/metainf. Then just sign it.
Click to expand...
Click to collapse
It took my brain a min, but i got it.
Thanks

[UPDATE 22/08/12] ROM Cooking Guide (One Package)

This is how I made ROM, I'll try to write the steps as simple as I can. For advanced users only!
Update 22/08/11:
Revised packaging steps.
Update 13/08/11:
Removed unwanted method for ROM cooking.
Update 04/08/11:
Modified extract and repack ROM guide and added extracting system.rfs guide.
Things you need:
Base firmware
Archiver software (7zip recommended)
Any Linux environment to build ROM or Cygwin
APK Manager to optimize and decompile *.apk files
MagicISO (Optional) if you want to extract system.rfs
And the last thing is... You need enough experience in android world
So, here is the steps to cook a ROM:
Flash your phone with your desired base firmware
Make required modifications
Pull system.rfs from your phone by running this command on adb shell or Terminal Emulator:
Code:
dd if=/dev/stl12 of=/sdcard/system.rfs
Extract any *.tar.md5 files from your base firmware to your working folder with 7zip
Replace the current system.rfs with your modified one
EDIT: Pack your ROM by running this code via terminal or just pack it with 7zip/WinRAR as *.tar
Code:
tar -H ustar -c * >> ROMNAME.tar
change ROMNAME to your desired, well, ROM name.
Here is (yet) useful guide to modify your ROM.
Extract system files on system.rfs to make modding easier:
Extract PDA file (*.tar.md5) files with 7zip
Open system.rfs with MagicISO
To extract it, just drag and drop
NOTE: Never edit your ROM with MagicISO because the file permissions will be ignored, use MagicISO only for extracting files from system.rfs
Deodex, and Zipalign (optimize) your ROM apk files:
Ready to use deodex + root for KPN: http://forum.xda-developers.com/showthread.php?t=1196230
Ready to use deodex + root for KPH and other firmware: http://forum.xda-developers.com/showthread.php?t=1118048
Open APK Manager
To zipalign your apk files, in apk manager folder /place-apk-here-to-batch-optimize put your:
framework-res.apk, twframework-res.apk and all system apk
but not these:
AxT9IME, Calculator, Camera, Email, MMS, Phone, Screen Capture, Settings, Swype, Thinkdroid, Voice search
Choose Choose option 15
Then choose both (zp)
Let it run and done.
Now put back the apk files where they belong in the ROM.
How to put these apk files to my ROM? Copy these files to appropriate locations, such as /system/app to your ROM's /system/app, and etc.
Another handy modification guide:
Unpack and repack boot.img - http://forum.xda-developers.com/showthread.php?t=1173427
Convert firmware filesystem to ext4 - http://forum.xda-developers.com/showthread.php?t=1202049
Overscroll glow for any firmware - http://forum.xda-developers.com/showthread.php?t=1215933"
Give thanks to all dev who made that possible!
If you have more guides to put here, please PM me.
Am I pertamax?
hehe..just kidding.
Nice Info....great share.
I would want the Fla.sh Rom :'(
Thats a gr8 share...Thank you...)
saiftheboss7 said:
I would want the Fla.sh Rom :'(
Click to expand...
Click to collapse
sorry... once again, I'm sorry, I can't continue my ROM
Helpful thread man!
Thanks!
Great job taking your time to make this! Unfortunately, i dont even know the basics but now I know where to check when I do
fla.sh said:
sorry... once again, I'm sorry, I can't continue my ROM
Click to expand...
Click to collapse
Hey!
THX man, nice thread. Very useful!
Just PM to MOD, that they close you previous thread, a bout fla.sh.ROM. Or ppl just waiting it and asking.
CHEERS!
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
an0nym0us_ said:
i think the most troublesome problem i encounter is to repack system.rfs. yes it can be mounted in magiciso, but howto repack/compile it back?
Click to expand...
Click to collapse
Just save it.
didnt work when i just save it. my device got bootloop
an0nym0us_ said:
didnt work when i just save it. my device got bootloop
Click to expand...
Click to collapse
What modification you've added to your ROM? Maybe that modification causing the problem...
fla.sh said:
What modification you've added to your ROM? Maybe that modification causing the problem...
Click to expand...
Click to collapse
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
ketut.kumajaya said:
As Linux, MagicISO read RFS image as a FAT filesystem. File permissions can not be maintained. A better way but need linux:
1. Mount system.rfs as FAT and mount it to /tmp/rfs
2. Make ext4 image, and mount it to /tmp/system
3. Copy /tmp/rfs contents to /tmp/system
4. Make modification inside /tmp/system
5. Fix file permissions inside /tmp/system
6. Umount both image
7. Make ODIN flashable image, contains system.rfs (now in ext4 format) and CF-Root-S5830 boot and recovery image (for ext4 support)
8. Boot to Windows and flash your new firmware using ODIN.
Click to expand...
Click to collapse
I use this command to mount rfs:
Code:
mount -o loop system.rfs /some_dir
Can you share us the command?
now thats really informative. thanks
ROM unpacking and repacking gude has been corrected. Tested by me. If you have any problems, just ask here.
Thanks.
I think you should add the date of update in the title, so that everyone can know about the update...
BTW thanks for this amazing guide...
Love it!!!
After making changes to system.rfs, how to save it as .rfs again?
adiles said:
After making changes to system.rfs, how to save it as .rfs again?
Click to expand...
Click to collapse
Please take look at the first page, it's updated, you know?
After I created md5 file and selected it in odin, it says "invalid image type" and "invalid model binary". How to solve that? After that I continued, skipped these errors and flashed, my phone stopped at boot screen with text "Galaxy ACE....". Plz help me

How to create flashable zip from scratch?

Hi everyone,
I was wondering if someone could point me in the right direction to create a flashable ROM from *SCRATCH*. I have googled everything I can think of and everyone seems to have the same answer -- take someone else's zip file and just replace the files with your own, then tweak the updater-script if necessary.
This seems kind of bogus to me, but perhaps I don't quite understand edify scripting. Certainly doing this with amend scripting would work, but that was deprecated a long time ago so I would like to use edify. I think the root of the problem is that I don't understand what the update-binary file is all about.
Can someone please explain how to create a zip without just using someone else's and tweaking it? I recently updated my framework-res.apk file and put new battery icons and new charging animation in it. Then I pushed it back over to my phone with adb and it works great. I would really like to know how to create a flashable zip from this. Sure, I could just download someone else's zip file and then swap out their framework-res.apk file with mine but that doesn't teach me the real, underlying process.
I am a developer for my day job so I'm not new to this type of stuff, but I am new to Android development. I can create the directory structure necessary and place my signed apk file where it needs to go. Furthermore I can write the updater-script file myself (in edify syntax). But then I need to somehow generate the update-binary file before creating the final, flashable zip and signing it.
So how exactly do I create the update-binary file? Do I need to run my updater-script file through a compiler or something? Or maybe the update-binary file is universal for every flashable zip (though if this were the case, then why have the file in every zip -- just put it on every phone and then you don't need to bloat every flashable zip file with it).
Can someone please explain? Also, if you can do it without mentioning or requiring any Windows specific tools that would be great. I run Ubuntu so most of the Windows tools are useless to me (yes I know I could run a virtual machine, or use Wine, etc.). I prefer to do everything with Linux or some platform-independent way.
Thanks!
I use linux too (gentoo) and I make mine pretty much from scratch. Just create a working directory somewhere (I use /usr/src/[my_package_name]/) then create a directory layout just like you'd want to see on the android device. For your example make a directory called "system" and then "system/framework" then copy your framework-res.apk to system/framework/. Now make a META_INF directory, and add "com" then "google" then "android" (so you have [my_package_dir]/META_INF/com/google/android/ ). Now copy the updater_binary (this is basically the command interpreter for edify scripts--amend commands are built-in to the recovery system). Now make your script. FOr your example above, your realy only need a few commands: mount the system dir, then copy the package file(s) over:
Code:
mount("ext3", "EMMC", "/dev/block/mmcblk0p25", "/system");
package_extract_dir("system", "/system");
You'll need to know the details for the specific device to know what arguments to use for the mount command. The above is for an Inspire or DesireHD.
Now just zip it all up (from your base package's directory):
Code:
zip -r -o my_package_file.zip META_INF/ system/
the "-r" means "recursive" and "-o" tells it what output file to use. The remaining arguments are the files (or directories in this case) to zip up.
That's great information...actually more detailed than what I needed but it's always better to have too much than too little. You answered my main question though which is what is the point of the update-binary file. If it's an interpreter for edify scripts then that makes total sense that it would be included in every zip (and furthermore be the same in every zip). I still think it's a bit of a waste though (just build that interpreter into the Android kernel itself so that people don't have to copy it around everywhere), but I'm not the one in charge of this stuff.
I guess I'm off to create a zip of my battery icons then. I'm on an Evo by the way, and if I remember correctly /system is mounted on /dev/block/mtdblock3. No big deal though, I can always cat /proc/mounts in a shell to find out.
Thank you very much!
P.S. You can save a few keystrokes on the zip command by dropping the -o and even dropping the .zip extension. Just try:
Code:
zip -r my_package_file *

[Guide] Unpack Update.app in phone

So there's threads about how to unpack UPDATE.APP on windows/PC/OS X so i decided why not do it on android too, this apps requires some additional tools to be downloaded just as OS X/Windows and linux needs as well. but process is otherwise similar. this tutorial doesn't need root!
NOTE THIS TUTORIAL isn't fully working on OREO on Huawei devices, it has some issues and i haven't found a workaround for it yet!​
Needed apps
Termux https://play.google.com/store/apps/details?id=com.termux
Recommended apps
Hacker keyboard
Needed files
https://github.com/atarii/split_updata.pl/blob/master/splitupdate
@Atarii 's modification of splitupdate to manually enter the partitions you want to unpack
The desired FW you wan't to unpack
Unpack process:
Download Termux
Open termux and type
termux-setup-storage This will allow termux to access your /sdcard
pkg install perl (this will install perl which the update.app process is using) once asked press y and enter.
copy the downloaded files to root of your SDCARD *We keep this simple*
Once copied type: cd storage
perl splitupdate UPDATE.APP partitionyouwanttoextract if everything goes well you should be good to go and having the selected files in a folder called output where selected files should be stored.
The unpack tutorial is done. But wait! If you want to browse the files you need to do one more thing or two.
Download android image kitchen
https://play.google.com/store/apps/details?id=com.redlee90.imagekitchenforandroid
This will allow you to *unpack boot/recovery and convert system image (also vendor, product, cust and version)
*in order to unpack a boot or recovery file you'll need to remove all code using a hex edit file until you see ANDROID text. Else it won't unpack. You can unpack aosp images easily with this tool and modify what you want and repack to flash it on your device tested with twrp image for honor 8.
I would suggest to not unpack/repack boot using this tool since it'll cause problem.
There's a python script that works to unpack boot and recovery which can be found https://github.com/liudongmiao/bootimg/blob/master/bootimg.py
For this you'll need to install python.
pkg install python and hit y and enter
Now you just do as the splitupdate part where you extract the file.
Command to unpack
python bootimg.py --unpack-bootimg similar is for ramdisk but you replace bootimg with ramdisk.
To repack just simply python bootimg.py --repack-bootimg
Please note if you repack ramdisk the boot might not work (it's a while since I tested this) now this covers up how you unpack boot and extract update.app from phone.
Credits to @Atarii for telling how to unpack boot on phone and for his custom splipupdate script
Sent from my FRD-L09 using Tapatalk
Known Issues:
If you get Killed when trying to extract system.img this is most likely because the image size is too big, this isn't due to small space available i guess its due to all ram is being taken yet i can't tell.
i get permission issues. yeah this can happen sometimes try chmod +x or chmod 0777 with root, it might help.
when typing termux-setup-storage i get lots of errors and i'm on 8.0 EMUI
This is not your fault it's a bug caused by android i'd guess, or app isn't adopted completely for 8.0

[GUIDE]How to extract /system from Samsung S7 OTA/FW in Windows without a Phone

This is a complete working guide on how to extract the /system partition from a Samsung S7 FW/OTA package using Windows (This is the same package one might flash to their phone with ODIN.) You can get this FW/OTA package from sites like Samsung-Firmware.org & SamMobile.com. It is very likely this works (or parts of it duct-taped together ) on other Phone models,etc, but I vouch that this guide works on the Samsung S7. Please chime in if it works on other models & brands!
Intro:
I found a LOT of guides similar to this, but couldn't get any to work with the Samsung S7 packages! And there are MANY different versions of the tools I mention below, many not working! So be sure to use the tool versions I post below. Over much time, it was a tiny step with each new attempt until I finally got it...& wanted to share!
Purpose:
Why would anyone want to do this? If you're reading this thread and don't know the answer to that, then I'm confused But I'll answer anyway - What is the purpose of this thread?
You would want to do this because you're a ROM Developer and don't want to have to go through the time & trouble of installing an OTA, then do a dd/cat to get the system image, etc. (With this method you don't even need a phone, just a PC!)
You are using a custom ROM, but want a stock app; for example the custom ROM you're using has the Google Dialer/Phone app builtin, but you prefer the stock Samsung Phone. Doing the steps outlined here will yield a "system" folder in Windows that you can simply navigate to /system/app or /system/priv-app and copy over the apk to your phone and install it! (via ADB or phone File manager app, etc). Obviously not all apks will work. Or maybe you want the libraries from another phone OTA package in order for an apk to work, and so on...
You are just curious what's in the /system partition for an OTA package!
Tools:
7-Zip
LZ4
simg2img: "Clone or download"->Download ZIP
Ext2Explore (Same as Ext2Read)
Guide:
Download FW/OTA (TMB-G930TUVU4CRI2.zip) from SamMobile website (or whereever)
Use 7zip to extract TMB-G930TUVU4CRI2.zip to a folder
Use 7zip to extract AP_G930TUVU4CRI2*.tar.md5 to a folder (ignore "There is no correct record at end of archive" error)
Use lz4 to extract system.img.ext4.lz4 -> system.img.ext4
lz4 system.img.ext4.lz4​
Extract simg2img_win-master.zip -> \simg2img_win-master\
Copy system.img.ext4 to \simg2img_win-master\ folder
Rename system.img.ext4 -> system.img
Use simg2img_win-master to convert system.img -> system.ext4.img
Double-click convert.bat (or run in cmd prmpt) (This will take a few minutes)​
Create new folder to save contents in, eg: "C:\System"
Use ext2explore to mount system.ext4.img: Open ext2explore->File->Open Image->Select system.ext4.img
Click Save icon->Save to your new folder, eg: "C:\System"
Wait for it to extract. Once complete, enjoy!
Links & Useful Resources:
Tmobile Versions: https://support.t-mobile.com/docs/DOC-30276
Search Keywords:
(This section is here so this thread comes up in searches for the many errors I came across while trying to get this to work in both Windows & Linux. That's right! I tried in both OSs and actually got it to work first in Windows... & yet to get it to work in Linux!)
- losetup /dev/loop2 /media/sf_Share/system.img.ext4 ->warning file does not fit into 512-byte sector; the end of the file will be ignored
- mount /dev/loop2 /mnt/mysystem2 -> mount: /mnt/mysystem2: cant read superblock on /dev/loop2
- mount -t ext4 /media/system.img /mnt/mysystem6 -> wrong fs type, bad option, bad superblock on /dev/loop6, missing codepage or helper program, or other error
fsck /media/system.img -> ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open ...
The superblock could not be read or does not describe a valid ext2/ext3/ext4 filesystem. If the device is valid and it really contains an ext2/ext3/ext4 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate suberblock: ...
Reserved
Just happened to see this thread.
Dropping in the let you know for linux just do this
Code:
simg2img system.img.ext4 system.img
mkdir system
sudo mount -t ext4 system.img system/
Of course all work is done in the current working directory.
You can just copy whatever you want from this mounted loop device of the system.img or whatever.
This is what i do because it seems to be the fastest in terms of work.
Hope it helps. I prefer all android work on linux
kevin71246 said:
Reserved
Click to expand...
Click to collapse
oh man you saved my day thanks man none of the old method worked but this did wonders

Categories

Resources