魅族 M9 的刷机脚本代码

转载 2013年12月05日 14:15:11
@echo off
Setlocal EnableDelayedExpansion
adb kill-server>nul
taskkill /f /im adb.exe>nul 2>nul
taskkill /f /im tadb.exe>nul 2>nul
taskkill /f /fi "imagename eq wandoujia*">nul 2>nul
taskkill /f /im AndroidInterface.exe>nul 2>nul
taskkill /f /im "Android PC Suite.exe">nul 2>nul
netstat -p TCP -n -o | findstr ":5037" > port
for /f "tokens=5 delims= " %%a in (port) do taskkill /F /PID %%a>nul 2>nul
del /s /f /q port>nul 2>nul
title USB Dbg Connecting...
adb wait-for-device > nul
adb devices | findstr /B "M9"
if %errorlevel%==0 goto :foundM9
echo ERROR:未检测到M9,请确认接入的android设备是魅族M9,按任意键退出
pause > nul
exit

:foundM9
del /s /f /q device>nul 2>nul
title USB Dbg Connected
echo.
adb shell mv /data/local/tmp /data/local/tmp.bak
adb shell ln -s /data /data/local/tmp
cls
echo INFO:开始刷机
echo.
adb reboot
echo INFO:正在重启手机(第1次,共3次),请在重启进桌面后确认USB调试打开后按任意键继续
echo.
title USB Dbg Connecting...
pause > nul
adb wait-for-device > nul
title USB Dbg Connected
adb shell rm /data/local.prop > nul
adb shell "echo \"ro.kernel.qemu=1\" > /data/local.prop"
adb reboot
echo INFO:正在重启手机(第2次,共3次),请在重启进桌面后确认USB调试打开后按任意键继续
echo.
title USB Dbg Connecting...
pause > nul
adb wait-for-device > nul
title USB Dbg Connected
netstat -p TCP -n -o | findstr ":5037" > port
for /f "tokens=5 delims= " %%a in (port) do taskkill /F /PID %%a>nul 2>nul
del /s /f /q port>nul 2>nul
echo.
adb shell id | findstr /I "uid=0(root) gid=0(root)"
if %errorlevel%==1 goto end1

adb remount > nul

adb shell rm /data/local.prop
adb shell rm /data/local/tmp
adb shell mv /data/local/tmp.bak /data/local/tmp

adb push su /system/bin/su>nul 2>nul
if %errorlevel%==1 call :pushfailed "/system/bin/su"
echo INFO:成功上传/system/bin/su
adb shell chmod 06755 /system/bin/su

adb push busybox /data/local/busybox>nul 2>nul
if %errorlevel%==1 call :pushfailed "/data/local/busybox"
echo INFO:成功上传/data/local/busybox
adb shell chmod 0755 /data/local/busybox

set busybox="/data/local/busybox"
adb shell %busybox% mount -o remount,rw,noatime /
adb shell %busybox% mount -o remount,rw,noatime /system

adb wait-for-device > nul
rem adb shell %busybox% rm -f /system/app/ApplicationsProvider.*
adb shell %busybox% rm -f /system/app/BackupRestoreConfirmation.*
adb shell %busybox% rm -f /system/app/Calculator.*
rem adb shell %busybox% rm -f /system/app/CalendarProvider.*
rem adb shell %busybox% rm -f /system/app/Calendar.*
adb shell %busybox% rm -f /system/app/CertInstaller.*
adb shell %busybox% rm -f /system/app/DLNAServer.*
adb shell %busybox% rm -f /system/app/DownloadProviderUi.*
adb shell %busybox% rm -f /system/app/DrmProvider.*
adb shell %busybox% rm -f /system/app/Email.*
adb shell %busybox% rm -f /system/app/Exchange.*
rem adb shell %busybox% rm -f /system/app/FileManager.*
adb shell %busybox% rm -f /system/app/GoogleCalendarSyncAdapter.*
adb shell %busybox% rm -f /system/app/GoogleContactsSyncAdapter.*
adb shell %busybox% rm -f /system/app/GoogleLoginService.*
adb shell %busybox% rm -f /system/app/GoogleServicesFramework.*
adb shell %busybox% rm -f /system/app/HTMLViewer.*
adb shell %busybox% rm -f /system/app/KeyChain.*
adb shell %busybox% rm -f /system/app/LiveWallpapersPicker.*
rem adb shell %busybox% rm -f /system/app/MusicFX.*
rem adb shell %busybox% rm -f /system/app/Mstore.*
rem adb shell %busybox% rm -f /system/app/Mtheme.*
rem adb shell %busybox% rm -f /system/app/MzAccount.*
adb shell %busybox% rm -f /system/app/MzAutoInstaller.*
rem adb shell %busybox% rm -f /system/app/MzCloudService.*
rem adb shell %busybox% rm -f /system/app/MzPhoneLocationService.*
adb shell %busybox% rm -f /system/app/MzSimContacts.*
rem adb shell %busybox% rm -f /system/app/MzSyncService.*
adb shell %busybox% rm -f /system/app/NetworkLocation.*
rem adb shell %busybox% rm -f /system/app/NotePaper.*
adb shell %busybox% rm -f /system/app/PackageInstaller.odex
adb shell %busybox% rm -f /system/app/PicoTts.*
adb shell %busybox% rm -f /system/app/QuickSearchBox.*
adb shell %busybox% rm -f /system/app/SharedStorageBackup.*
adb shell %busybox% rm -f /system/app/Stk.*
rem adb shell %busybox% rm -f /system/app/SystemUI.*
adb shell %busybox% rm -f /system/app/Unzip.*
adb shell %busybox% rm -f /system/app/UserDictionaryProvider.*
adb shell %busybox% rm -f /system/app/Vending.*
adb shell %busybox% rm -f /system/app/VoiceDialer.*
adb shell %busybox% rm -f /system/app/科学上网Dialogs.*
adb shell %busybox% rm -f /system/app/WAPPushManager.*
adb shell %busybox% rm -f /system/app/WapiSetting.*
adb shell %busybox% rm -r /system/tts
adb shell %busybox% rm -r /system/media/audio/alarms
adb shell %busybox% rm -r /system/media/audio/notifications
adb shell %busybox% rm -r /system/media/audio/ringtones
adb shell %busybox% rm -f /system/lib/libtts*

