-3

How can i modify the boot.img files so that when the power button and volume + is pressed during startup it doesnt start recovery but instead starts fastboot?

P.S I can unpack the boot.img

  • I am not 100% sure but from my understanding those key combinations are checked before boot.img is ever called. Hence these keys are checked by the bootloader which runs before boot.img. Therefore by modifying boot.img you will not be able to change the keys to press or which mode to start. – Robert Sep 15 at 16:16
  • Key preases during boot are not handled by boot.img (ramdisk and kernel), but by bootloader (ABOOT, ABL or equivalent) which hosts fastboot protocol as well. Bootloader starts main OS (kernel from boot.img) or recovery (kernel from recovery.img) or fastboot, depending on key combination or file/bits in cache / misc partitions. However you can modify recovery.img to make the kernel/init run a program (even a shell script) which reads key combination and restarts device to fastboot. – Irfan Latif Sep 15 at 16:26
  • I'll again suggest you read my threads or other internet resources on Android partitions and filesystems and boot process so that you don't have to ask very basic questions. – Irfan Latif Sep 15 at 16:33
  • The problem im having is that when i hold power button and volume +, the device is starting up factory mode instead of recovery mode, so is there anything i can do so it doesnt start factory mode? I see this in my preloader file prnt.sc/uhufvg and prnt.sc/uhugwz – Dinesh Gami Sep 15 at 18:26
  • Rebuild preloader the way you want it. – Irfan Latif Sep 15 at 19:07
-3

The preloader is fetching from hrawork10/hra_huangxj/mt8788_v9.0_G26/P08765_git/vendor/mediatek/proprietary/bootable/bootloader/preloader/platform/mt6771/src/core/main.c as shown in your screenshot which is holding the variable which decides as to whether it should boot factory mode when you hold the power and volume up buttons or not.

Do not try to rebuild your preloader and flash it otherwise you may end up with a nice brick.

| improve this answer | |
New contributor
Jitesh Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Irfan Latif is incorrect in that you should rebuild the preloader. – Jitesh Kumar Sep 16 at 9:10
  • Sir you are supposed to answer the question, not my comments. I know that compiling bootloaders and playing with low level things is not an ordinary user does, but if you have a better solution please put it forward so that OP and future visitors can benefit. And btw, if source code is available and binary isn't signed with OEM's private keys, why one should not build the preloader? What's the restricting factor? Instead of giving advice or opinion, better back your answers with technical reasons (not just the expected risks). I'd love to learn from you. Thanks. – Irfan Latif Sep 16 at 10:21
  • Given that he has a Mediatek device , where the preloader binary is closed source, its not possible for him to change the factory boot settings so that it starts recovery mode, from the preloader. Also as shown in his screenshot, the preloader is building the code from src/core/main.c, thus to change the factory boot settings that is where the changes should be made. – Jitesh Kumar Sep 16 at 10:45
  • When I say "Rebuild preloader the way you want it." but the source code is not available (as is the case with mostly bootloaders for Android devices), it's obvious that OP is asking for something impossible, or at least something that he/she cannot handle technically. So it doesn't need a warning "Do not try to rebuild your preloader". // I still wonder how your answer addresses the question. This is a Q&A site where you answer the question to partially or completely solve OP's problem. But as I said, you answered my comment, not OP's question. You may edit it to make helpful for OP. – Irfan Latif Sep 16 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.