[Eee Pad Transformer Q&A, Help & Troubleshooting] Rayko:
Greetings everyone. I'm trying to get my head around the nvflash tool to make a full restore on my TF101. Long ago, when I flashed it with a custom rom I made a backup using nvflash, which saved pretty much all partitions inside the device's storage. I also must say that I don't have a clear idea of how nvflash works, so I'm just trying and failing with no luck so far.

I would like to be able to write the raw data I backed up into the device, but I don't know how to do it really. The script I'm working on to perform this task has a create command to write all the partitions and format them as they were when the backup was made. An additional detail is that I had an ubuntu there as well, hence the partition redefinition.

Thing is that the command that creates and format the partitions also writes a bootloader and other data into the device, which doesn't let me to re-write the original bootloader and data I have from the backup.

Here's the script:

#!/bin/bash

echo 'Restoring ASUS TF101...'
BACKUP_DIR=$1

./nvflash --bct transformer.bct --setbct --configfile $BACKUP_DIR/flash.cfg --bl bootloader.bin --create --odmdata 0x300d8011 --sbk 0x1682CCD8 0x8A1A43EA 0xA532EEB6 0xECFE1D98

./nvflash --rawdevicewrite 0 1536 $BACKUP_DIR/02_BCT_raw.img --bl bootloader.bin
./nvflash --rawdevicewrite 1536 256 $BACKUP_DIR/03_PT_raw.img --bl bootloader.bin
# ./nvflash --rawdevicewrite 1792 2048 $BACKUP_DIR/04_EBT_raw.img --bl bootloader.bin #bootloader
./nvflash --rawdevicewrite 3840 2560 $BACKUP_DIR/05_SOS_raw.img --bl bootloader.bin #recovery

./nvflash --go

./nvflash --resume --sync

./nvflash --resume --download 6 $BACKUP_DIR/06_LNX_raw.img #kernel
./nvflash --resume --download 7 $BACKUP_DIR/07_BAK_raw.img
./nvflash --resume --download 8 $BACKUP_DIR/08_GP1_raw.img
./nvflash --resume --download 9 $BACKUP_DIR/09_APP_raw.img #system
./nvflash --resume --download 10 $BACKUP_DIR/10_CAC_raw.img
./nvflash --resume --download 11 $BACKUP_DIR/11_MSC_raw.img
./nvflash --resume --download 12 $BACKUP_DIR/12_USP_raw.img
./nvflash --resume --download 13 $BACKUP_DIR/13_PER_raw.img
./nvflash --resume --download 14 $BACKUP_DIR/14_YTU_raw.img
# ./nvflash --resume --download 15 $BACKUP_DIR/15_UDA_raw.img #media (/!\ ~14/30GB large)
./nvflash --resume --download 16 $BACKUP_DIR/16_GPT_raw.img

echo "Restore completed!"

As you can see, I'm trying to use the rawdevicewrite option, which in theory is the one I should be using for some of the partitions due to being encrypted (as I read somewhere in here). The main problem of the script is that it can't continue after the first command, because it executes a sync and since there is no bootloader on the device after the formating, it fails.

I read that the config file used by nvflash also contains files to be transfered to the device. When I specify the backed up bootloader to load after the format, the transfer stops for some reason and never finishes. I suspect it has something to do with either the encryption, or because it's replacing something that is running.

So question is: how exaclty the rawdevicewrite can be used? is there a better/easier way to restore this kind of data?

I can't find much documentation about the tool to fix my script. My idea is to automate the restore so I can just throw it a dir, and it restores from there.

Note that I don't really have a problem with the device itself... well, I actually do, but what I mean is that I can successfully flash with stock roms and everything would work properly, but I would like to restore everything I backed up, including the original bootloader, recovery, etc, and I need this, because the recovery img I have (not the backup), doesn't seem to work after installing it, it gets stuck with a warning icon.

Any leads on how I could achive this will be appreciated. Otherwise I guess I will likely lose those partitions and be able to only restore non-encrypted data, which is a pity, because the data is there and theoricaly, raw writing it into the device should restore the state that was backed up.

Thanks in advance, let me know if you need further info.