FORUMS
Remove All Ads from XDA

How about a ROM DUMP?

1,009 posts
Thanks Meter: 23
 
By Da9L, Senior Member on 29th September 2008, 05:04 PM
Post Reply Email Thread
14th October 2008, 01:44 PM |#31  
Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by dzo

There's a simple file manager here:

http://cs-alb-pc3.massey.ac.nz/vogue/Glance.apk

Can you see if you can use it to copy anything from /system to /sdcard. To copy a file press and hold the name and select copy then press and hold on the destination directory and select paste.

Thanks

Today I installed the Android Emulator on my laptop to see how we can solve this problem.

Using the Emulator it's quite easy. Just download the busybox binary to your local machine and upload it to the emulator using the adb commando. The busybox file contains a set of usefull tools which will help us to copy the file system.

To extract the file system from the emulator you need to do this:

download this file http://benno.id.au/android/busybox

Download the SDK and unzip it (download from http://code.google.com/android/download.html )
All the tools you need are located under tools
Create a sdcard rom file using this command (under tools) mksdcard 1024M sdcard1.is
Run the Emulator using this command: emulator.exe -datadir C:\android-sdk\tools\lib\images -sdcard C:\android-sdk\tools\sdcard1.iso

Open a second command prompt and type:
adb.exe shell
# mkdir /data/busybox
# exit


Copy the busybox utility to the android device
adb.exe push c:\android-sdk\downloads\busybox /sdcard/

Install and run the busybox utility
adb.exe shell
# cd /data/busybox
# ./busybox --install
# export PATH=/data/busybox:$PATH


Backup the system directory to the sdcard
# cd /sdcard
# tar -c -f system.tar /system


If you do this you should be able to package the system directory to a tar file.

The only problem is that we need to have shell access on the HTC G1 to do this.

raymondf13,
What will happen if you connect the HTC G1 device with your computer and you fire up the adb command. Is the device listed?


C:\android-sdk\tools>adb.exe devices

List of devices attached
emulator-5554 device

C:\android-sdk\tools>
 
 
14th October 2008, 02:17 PM |#32  
dagentooboy's Avatar
Senior Member
Flag Kansas
Thanks Meter: 157
 
More
If someone finds the drivers and we can connect to the G1 through USB then I think a hacked tether solution is about 2 days from release...
15th October 2008, 08:29 AM |#33  
Senior Member
Flag Twente
Thanks Meter: 5
 
More
Ok, this is really interesting, anyone got a rom dump yet? It's time to port this baby!
15th October 2008, 06:49 PM |#34  
raymondf13's Avatar
Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by piethein


raymondf13,
What will happen if you connect the HTC G1 device with your computer and you fire up the adb command. Is the device listed?


C:\android-sdk\tools>adb.exe devices

List of devices attached
emulator-5554 device

C:\android-sdk\tools>

To use adb, you must enable USB Debugging in Settings>Applications on the G1.

The device wont list because we need a driver for the USB debugging. The drivers for the SD card access and debugging are not the same.

We pretty much hit a dead end until we can get that driver. Perhaps when the phone actually releases.

Im not saying its impossible at this point so im open to all advice. Please PM me or send me an e-mail.
[email protected]
15th October 2008, 11:11 PM |#35  
Senior Member
Thanks Meter: 0
 
More
There is a serial debug driver (msm_serial_debugger.c) here.

Any use?
16th October 2008, 03:37 PM |#36  
Member
Thanks Meter: 0
 
More
I'm busy with some code; the plan I have is to collect all files and copy them to a backup directory on the sdcard. The code for the backup program I have till now is:
The only thing it does right now is to create a backup directory on the sdcard and put a file "test.txt" there.


package com.android.backup2sdcard;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class Backup2SDCard extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);

try {
new File("/sdcard/backup");
}catch(Exception e) { Log.e("Directory()...Exception", e.toString()); }

try {
// Write test from root file to SD-Card
String file_path=null;
file_path="/text.txt";

//FileInputStream fIn = openFileInput(file_path);
//InputStreamReader isr = new InputStreamReader(fIn);
//char[] inputBuffer = new char[file_path.length()];
//isr.read(inputBuffer);
//String readString = new String(inputBuffer);
//boolean isTheSame = file_path.equals(readString);
//Log.i("File Reading stuff", "success = " + isTheSame);

String file_path_sd=null;
file_path_sd="/sdcard/backup" + file_path;
BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file_path_sd));
stream.flush();
stream.close();
}catch(Exception e) { Log.e("File()...Exception", e.toString()); }
}
}




All I need to do next is to read all files from the "/" (InputStream) and pass them one by one the to InputStream. If you have some programmings skills and can help please join me!
16th October 2008, 08:51 PM |#37  
Senior Member
Flag Twente
Thanks Meter: 5
 
More
Quote:
Originally Posted by piethein

I'm busy with some code; the plan I have is to collect all files and copy them to a backup directory on the sdcard. The code for the backup program I have till now is:
The only thing it does right now is to create a backup directory on the sdcard and put a file "test.txt" there.


