when the network is bad Patch boot files with offline
能不能添加一个离线修补boot文件的功能,在网络不好时使用离线修补的功能会比较快。例如我要给一个新手机修补boot文件时我可以用另个手机上操作,使用已经下载过的magisk文件。
這邊提供一個方法,不過我的手機已經是 root 狀態,先前也 patch 過 boot.img,所以不確定 clean 的狀態下是否能正常運行,保險起見可以先跑過一次修補。
最後開啟 manager 對 /sdcard/boot.img 進行修補。
oops, 不能用 run-as,權限不足,看起來還是要透過 root 執行這段命令: cp /sdcard/magisk.zip /data/data/com.topjohnwu.magisk/cache/magisk.zip
使用debug版本Magisk Manager就可以用run-as。但是需要联网拉取元数据
使用debug版本Magisk Manager就可以用run-as。但是需要联网拉取元数据
我在想能不能添加一个离线patch boot.img的功能,这个在软件上实现是比较简单的,这个功能应该也比较常用吧,下次fork代码单独做个功能试试
很简单,但安装方式已经够复杂了,不能再加了。况且…意义不大
很简单,但安装方式已经够复杂了,不能再加了。况且…意义不大
安装方式很简单,修补boot后fastboot flash。就是每次升级都要patch下载太麻烦了,下载比较费事
再提供另一個指令,也是要 root,前置作業跟前面一樣 (1 ~ 3):
am start -n com.topjohnwu.magisk/a.f -d file:///storage/emulated/0/boot.img --es action patch
整理了一下心得 : https://medium.com/@shakalaca/root-offline-patch-boot-img-with-magiskmanager-9c289a1a6457 參考看看唄,我覺得現階段可以這麼做就不需要再增加額外的介面了。 :)
整理了一下心得 : https://medium.com/@shakalaca/root-offline-patch-boot-img-with-magiskmanager-9c289a1a6457 參考看看唄,我覺得現階段可以這麼做就不需要再增加額外的介面了。 :)
基于你的代码我做了下面这个小工具
https://github.com/yecw/MagiskHelper/tree/master/release
There is currently no plan to implement this. Might consider this in the future.
@shakalaca Hey there, tried following the steps in your Medium post, but mine always fails at the step "Copying image to cache", do your instructions still work for 10.0?
Magisk Manager I believe should have the correct storage permissions, since it still works the normal way, unless there's something else I need to do for it to work via adb?
I think this might be the relevant error from syslog, not sure what to make of it.
12-26 20:31:47.574 21930 23210 W System.err: java.lang.ClassCastException: a.wb2 cannot be cast to a.ba2
12-26 20:31:47.574 21930 23210 W System.err: at a.p81.<init>(Unknown Source:12)
12-26 20:31:47.574 21930 23210 W System.err: at a.v3.a(Unknown Source:69)
12-26 20:31:47.574 21930 23210 W System.err: at a.h11.g(:2)
12-26 20:31:47.574 21930 23210 W System.err: at a.zz0$b.f(:3)
12-26 20:31:47.574 21930 23210 W System.err: at a.t.call(java-style lambda group:1)
12-26 20:31:47.574 21930 23210 W System.err: at a.ur1.b(Unknown Source:16)
12-26 20:31:47.574 21930 23210 W System.err: at a.dk1.a(Unknown Source:10)
12-26 20:31:47.574 21930 23210 W System.err: at a.as1.run(Unknown Source:4)
12-26 20:31:47.574 21930 23210 W System.err: at a.yj1.run(Unknown Source:9)
12-26 20:31:47.574 21930 23210 W System.err: at a.vs1.run(Unknown Source:13)
12-26 20:31:47.574 21930 23210 W System.err: at a.vs1.call(Unknown Source:0)
12-26 20:31:47.574 21930 23210 W System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
12-26 20:31:47.574 21930 23210 W System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
12-26 20:31:47.574 21930 23210 W System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-26 20:31:47.574 21930 23210 W System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-26 20:31:47.574 21930 23210 W System.err: at java.lang.Thread.run(Thread.java:919)
谢谢!
@4oo4 Try this command:
am start -n com.topjohnwu.magisk/a.f -d file:///storage/emulated/0/magisk.zip --eu additional_data file:///storage/emulated/0/boot.img --es action patch
@shakalaca It works! Thanks again!
@shakalaca Did the activity manager classes change? When I try to run this now, I get this:
blueline:/ # am start -n com.topjohnwu.magisk/a.f -d file:///data/data/com.topjohnwu.magisk/cache/magisk.zip --eu additional_data file:///storage/emulated/0/Download/b>
Starting: Intent { dat=file:///data/data/com.topjohnwu.magisk/cache/magisk.zip cmp=com.topjohnwu.magisk/a.f (has extras) }
Error type 3
Error: Activity class {com.topjohnwu.magisk/a.f} does not exist.
So looks like that got removed as of https://github.com/topjohnwu/Magisk/commit/6907651756b43883cece3ca40fa1b2bfb32f01e3?
Just curious if there's still another way to patch a boot image like this?
Also, I'm looking to specify patch options, (like dm-verity and keep forced encryption), would I add those with --es keep_dm_verity and --es keep_force_encryption?
If it's not possible to still do it this way, I suppose there's a way to do it with the boot_patch.sh script that's in the flashable zip? I experimented with that before, but haven't tried flashing that since i always seem to get a slightly smaller image file, are there other scripts that need to be called before or after that?
Thanks again
@4oo4 if you're still interested please take a look of this project https://github.com/shakalaca/MagiskOfflineInstaller
Most helpful comment
@4oo4 if you're still interested please take a look of this project https://github.com/shakalaca/MagiskOfflineInstaller