Add --plstage argument#263
Open
davdiv wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Without
--plstage, the--preloaderargument is parsed but never sent to thedevice for any DA/flash subcommand (
printgpt,r,w,e,rf,wf,gpt,rs,rl,wl,es,footer,da, …) — onlypeekandplstagehonor it today. This means a user holding a preloader file on disk has no way
to make
printgptand the other DA/flash commands boot the device into itbefore reading/writing.
With this change, I am now able to use
mtkto read partitions from mybricked BraX3 device by sending my own patched preloader first, then
reading the GPT and any partition on top of it. Before this, I could not run
printgptat all on that device, because the stock preloader was failing andnothing forwarded the
--preloaderargument through to the device's preloader stage.Example
Changes
mtk.py— register--plstageinadd_exploit_group.mtkclient/Library/mtk_class.py— extract theparse_preloader → send_da → jump_da → re-initflow intoMtk.boot_preloader(). Reusesself.configsoconfig.loader(the customDA loader blob) is preserved across the new
Mtkinstance.mtkclient/Library/mtk_main.py:cmd_peeknow usesboot_preloader()instead of inlining the same flow.--plstagebranch at the top of the generic DA/flash dispatch path,before
DaHandleris built.scriptandmultiare excluded becausethey manage their own boot flow.
Notes
preloader.init()only whenport.cdc.connectedis false — both existing call sites already do theirown
init(), so re-running it would just close+reopen+re-handshake theUSB pipe for no reason.
--preloader(peek,plstage)is unchanged.