Last active
December 17, 2015 01:49
-
-
Save JerryFleming/5530721 to your computer and use it in GitHub Desktop.
backup up android.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Backup android device to make ROMs, typically | |
# for Galaxy Tab P1000. | |
# by Jerry Fleming <[email protected]> | |
# | |
# SYNOPSIS: | |
# backup -- does everything | |
# backup file -- start from here directly | |
# backup file only -- for this file only | |
# | |
declare -A ARR | |
# Add/Remove your blocks here. | |
ARR=( | |
[bml1]=boot.bin | |
[bml2]=pit.pit | |
[bml4]=sbl.bin | |
[bml7]=zImage | |
[bml9]=recovery.bin | |
[bml12]=modem.bin | |
[stl3]=efs.rfs | |
[stl6]=param.lfs | |
[stl9]=factoryfs.rfs # /system | |
[stl10]=dbdata.rfs | |
[stl11]=cache.rfs | |
[mmcblk0p2]=data.rfs | |
[mmcblk0p3]=preload.vfat | |
) | |
cd $(dirname $0) | |
( | |
skip=$1 | |
for block in ${!ARR[*]} | |
do | |
[ -n "$skip" ] && { | |
[[ x${ARR[$block]} != x$skip ]] && continue || skip= | |
} | |
echo ====== DUMPING ${ARR[$block]} ========== | |
dd if=/dev/block/$block of=${ARR[$block]}.tmp bs=4096 && mv ${ARR[$block]}.tmp ${ARR[$block]} | |
[[ x${ARR[$block]} == x$1 ]] && [[ "$2" == "only" ]] && break | |
done | |
echo 'ALL DONE!!!' | |
) 2>&1 |tee log | |
exit 0 | |
#tar --format=ustar -c factoryfs.rfs modem.bin zImage > myrom.tar | |
#md5sum -t myrom.tar >> myrom.tar | |
#mv myrom.tar myrom.tar.md5 | |
# vim: ft=sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment