我正在寻找一些教程或帮助能够直接在我的电脑上备份所有Android分区,并能够从Linux安装每个android分区以查看它们。
我正在寻找一些教程或帮助能够直接在我的电脑上备份所有Android分区,并能够从Linux安装每个android分区以查看它们。
I am looking for some tutorial or help to be able to make a backup of all Android partitions directly on my computer and be able to mount each of them from Linux to view them.
我不知道它是否适用于您的特定设备和操作系统,但我认为这个脚本是直截了当的,您将能够得到一般的想法并相应地修改。
首先列出/ dev / block / platform / [xxxxx] / by-name目录的内容(与设备不同),然后通过内容文件循环,在这种情况下是特定设备的分区名称。在每个迭代中,它修剪0x0d(运输返回" r" )在每个文件名结束时添加的字符,然后它使用 cat
将分区打印到终端的stdout但我们还必须处理0x0d(运输返回" r" )字节在打印前添加,然后它计算输出文件的MD5SUM,您可以与设备中的分区的MD5SUM进行比较以确定没有腐败。
#!/bin/bash BY_NAME_DIR="/dev/block/platform/sprd-sdhci.3/by-name" for partition in $(adb shell ls $BY_NAME_DIR) do partition=$(tr -d ' '<<<$partition) echo Backing up $partition partition adb shell "su -c cat $BY_NAME_DIR/$partition 2> /dev/null"|sed 's/ $//' > ${partition}.img echo Calculating md5sum md5sum ${partition}.img > ${partition}.md5 echo Done backing up ${partition} done
您还可以参考这个问题可以处理添加的" r" (0x0d)字符
I don't know if it will work for your particular device and OS but I think this script is straight forward and you will be able to get the general idea and modify accordingly.
It first lists the content of /dev/block/platform/[xxxxx]/by-name directory (differs from device to device) then loops through the content files which in this case are partition names of your particular device. In each iteration it trims the 0x0d (carriage-return "\r") character that is added at the end of each file name, then it uses cat
to print the partition to stdout of your terminal but we must also handle 0x0d (carriage-return "\r") byte that is added before newline(0x0a) before printing, then it calculates the md5sum of the output file which you can compare to the md5sum of the partition in your device to be sure there is no corruption.
#!/bin/bash BY_NAME_DIR="/dev/block/platform/sprd-sdhci.3/by-name" for partition in $(adb shell ls $BY_NAME_DIR) do partition=$(tr -d '\r'<<<$partition) echo Backing up $partition partition adb shell "su -c cat $BY_NAME_DIR/$partition 2> /dev/null"|sed 's/\r$//' > ${partition}.img echo Calculating md5sum md5sum ${partition}.img > ${partition}.md5 echo Done backing up ${partition} done
You can also refer to this question to see how you can handle the added "\r"(0x0d) characters
© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有