package com.android.backup2sdcard;
...


All I need to do next is to read all files from the "/" (InputStream) and pass them one by one the to InputStream. If you have some programmings skills and can help please join me!

If i could, i would in a heartbeat... Good luck! I really want my diamond with the Android OS :P
16th October 2008, 09:09 PM |#38  
Junior Member
Thanks Meter: 0
 
More
I've got the Phone in my hands right now as we speak. I'm an employee of T-Mobile and we have been using the G1 for weeks now. I'd be more than happy to provide a ROM dump if someone walks me through how.
16th October 2008, 10:14 PM |#39  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by piethein

I'm busy with some code; the plan I have is to collect all files and copy them to a backup directory on the sdcard. The code for the backup program I have till now is:
The only thing it does right now is to create a backup directory on the sdcard and put a file "test.txt" there.

(snip)

All I need to do next is to read all files from the "/" (InputStream) and pass them one by one the to InputStream. If you have some programmings skills and can help please join me!

Made any progress with your code? I'm downloading the Android SDK now, so I'll try and get it working in that. No promises though, my Java is a little rusty
16th October 2008, 10:34 PM |#40  
Senior Member
Flag Twente
Thanks Meter: 5
 
More
Quote:
Originally Posted by rtanderson2

I've got the Phone in my hands right now as we speak. I'm an employee of T-Mobile and we have been using the G1 for weeks now. I'd be more than happy to provide a ROM dump if someone walks me through how.

Thanks in advance for your efforts, to get a rom dump we most likely need to make a serial connection from your pc with your phone. Read the pages (there are only 4 pages) in this topic and try to get a connection in order to run commands.

The alternative is the java code ppl are writing right now, hopefully you can put that code on a SD Card and run that to back it up in the near future.

Please follow this thread, testers are always welcome and the faster a rom dump get's available the better!
17th October 2008, 12:58 AM |#41  
Junior Member
Thanks Meter: 0
 
More
Ok, is there anyone who wants to test this out:

Code:
package rootDump.application;

import java.io.*;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class RootDump extends Activity {
	private String sdcardPath = "/sdcard";
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        try {
        	File target = new File("/");
        	File destination = new File(this.sdcardPath);
        	this.CopyDirectory(target, destination);
        } catch(Exception e) {
        	Log.e("RootDump.onCreate", e.toString());
        }
    }
    
    public void CopyDirectory(File target, File destination)
    {
    	Log.i("RootDump.CopyDirectory", "Entering directory: " + target.getAbsolutePath());
    	String[] files = target.list();
    	
    	File file;
    	File newDestination;
    	String newTargetPath;
    	for (String filename : files) {
    		newTargetPath = target.getAbsolutePath();
    		if (newTargetPath != "/") newTargetPath += "/";
    		newTargetPath += filename;
    		
    		file = new File(newTargetPath);
    		
    		if (file.getAbsolutePath().equals(this.sdcardPath)) {
    			continue; // skip the sdcard directory
    		}
    		
    		if (!file.canRead()) {
    			Log.i("RootDump.CopyDirectory", "Could not read: " + file.getAbsolutePath());
    			continue;
    		}
    		
    		if (this.isLink(file)) {
    			Log.i("RootDump.CopyDirectory", "Skipping link: " + file.getAbsolutePath());
    			continue;
    		}
    		
    		newDestination = new File(destination.getAbsolutePath() + "/" + filename);
    		
    		if (file.isDirectory()) {
    			if (!newDestination.exists() && !newDestination.mkdir()) {
    				Log.i("RootDump.CopyDirectory", "Failed to created destination dir: " + newDestination.getAbsolutePath());
    				continue;
    			}
    			this.CopyDirectory(file, newDestination);
    			continue;
    		}
    		
    		try {
    			Log.i("RootDump.CopyDirectory", "Copying: " + file.getAbsolutePath() + " to: " + newDestination.getAbsolutePath());
    			this.copyFile(file, newDestination);
    		} catch (IOException e) {
    			Log.e("RootDump.CopyDirectory", e.toString());
    		}
    	}
    }
    
    public boolean isLink(File file)
    {
    	try {
    		if (!file.exists())
    			return true;
    		else {
    			String cnnpath = file.getCanonicalPath();
    			String abspath = file.getAbsolutePath();
    			return !abspath.equals(cnnpath);
    		}
    	} catch(IOException ex) {
    		System.err.println(ex);
    		return true;
      	}
    }
    
    public void copyFile(File src, File dst) throws IOException {
        InputStream in = new FileInputStream(src);
        OutputStream out = new FileOutputStream(dst);
    
        // Transfer bytes from in to out
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        in.close();
        out.close();
    }
}
Some notes:

Your sd card should be blank (since it copies to the root of the card)
I'm not sure if the isLink() method is right, I grabbed it from http://www.idiom.com/~zilla/Xfiles/javasymlinks.html
Speaking of links, it completely skips links at the moment, perhaps someone wants to add logging of links (I'm skipping them to avoid infinite loops/lots of space being taken up)
Yes, I know it could be neater/better


Let me know how it goes!
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