echo.
echo INFO:开始上传ROM
for /r system %%i in (*) do (
        title USB Dbg Connecting...
        adb wait-for-device > nul
        title Uploading %%i
        call :loop "%%i"
)

for /r data %%i in (*) do (
        title USB Dbg Connecting...
        adb wait-for-device > nul
        title Uploading %%i
        call :loop "%%i"
)
echo INFO:成功上传ROM

adb shell /system/bin/busybox --install /system/bin

adb shell rm /data/local/busybox
ping 127.0.0.1 -n 3 > nul
adb reboot
adb kill-server
taskkill /f /im adb.exe>nul 2>nul
echo.
echo INFO:正在重启手机(第3次,共3次) - 刷机成功,按任意键退出
pause > nul
exit

:end1
adb shell mv /data/local/tmp.bak /data/local/tmp
adb reboot
adb kill-server
taskkill /f /im adb.exe>nul 2>nul
echo.
echo ERROR:正在重启手机(刷机失败,无法获取ROOT权限)- 请等待重启完毕之后重试
pause > nul
exit

:end2
adb shell mv /data/local/tmp.bak /data/local/tmp
adb kill-server
taskkill /f /im adb.exe>nul 2>nul
echo.
echo ERROR:文件上传失败,请清除数据重刷官方Flyme1.1.3后再试
pause > nul
exit

:pushfailed
echo ERROR:文件%1上传失败,是否继续刷机?按Y继续,其他键退出刷机
set choice=
set /p choice=输入您的选择:
if /i "%choice%"=="Y" goto :eof
goto :end2

:loop
set dir=%~dp1
set "dir=!dir:%~dp0%=!"
set "dir=/!dir:\=/!"
set file=%dir%%~nx1
if "%dir%"=="/system/bin/" goto :0755
if "%dir%"=="/system/xbin/" goto :0755
adb shell -c "ls %dir%>nul && echo $?" | findstr /B "0"
if %errorlevel%==0 goto :foundDir
adb shell mkdir "%dir%">nul 2>nul
adb shell chmod 0755 "%dir%"
:foundDir
if "%~x1"==".sh" goto :0755
adb push %1 "%file%">nul 2>nul
if %errorlevel%==1 call :pushfailed "%file%"
echo INFO:成功上传%file%
adb shell chmod 0644 "%file%">nul 2>nul
goto :eof

:0755
adb push %1 "%file%">nul 2>nul
if %errorlevel%==1 call :pushfailed "%file%"
echo INFO:成功上传%file%
adb shell chmod 0755 "%file%">nul 2>nul
goto :eof

相关文章推荐

魅族M9 Root及刷机

魅族M9的ROOT教程

  • 2012-09-13 10:45
  • 42KB
  • 下载

魅族M9 初步体验感受,O(∩_∩)O哈哈哈~虽然推出一年才买,但是赶上了1699RMB 的好价格也不错

以前魅族M9 刚推出的时候,就有同事2499 RMB买回来一个,我玩了一下,感觉很爽,但是当时刚买里程碑1,所以就没去抢购,最近答应给女朋友买一个手机。价格定位在15~2000RMB。于是我十二月中旬...

魅族M9root工具包

  • 2012-07-22 12:25
  • 1.71MB
  • 下载

魅族M9如何设置铃声

这几天买了魅族M9这款手机,第一次接触安卓手机, 下面就和大家分享一下魅族M9手机怎样设置铃声 1,点击屏幕下方的home键,就是屏幕下方的硬方框键,回到屏幕的主界面,然后点击“设置”。 2...

魅族m9root 汉化工具cz_to_cn

  • 2014-04-25 12:23
  • 5.68MB
  • 下载

魅族M9QQ HD

  • 2012-06-03 10:07
  • 10.26MB
  • 下载

从魅族M9终于开放联系人权限说起

魅族M9终于开放联系人权限,广大煤油们可以使用各种同步工具了。这一点魅族为MY着想做得很对;但想得迟做得较晚,没有在第一时间处理,让很多MY们无法在拿到手机后立刻同步联系人,这几乎是无法让人忍受的。魅...
  • huzgd
  • huzgd
  • 2011-03-05 10:26
  • 1742

魅族MX和M9:Android4.0原生固件公测版发布

魅族老板黄章早在MX发布前夕就公开承诺,不久后将发布适用于双核MX和M9的Android4.0固件,昨天黄章向广大魅粉们终于兑现了这个承诺。值得广大android发烧友欢呼雀跃的是,这一次公测版是“冰...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)