We have to set up a number of android devices for a project we are working on... What we have to do is actually edit the iptables of the device. Rather then doing each one by one I'm curious if there is a way to set up one device then clone the image so that we have an exact replica of that image?
We would then perhaps use PhonixCard to reinstall that image on all of the other devices...
Not sure it matters much but the device is running 4.0.1... all of the devices that we want to replicate the image on are exactly the same device.
from a previous SO answer:
Make a nandroid backup from recovery.
Make sure that the backup is located on the sdcard.
Mount the sdcard on a computer and copy it's contents to a folder on a pc.
Copy the entire contents of the folder you made above to the target device.
Root the device than install a custom recovery if you didn't do this already.
In recovery restore the nandroid backup.
Reboot the device. Now everything should be exactly the same as on the original.
Repeat steps 4-7 for every device.
If there're lots of small files that need to be transferred, another possibility is zip them up copy to the phone and than unzip it using
adb shell unzip path/to/file.zip
Once the command is launched you can disconnect the device the process will continue as long as there're no conflicting files or folders.
So answer cloning android OS images
Related
1-I have rooted my tablet(android 5.1.1).
2-I have installed some apps as System app...
3-I need to take a backup of my entire android os, including data_user and system apps, all together.
is it possible to take an image of android os including every things?
At first, use mount or cat /proc/mtd command to identify your block devices. And then copy all image to file:
cat /dev/mtd/mtd16ro > /sdcard/my_system_image.bin
/dev/mtd/mtd16ro - system partition at my tablet (your may be different)
/sdcard/my_system_image.bin - your image at your sdcard
I'm working on an app to enable people to upload photos from their phone, and I need to be able to test this functionality out in the AVD via emulator. However the AVDs don't seem to have any photos in storage so I can't use them for testing.
Is there an efficient way to get photos onto the virtual device and preferably keep them there so I can run multiple tests on them? I know I can debug on my phone as well (and have been doing that), however I would prefer to do most of my debugging on the emulator if possible.
I'm using the IntelliJ IDEA for development.
One way would be to open cmd window and type adb shell. You can then create a folder for the images you'd like in the sdcard folder. Then you can exit the shell and push the images to the device using adb push cmd.
It's pretty simple actually.
adb shell
cd sdcard
md directoryName
exit
adb push /sdcard/directoryName /pathToImage
I solved the issue by starting the Android Device Monitor in IntelliJ (Tools>Android>Android Device Monitor), navigating to the File Explorer tab, and copying pictures over to the sdcard>Downloads folder. In the device emulator, I selected 'show SD card' before I was able to use the pictures from that folder. It will probably be easier if I can find out how to put the pics on a device folder instead of SD card, but for now this suffices.
Thanks for the suggestion eclipse, helped me go down the right path.
I've been trying to write a small program to copy a folder on my mac (10.10.3), containing a set of songs, into the music folder on my Galaxy S3 (GS3) when it is connected via USB. Clearly I could just use Android File Transfer (AFT), and copy the files in (manually), however this wouldn't teach me anything. My goal is thus to automate this act. Python seems like a good choice for this project, as it seems like mostly scripting (in fact a Bash script may suffice).
This should be simple, using a bash script like cp ~/../music_on_mac /.../music_target_on_android
However, the file structure of the GS3 doesn't show up in the finder (like you would expect from an ordinary USB drive). I can only see the file structure via Android File Transfer. From what I've read, this is expected behavior (I suppose due to formatting differences?). Thus I've been unable to find the target directory /.../music_target_on_android
My best guess (getting a bit out of my depth here), is that I need to copy the music folder, and then pipe it to AFT, and have AFT place it in/on top of the target Music folder on my GS3. Is this correct? If so, could anyone offer suggestions on implementing this? If not, alternative approaches or suggestions would also be appreciated.
I'd also note that I considered using ./adb push <local> <remote> to try to copy the files directly, however this pushed back that the device was read only. I'm also not familiar enough to find the proper directory on the GS3 (the one containing the target for the "Music" folder) using ./adb shell. There's also the added downside that in order to use a solution involving the ADT, one must have the ADT (which most people don't). Moreover, I want to keep it simple.
Research Update:
I've found that my phone will not show up in Finder because Google has disabled USB mass storage (aka mounting the phone as a disk) in favor of the Media Transfer Protocol (MTP). AFT is just an MTP client, needed because unlike Windows and Linux, OSX does not support MTP.
http://www.howtogeek.com/192732/android-usb-connections-explained-mtp-ptp-and-usb-mass-storage/
Based on tips, I've been able to implement an alternative based on creating an FTP server on my phone. Connecting to this gives me file system access and write privileges from my terminal, which is half the battle, however its quite slow. Thus I'd still like to find a way to automate instructions to Android File Transfer.
aafm is a small Python GUI utility that copies files between a computer and an Android device with MTP, using adb as the underneath layer. But as it is right now, the files get the timestamp of when they have been copied, instead of their original timestamp.
It would be great if we could set the last modified date in the device to match the last modified time in the computer.
I've been going through the list of adb shell commands in http://developer.android.com/tools/help/adb.html but so far I'm unable to find anything remotely similar to the classic unix touch command.
Does anything like that exist in this shell?
You can use busybox on android for that purpose. This is one binary acting as replacement (mainly with limited options) of small linux standard programs, e.g. touch. Read this and this
Now I found it is a part of android toolbox binary, but if you can't find it on a phone you can used own built touch binary and use it, source file is here. You just need to upload it on the phone, chmod and delete after using.
If you are talking about copying from host to the Android using ADB, it should use the original modify timestamp. The current code in adbd does a utime(). On some devices the utime() fails (see below). Copying from Android to host over ADB does not even attempt to set any timestamps. I do not know the reason for this omission. On my two devices (2.1 & 4.0) modify timestamp is set on write to Android but not on write to host. On 4.2 devices there is an issue with the FUSE filesystem and not allowing utime();
On devices without a real sdcard (that is, using FUSE) there will be problems doing utime() on a file unless you are root. This gets into the anomalous situation where you can create a file but not alter the timestamps. The only real solution is to make sure that ro.secure=0 or that you are running an insecure version of adbd.
Looking for the command (or steps) to create a shell script on android that tells the device to reboot into recovery mode and automatically restore a backup located in the /sdcard/clockworkmod/backup/ folder. I know the reboot is:
reboot recovery
But I imagine there is something else I either need to add to that line or perhaps create a file somewhere that instructs cwm to automatically restore a backup and reboot.
Found my own answer... For the folks in the ether...
Install ROM Manager Premium (small $$).
Use Koush's test rom manage project (https://github.com/koush/TestRomManager) to connect to ROM Manager and essentially ask it to reboot the device into recovery and do a backup. The system is actually incredibly powerful in that you can do some kool stuff over the air. This is a good setup for internally managed devices... You can even run your own update.zip scipts...
Optionally you can add a couple of exec lines to click ok automatically to the ROM Managers popup "do you want to reboot now?".
Thats it. Lots of research, as usual a Frankenstein of source from a great world full of devs.
If you follow the comments on this file, you will manage to do what you want
https://android.googlesource.com/platform/bootable/recovery/+/fadc5ac81d6400ebdd041f7d4ea64021596d6b7d/recovery.c
Specifically, you will have to deal with the file
/cache/recovery/command
And include there the command you want to issue. Root access is needed to do so.
Alternatively, if your recovery admits it (CWM, TWRP) you can just use the recovery command through adb once you rebooted there.