busybee 发表于 2014-12-13 10:29
data.img 很少用,所以没有试过。而且在恢复出厂设置,这个 data 分区就会清空了。
可能的解决方案之一 ...
adb shell busybox tar -cz -C /data . | \ tar -xz -C out/target/product/rk3288/data/ # 清理 data 目录数据 |
PATH=$PATH:./out/host/linux-x86/bin \ out/host/linux-x86/bin/mkuserimg.sh \ -s \ out/target/product/rk3288/data/ \ rockdev/Image-rk3288/databk.img \ ext4 /data 1G |
out/host/linux-x86/bin/simg2img \ rockdev/Image-rk3288/databk.img \ rockdev/Image-rk3288/databk.ext4.img |
sudo mkdir -p /mnt/databk sudo mount -o loop rockdev/Image-rk3288/databk.ext4.img /mnt/databk find /mnt/databk # ... sudo umount /mnt/databk |
static const char *DATA_PARTITION_NAME = "userdata"; static const char *DATABK_PARTITION_NAME = "databk"; int start_to_clone(const char *data_devname, const char *databk_devname) { if(simg2img(databk_devname, data_devname)){ LOGE("null of databk ->failed to clone\n"); return -1; } LOGI("Cloning %s to %s\n", databk_devname, data_devname); return 0; } static int clone_data_if_exist() { // ... const MtdPartitionbyCmdline *databk_partition = mtd_find_partition_by_cmdline(DATABK_PARTITION_NAME); const MtdPartitionbyCmdline *data_partition = mtd_find_partition_by_cmdline(DATA_PARTITION_NAME); sprintf(data_devname, "/dev/block/mmcblk0p%d", data_partition->device_index); sprintf(databk_devname, "/dev/block/mmcblk0p%d", databk_partition->device_index); // Start to clone if (start_to_clone(data_devname, databk_devname)) { LOGE("clone_data_if_exist->error clone data\n"); return -1; } return 0; } |
欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) | Powered by Discuz! X3.1 |