@echo off
color 0a
ECHO. 

rd /s /q backup > nul 2>&1

adb shell  "rm -rf /sdcard/backup "

adb shell "mkdir /sdcard/backup"

ECHO 正在备份晶 dtb 分区......

adb shell "dd if=/dev/dtb           of=/sdcard/backup/dtb.img" 

ECHO 正在备份晶 logo 分区......
adb shell "dd if=/dev/block/logo    of=/sdcard/backup/logo.img"

ECHO 正在备份晶 bootloader 分区......
adb shell "dd if=/dev/block/bootloader    of=/sdcard/backup/bootloader.img"

ECHO 正在备份晶 boot 分区......
adb shell "dd if=/dev/block/boot    of=/sdcard/backup/boot.img"
 
ECHO 正在备份晶 recovery  分区......
adb shell "dd if=/dev/block/recovery     of=/sdcard/backup/recovery.img"

ECHO 正在备份晶 system 分区......
adb shell "dd if=/dev/block/system    of=/sdcard/backup/system.img"

ECHO 正在上传备份的固件....

adb pull -p  /sdcard/backup  backup

ECHO 备份完成，固件存放位置为工具根目录backup文件！！！

pause>NUL