expand a nandroid img file - Epic 4G Android Development

for those who do not know how to do this yet, follow directions given here.
Just took this info from the web. None of this except for the guide is written by me.
I am not responsible for anything please do not contact me if a green sludge starts attacking your neighborhood eating one person at a time.
************************************************************
************************************************************
************************************************************
http://code.google.com/p/unyaffs/downloads/list
made for linux, but if you know a bit of c, you can probably change it to work with windows, maybe I will do that if I have some time this week.
********OR********
http://jiggawatt.org/badc0de/android/unyaffs-x86-win.zip
or http://www.4shared.com/get/fgryPnPx/unyaffs-windows.html
for windows..... instructions below apply for both
if not included in the zips above, cygwin1.dll and unyaffs.exe are included as an attachment of this reply.
open up a command line, in windows vista/7 just press start and then type cmd press enter and change the directory to the folder with the unyaffs and the img in it. in xp press start>run>cmd... then the same
the usage is: unyaffs /path/to/img
example:
(if unyaffs.exe and system.img are both in c:\temp)
"c:\temp> unyaffs /temp/system.img"
note: the '/' is the way linux determines the pathname of a file and since it is built using cygwin(a file allowing for windows) it is preferrable that the path to the actual file is in unix POSIX format ie: / instead of \ between folders and files.
*********WARNING************
this will extract to directory that unyaffs binary is in.

That's so weird -- I was gonna post the same thing tonight. Thx for writing this up. It's odd that more people don't talk or ask about this tool!

I remember reading this stuff back when I got my G1, and tonight I was trolling the themes and apps section cause I couldnt sleep. (which I rarely look at)
I was baffled that this wasnt common knowledge. I figured if there was no threads about it that people just knew how and didnt have any problems with it. My mistake lol...
enjoy.

can you please explain what is it? what it does? thanks

ericizzy1 said:
can you please explain what is it? what it does? thanks
Click to expand...
Click to collapse
Umm, it expands nandroid img files not sure how else to explain it. Clockworkmod backups are in the img file format. This process allows you to extract those files to get stuff out of them
Sent from my SPH-D700 using XDA App

When you create a backup in Clockwork recovery, it leaves you with a folder like this:
2010-11-18.08.52.49
As you can prob figure out, I made that backup on 11/18 at 8:52am
Inside that folder are .img files, such as: data.img and system.img
Those files basically contain your data (like apps you've installed from market) and system (..system apps that might've come with the phone).
In the orig post, he's explaining how to extract the files from these large .img files.
To give an example, I had a couple of corrupted clockwork backups, and wanted to ONLY pull out some database files (like text messages and call logs) which were not corrupted. Even tho the backup was messed up, I could still extract the files I needed by using the method above, then copied them manually to my phone.

decalex said:
When you create a backup in Clockwork recovery, it leaves you with a folder like this:
2010-11-18.08.52.49
As you can prob figure out, I made that backup on 11/18 at 8:52am
Inside that folder are .img files, such as: data.img and system.img
Those files basically contain your data (like apps you've installed from market) and system (..system apps that might've come with the phone).
In the orig post, he's explaining how to extract the files from these large .img files.
To give an example, I had a couple of corrupted clockwork backups, and wanted to ONLY pull out some database files (like text messages and call logs) which were not corrupted. Even tho the backup was messed up, I could still extract the files I needed by using the method above, then copied them manually to my phone.
Click to expand...
Click to collapse
thx
Sent from my SPH-D700 using XDA App

smeyerhuky said:
Umm, it expands nandroid img files not sure how else to explain it. Clockworkmod backups are in the img file format. This process allows you to extract those files to get stuff out of them
Sent from my SPH-D700 using XDA App
Click to expand...
Click to collapse
Right, like if you wanted a file or a few files from clockworkmod img backup, then this process would give you an extended file system, other than what you would normally use to extract the img files. Just trying to understand this so, please correct me if im wrong.... I've been trying to get more knowledge of this, so im still learning.
I prolly sound like a complete idiot, lol...

Sweet! Thanks for this man. I'd been looking for how to do this for some time and kept ending up learning about emulation or some other tangential topic. This is the basic functionality I was looking for. Thanks for posting!

Np. I'm working on writing some stuff on top of the source code that should allow you to browse and pull just one our more file
Its been a but since I looked theory source code so it might take a while... Maybe in between semesters?
Sent from my SPH-D700 using XDA App

Dode you saved my as** thx big thx

Great, now how can I re-compress back to .img after I've made the changes that I want?
EDIT: Nevermind. I just made a zip of the new system folder and flashed it in CWM.

This worked great for me.
Thanks,
Bud

Man, I do not know how to thank you. I was able to recover some important stuff off of my cwm recovery backup. THANKS!!

Related

Android app that roots your phone

Hi all I am putting together an android app that will making the rooting process much easier. This thread is discuss issues and suggestions with this app.
I have the app near done, the biggest problem is that I cannot format the sdcard as fat32. Is formatting to fat32 required. Why do we do this? What is the real need to do this?
I have not tested the app out yet, but so far this is how it has been put together. There is a main activity with textboxes that have the urls of the files needed to root (dreaimg.nbh, recovery.img, hardsplupdate.zip, JF_RC33update.zip) and there are buttons for each step in the process to download these necessary files and extract them if needed and put them on the sdcard and renaming them properly. You can change the urls to something else if needed.
so you click the first button it downloads the .nbh and puts it on the sdcard and then prompts the user to turn off, power+camera on, flash. when phone is on then reinstall this app and go to step 2 (because it would of been lost when flashed)
you click the second button it downloads recovery.img and hardsplupdate.zip. renames the files appropriately and puts them on the sd. it runs a script to do the recovery.img flash. It then prompts you to restart into recovery mode and gives the instructions on flashing the hardspl. and tells you to reopen this app when done
you click the third button it downloads the latest JF firmware (lets just say the RC33 flavor) puts it on the sdcard and renames it as update.zip. it prompts you to restart into recovery mode and do the flash.
Anybody see any possible problems with this logic? Also what do people think about maybe packing some of these files in the app instead of having them be downloaded?
Update: app is working http://allshadow.com/forum/viewtopic.php?f=9&t=5229
I am still looking for help to make it better.
I need devs to help make it nicer.
I am also looking for someone who's familiar with the update.zip package, to pack the radio, hardspl, and jf_rc33 all in one update file.
If anybody is interested in helping, PM me
I dont think its that big of a deal to format the card yourself, but why not make an app on the desktop that does some of the work for you, like formatting the card, then downloading and renaming the files needed to get started?
Packing the files into the app is going to make the app big. I like this whole idea though.
when you flash the .nbh it does a wipe on its own so one would need to re-download the app after that unless you can get it to stick somehow, i like the idea, is each button of the app just running a script? like to get the dreaimg.nbh have a script that runs:
"$wget [url to the .nbh file]
$echo 'please reboot your phone into SPL by holding the camera and power button'"
or did you have some other idea?
i like the idea but i am just not sure how easy this would be to code as i am just used to writing scripts that do everything for me.
or you could follow Kllian's advice and make a desktop program that does all this. i could easily write a script for linux that would do it, and a .bat file wouldn't be too hard either. you would just need to have adb and you could have the scipt/batch reboot the phone into recovery to do the flashing of each update.zip
pm me if you have an questions or would like me to write a script to do all this
tubaking182 said:
when you flash the .nbh it does a wipe on its own so one would need to re-download the app after that unless you can get it to stick somehow, i like the idea, is each button of the app just running a script?
Click to expand...
Click to collapse
tubaking brings up a good point.
I have an idea that possibly could resolve the "wiping" issue. What you do is, the initial app would be placed on the desktop (assume RC30). From here you'd downgrade the firmware to RC29.
The problem is though, the app you are scripting will be wiped. SO...
How about saving it on the SD temporarily.
THEN modifying the .nbh file to restore the <rooting app> to desktop (from SD)
Just throwing some stuff out there.
IF you need some help, hit me up.
if anyone knows how to convert a .sh bash script from linux to a .bat batch file for windows then i already have the script written, send me a PM to get it. or we could port it into java, but i don't know how to do that stuff. tomorrow i will upload my script onto 4shared and provide a link here as long as it works. keep in mind that i am on a linux machine and my script will not work in M$ windows. i don't know a damn thing about mac, so i have no idea if this will work or not for them.
my script is nearly completely automated, the only thing you need to do is hit ENTER a few dozen times, i will also write a completely automated one that sleeps rather than waits for you to hit enter, but it will take longer to run most likely since i will have to oversetimate the sleep time.
hopefully i can find a windows machine and learn what commands in the cmd are equal to the commands in my terminal
akapoor said:
tubaking brings up a good point.
I have an idea that possibly could resolve the "wiping" issue. What you do is, the initial app would be placed on the desktop (assume RC30). From here you'd downgrade the firmware to RC29.
The problem is though, the app you are scripting will be wiped. SO...
How about saving it on the SD temporarily.
THEN modifying the .nbh file to restore the <rooting app> to desktop (from SD)
Just throwing some stuff out there.
IF you need some help, hit me up.
Click to expand...
Click to collapse
modifying ,nbh files is no easy task, i tried it once and fortunately for many people GSLeon3 was able to help me fix my tilt. i think the .bat or .sh would be the easiest way to root your phone
Tubaking,
Send over the file you have. Ill work on converting it to a .bat, useable from windows.
Email : akapoor92_at_gmail.com
I should have it soon, but since its like 3:30am here, I'm off to bed. Haha
tubaking182 said:
modifying ,nbh files is no easy task, i tried it once and fortunately for many people GSLeon3 was able to help me fix my tilt. i think the .bat or .sh would be the easiest way to root your phone
Click to expand...
Click to collapse
Uh, you'd not only need to modify the nbh file, but you'd also need to sign it with the Google OTA keys - otherwise the phone will refuse to flash it.
If it were possible to create Google-signed nbh files we'd dispense with all this downgrading nonsense and just create an nbh of the latest JF firmware with root and directly flash that.
The issue is that until you've patched the recovery loader the phone won't flash anything that isn't signed by Google. The reason we can get around this is that there is a leaked signed file with the old firmware version, and that version happens to contain a vulnerability that you can use to get root access. Once you have root access you can reflash the recovery loader with a new one which accepts the test keys. At that point you can dispense with the hacks and begin directly flashing whatever you want.
In any case, rooting a phone is serious enough of a matter that we probably shouldn't be encouraging anybody who can download an app to do it. They should at least have some confidence in reading and following obscure instructions online, because of anything goes wrong later that is what they'll be doing...
Thanks for all your input. I have been trying to hold hand people through the root process and it is a real pain. Biggest issues are people not being able to unzip files correctly, rename files correctly, and the biggest thing is the recovery.img step and typing in the commands.
- .nbh cannot be patched because it is signed.
- yes my app will get wiped because of the .nbh flash. It does tell the user to reinstall this app once done with the .nbh step and then continue
- i prefer an android app, so people can do it without a computer and without having to install the sdk
- the app does not run a script to get the files. it uses some android sdk functions to download files. it does use the unzip linux command to unzip, not sure if this will work because of permissions, i may have to figure out how to do it from the sdk. the app does run a script to do the recovery.img step, during this step we should already have root so no issue there with permissions.
Biggest problem I see is Fat32 format I heard it is not absolutely necessary. Does anyone have any more information about why this needs to be done?
it IS necessary, you need the card formatted in order to do the NBH flash, after that you should be ok. most card come formatted in the box they came in so anyone that said they didn't need to format their card is lying because is was already formatted to fat 32
in the RC29 firmware is there a su command in /system/bin/ or are all commands run as root without having to call /system/bin/su ??
moussam said:
in the RC29 firmware is there a su command in /system/bin/ or are all commands run as root without having to call /system/bin/su ??
Click to expand...
Click to collapse
from what i've read, in the RC29 version andything you type on the home screen gets put through a root shell as well all on it's own
I have a feeling whoever makes this app is going to sell iot for a ridiculous price on the market
My script is written but requires the user to do certain things, later I hope to have it be completely automated after a certain point and it will be free. After I get it written in linux shell I will be converting it to use in windows. Expect my automated root to be available for download by the weekend.
I got the app pretty close to done. I hope to put something up tonight or tomorrow that you guys can test. I am not going to charge for this app, I want to give it for free so everybody can have root and a more rich experience.
The place were I am stuck right now is the unzipping of the DREAIMG.NBH file from its zip file after it is downloaded. I am using java.util.zip I am not sure if the problem is because the file is so big or if I am doing it wrong. does anyone have an android java unzip code snippet?
The app now downloads files for you and unzips them if needed. THere is an issue with the unzipping though, after around 25 MB of unzipping DREAIMG.NBH i get this error...
java.io.IOException at java.util.zip.InflaterInputStream.read(InflaterInputStream.java)
anybody have any suggestions? Is their not enough memory to unzip the files or something?
For now I am not going to let the .nbh file be zipped up. THe app instead will have to download the full uncompressed .nbh file.
So it is ready to be tested, if you want to try it out PM me, I do not want to just post it and have everybody use it until it has been tested more.
Good news the app works on downloading the .nbh file and then flashing you to RC29. It then successfully downloads the recovery.img and hardspl update.zip
I had someone testing it and when they ran the recovery script the mount command gave them mount: operation not permitted. Is this correct? I know without root it is supposed to give you mount: permission denied.
If this is correct the app is working, and I just need someone else to confirm.
Mike
Does anybody else want to help with the coding of this project? If so create an open-source repository and I will add the current source in there.

Batch Flasher (splash, radio, and boots into bootloader/recovery)

Hi guys, don't know if I'm posting in the right section or not, if not move it please, I'm still fairly new here.
Thought I would share a tool of mine that I created for my own use.
It'd a DOS batch file that I use to reboot my phone into bootloader, reboot it into recovery, or to create and flash various splash images.
As of 22/05/2011 code was added to flash RADIO.IMG files to your phone.
I did some work extending it so its a bit more user friendly, and contains various explanations, options etc.
Like i say, its just a tool I created for my own use, but I figure you might get some use out of it, or you can use it to build your own custom boot loady thing.
included in the zip is adb.exe, nbimg.exe, fastboot.exe and the adb dll files, so that everything you need is contained in the same folder. There is a read me file that also points out a few features.
Enjoy
Downloaded,thanks mate....
SENT FROM HONEYSENSE
Boskoel03 said:
Downloaded,thanks mate....
SENT FROM HONEYSENSE
Click to expand...
Click to collapse
Apologies, going over the code and realized I forgot to remove the lines linking to my default Android directory (which it doesn't need, since its all self-contained now).
Have re-uploaded the ZIP but if you edit the batch file just remove the lines "cd c:\android" and your good to go.

[GUIDE] How to extract Clockworkmod Images

As it seems to be a fairly common question, here is a guide on how to extract your clockworkmod recovery images.
This can come handy if you only want to extract certain apps, or files.
Put your Clockworkmod images in a folder on your computer.
Download this and put it in there, too.
Extract it in there.
Open a cmd-prompt in this folder.
Use this command to extract your data:
Code:
unyaffs.exe img_name_to_extract.img
Wait. the tool will display "end of image" when it is done.
Done. The data should be in the same directory as the tool is.
If you want to restore your contacts:
Extract the data.img
Your contacts will be in:
Code:
\data\com.android.providers.contacts\databases
I have not written the program used in this guide, just found it on my harddrive.
thanks much. so helpful
helped me to pull out contacts
I first had to download and install cgwin1.dll from here http://www.dll-files.com/dllindex/dll-files.shtml?cygwin1 and place it in the windows directory to get this to work. But after proceeding I get a "broken image file" when trying this on recovery.img and same thing with boot.img.
I am simply trying to recover some data from this nandroid backup specifically pictures in the sdcard/DCIM directory but I have no idea where it is. Is it located somewhere in the data.ext4.rar or system.ext4.rar files? If so I have looked through those and could not find a DCIM directory of any kind. Would anyone be kind enough to direct me?
Thanks
JDubbed said:
I first had to download and install cgwin1.dll from here http://www.dll-files.com/dllindex/dll-files.shtml?cygwin1 and place it in the windows directory to get this to work. But after proceeding I get a "broken image file" when trying this on recovery.img and same thing with boot.img.
I am simply trying to recover some data from this nandroid backup specifically pictures in the sdcard/DCIM directory but I have no idea where it is. Is it located somewhere in the data.ext4.rar or system.ext4.rar files? If so I have looked through those and could not find a DCIM directory of any kind. Would anyone be kind enough to direct me?
Thanks
Click to expand...
Click to collapse
You won't be able to do that. The recovery does not backup the sdcard.
Thank you very much ,it help me much
Cheers buddy! Needed this to extract my data backup

Create own Rom

It seems to create your own rom is more involved than I thought. I knew I should have learned linux. I wanted to fool around and use different browser .apk files from one rom to another. I messed around with this when I had my blackberry. It also seems like its easier to brick your droid. With blackberry I had a list of .cods same as .apks to use. So to open your .tar or .md5 you need android-sdk and then use adb commands? Is there a list of which system files that can be changed from one update to another. I did some searching but I guess not enough. Is there a quick version to create I guess a system dump with what files that can be changed without killing you phone? From what I read you have to use Odin to extract files to your sd card then to your computer or use Sdk with commands. Once extracted to to use a browser one to another you transfer the .apk other files. Do I have the basics or is it way over my head which is why we have developers?
blueis300 said:
It seems to create your own rom is more involved than I thought. I knew I should have learned linux. I wanted to fool around and use different browser .apk files from one rom to another. I messed around with this when I had my blackberry. It also seems like its easier to brick your droid. With blackberry I had a list of .cods same as .apks to use. So to open your .tar or .md5 you need android-sdk and then use adb commands? Is there a list of which system files that can be changed from one update to another. I did some searching but I guess not enough. Is there a quick version to create I guess a system dump with what files that can be changed without killing you phone? From what I read you have to use Odin to extract files to your sd card then to your computer or use Sdk with commands. Once extracted to to use a browser one to another you transfer the .apk other files. Do I have the basics or is it way over my head which is why we have developers?
Click to expand...
Click to collapse
Its way over your head! But even devs had to start somewhere. Guys like JT learned everything he knows thru google fu and he actually got the fascinate recognized cyanogen. So don't give up!
Sent from my Gummy Charged GBE 2.0 using XDA App
I would love to start to learn how to dev.
Any one could point me in the right direction?
Lol Yeah I figured it was above me but will keep reading, ask some questions and see what happens.
blueis300 said:
It seems to create your own rom is more involved than I thought. I knew I should have learned linux. I wanted to fool around and use different browser .apk files from one rom to another. I messed around with this when I had my blackberry. It also seems like its easier to brick your droid. With blackberry I had a list of .cods same as .apks to use. So to open your .tar or .md5 you need android-sdk and then use adb commands? Is there a list of which system files that can be changed from one update to another. I did some searching but I guess not enough. Is there a quick version to create I guess a system dump with what files that can be changed without killing you phone? From what I read you have to use Odin to extract files to your sd card then to your computer or use Sdk with commands. Once extracted to to use a browser one to another you transfer the .apk other files. Do I have the basics or is it way over my head which is why we have developers?
Click to expand...
Click to collapse
Look up harvard's cs50 course.. Its free and online and will get you started.. Ide post a, link.. But I'm lazy so google it
Sent from my SCH-I510 using XDA App
ty ace
i'll look into it, I've been looking for info for awhile, and was wondering where to start reading up on a "how to"!

[Q] joining TWRP backup files

I recently did a backup using TWRP (v.2.8.1.0) and now have multiple files (data.ext4.win000, data.ext4.win001, data.ext4.win002 etc).
Can anyone please help by proving information on how to easily merge these files together in Windows 7?
Ultimately I would like to be able to view these using 7-zip.
Thanks!
toggly said:
I recently did a backup using TWRP (v.2.8.1.0) and now have multiple files (data.ext4.win000, data.ext4.win001, data.ext4.win002 etc).
Can anyone please help by proving information on how to easily merge these files together in Windows 7?
Ultimately I would like to be able to view these using 7-zip.
Thanks!
Click to expand...
Click to collapse
That's normal. You don't want to merge them. They're all in a folder that is the backup
Sent from my Nexus 9 using XDA Free mobile app
Those files are separate archives, open then like any other tar.gz
GR0S said:
Those files are separate archives, open then like any other tar.gz
Click to expand...
Click to collapse
I get an invalid archive error when I try to open the data backups though I don't on any of the other backup files (cache.ext4.win, system.ext4.win etc).
I'm pretty sure they need to be concatenated together though I am not sure if this is easily to accomplish in Windows 7. Here is an other post with a similar problem that was solved using the Ubuntu.
On ubuntu I've just appended .tar to file name and it works.
You should try merging files with total commander and renaming to .tar
GR0S said:
On ubuntu I've just appended .tar to file name and it works.
You should try merging files with total commander and renaming to .tar
Click to expand...
Click to collapse
Gave that a shot but it didn't work
Should work just copying and pasting them into the same folder. TWRP treats the backup for a partition to be separate and complete from another. I've mixed and matched restoring partitions from different backups and it's worked. You'll have to use your judgment as to whether the restored partitions will play nice with each other.
EDIT - A workaround is to restore the partitions that you want and then back them up into a new archive.

Categories

Resources