[ GUIDE ] [ ANDROID 10 ROOT ] [ HOW TO ] Patching Boot.img with Magisk

gatharot

Member
Oct 31, 2016
34
25
0
Back here! So.. I actually got impatient and tried my luck to save the extra step of reinstalling Magisk after update and rebooting. There is already too many threads opened for updating in android 10 so this slightly specific way too update will be left here for your eyes only. Here goes...

Monthly update w/o losing root (for those ignored, like me, by OTA notifications):

Requirements :
- an already rooted device with Magisk Manager
- magisk modules known for causing bootloops uninstalled (active edge for instance)
- a plugged-in device on 'File transfer/Android Auto' and with USB debugging enabled
- the latest and greatest adb/fastboot binaries, get them there : https://developer.android.com/studio/releases/platform-tools#downloads
- a fresh backup of your system or a pair of eyes to cry if anything goes awry

1- Download latest image file from https://developers.google.com/android/images
2- Unzip the contents of the zip into your folder of choice (some might say the abd/fastboot folder though it works anywhere)
3- Unzip the boot.img from the inner archive (for march 20 update: `image-blueline-qq2a.200305.002.zip`)
4- Copy the boot image to your phone, then in Magisk Manager press Install > Install > Select and patch file > boot.img
5- Once Magisk is done patching, get the resulting magisk_patched.img back to your updating folder. If you cannot find it use the following command: `adb pull /sdcard/Download/magisk_patched.img` (*)

Interlude - Your folder should look like this:
.
├── blueline-qq2a.200305.002-factory-d7814508
│ └── blueline-qq2a.200305.002
│ ├── boot.img
│ ├── bootloader-blueline-b1c1-0.2-6085603.img
│ ├── flash-all.bat
│ ├── flash-all.sh
│ ├── flash-base.sh
│ ├── image-blueline-qq2a.200305.002.zip
│ ├── magisk_patched.img
│ └── radio-blueline-g845-00096-200114-b-6134206.img
└─── blueline-qq2a.200305.002-factory-d7814508.zip

Now back to the fun parts.

6- Rename magisk_patched.img to boot.img. Delete the original one, it has served its purpose
7- Update the inner archive boot.img to the patched one
8- Open the flash-all.sh/flash-all.bat depending on your OS and remove the '-w' from the `fastboot -w update image-blueline-<your_latest_image>.zip` line. This is what wipes your phone clean, so make sure to save the file once modified.
9- Double check requirements #2 and #3.
10- Run the command: `adb reboot bootloader` (*)
11- Run your modified flash-all script.

Hopefully, you are done and your phone is up-to-date and still rooted.

12- Reinstall your magisk modules, you missed them too much already.

(*) If you get an error here, try running it from the adb/fastboot folder.
 

codygs83

Senior Member
Feb 23, 2011
660
189
43
southeast TEXAS
Has anyone had problems running Tasker or modifying system files? Magisk shows I'm rooted. It grants permissions when I run the apps. But Tasker fails to run commands and file explorer fails to modify system files. Am I missing something?
Flashed patched IMG with no problems. Magisk shows I'm all good. I dunno what else I missed. ?*♂
 

codygs83

Senior Member
Feb 23, 2011
660
189
43
southeast TEXAS
Normally it is flashed only to the slot that will be booted next. If you are having boot problems, sometimes flashing both slots will resolve the problem.

https://topjohnwu.github.io/Magisk/install.html
Yeah not so much boot problems, but root problems. Can't use Tasker or write to storage. Magisk shows I'm rooted. And grants the apps permissions. But still no root access when using apps
 

SilvrDrgn

Senior Member
Jul 10, 2014
50
12
0
Dirty flash of March image over working rooted Feb image fails

My Pixel 3 is already at Android 10 with Feb updates and rooted with Magisk. Trying to dirty flash the March image. Log from my command prompt is attached in "flash_failed.txt" file. At the point of the "extracting super_empty.img (0 MB) to disk... took 0.000s Rebooting into fastboot OKAY [ 0.057s]", the device does reboot, but it reboots into a "fastbootd" screen that I have seen before, but it doesn't appear to be the correct screen/mode for the phone to be in for the flashing to continue to work properly. That fastbootd screen has a volume up/down menu on it with reboot system, enter recovery, reboot to bootloader , and power off options. Anyone else get this issue? How do I get through this?
 

Attachments

dcarvil

Senior Member
Apr 20, 2016
331
112
43
My Pixel 3 is already at Android 10 with Feb updates and rooted with Magisk. Trying to dirty flash the March image. Log from my command prompt is attached in "flash_failed.txt" file. At the point of the "extracting super_empty.img (0 MB) to disk... took 0.000s Rebooting into fastboot OKAY [ 0.057s]", the device does reboot, but it reboots into a "fastbootd" screen that I have seen before, but it doesn't appear to be the correct screen/mode for the phone to be in for the flashing to continue to work properly. That fastbootd screen has a volume up/down menu on it with reboot system, enter recovery, reboot to bootloader , and power off options. Anyone else get this issue? How do I get through this?
What type PC are you using to do the flashing? I have those same symptoms trying to flash from a Linux container on my Pixelbook. Linux looses the USB connection when the Pixel reboots, which causes the Pixel to reboot into the fastbootd screen. Try a different PC. Also make sure you have the latest platform tools. https://developer.android.com/studio/releases/platform-tools
 
  • Like
Reactions: ngelee

SilvrDrgn

Senior Member
Jul 10, 2014
50
12
0
What type PC are you using to do the flashing? I have those same symptoms trying to flash from a Linux container on my Pixelbook. Linux looses the USB connection when the Pixel reboots, which causes the Pixel to reboot into the fastbootd screen. Try a different PC. Also make sure you have the latest platform tools. https://developer.android.com/studio/releases/platform-tools
I'm using a Win-DOHS 10 Home laptop, and I do have the latest platform tools installed. I downloaded fresh copy of those right before I attempted all this. Win-DOHS makes it's usual beeping noise during the Pixel 3 reboots as the USB connection goes away and comes back. The USB connection definitely comes back during the "extracting product.img (1984 MB) to disk... took 12.009s" step and before it actually tried to send the product image.
 

dcarvil

Senior Member
Apr 20, 2016
331
112
43
I'm using a Win-DOHS 10 Home laptop, and I do have the latest platform tools installed. I downloaded fresh copy of those right before I attempted all this. Win-DOHS makes it's usual beeping noise during the Pixel 3 reboots as the USB connection goes away and comes back. The USB connection definitely comes back during the "extracting product.img (1984 MB) to disk... took 12.009s" step and before it actually tried to send the product image.
If you can't try from another PC, try to sideload the image. This thread concerns a similiar problem (with a chromebook) that was resolved by sideloading it. https://forum.xda-developers.com/pixel-3/how-to/please-help-flashing-incomplete-t4070059

If nothing else works, you can boot Linux from a USB stick and flash from it. I've had good luck with this https://forum.xda-developers.com/an.../live-iso-adb-fastboot-driver-issues-t3526755
I don't know how recent their platform tools are, so you may need to update platform tools first.
 

SilvrDrgn

Senior Member
Jul 10, 2014
50
12
0
If you can't try from another PC, try to sideload the image. This thread concerns a similiar problem (with a chromebook) that was resolved by sideloading it. https://forum.xda-developers.com/pixel-3/how-to/please-help-flashing-incomplete-t4070059

If nothing else works, you can boot Linux from a USB stick and flash from it. I've had good luck with this https://forum.xda-developers.com/an.../live-iso-adb-fastboot-driver-issues-t3526755
I don't know how recent their platform tools are, so you may need to update platform tools first.
Tried sideload, but kept getting invalid footer error. Tried USB stick, but it wouldn't boot. So, last resort - another Win-DOHS machine. Man, Win-DOHS really does suck. I tried it on another Win-DOHS machine (one that had never had my Pixel 3 connected to it before), ran the flash and it worked fine. So, I suspect it's something to do with the Pixel 3 USB drivers on the machine that has the issues. Thanks for the suggestions. Any idea how to get the Pixel 3 USB drivers updated on my machine that has issues?
 

dcarvil

Senior Member
Apr 20, 2016
331
112
43
Tried sideload, but kept getting invalid footer error. Tried USB stick, but it wouldn't boot. So, last resort - another Win-DOHS machine. Man, Win-DOHS really does suck. I tried it on another Win-DOHS machine (one that had never had my Pixel 3 connected to it before), ran the flash and it worked fine. So, I suspect it's something to do with the Pixel 3 USB drivers on the machine that has the issues. Thanks for the suggestions. Any idea how to get the Pixel 3 USB drivers updated on my machine that has issues?
Sorry, I quit using Windows over a decade ago. Google "allintext: adb windows driver", and you'll find plenty of suggestions. Beware of downloading drivers from a flaky site, though. That's a good way to get malware.

I don't know what Win-DOHS is, but if you have a government/corporate issued laptop there are likely security restrictions on use of the USB port.
 

SilvrDrgn

Senior Member
Jul 10, 2014
50
12
0
Sorry, I quit using Windows over a decade ago. Google "allintext: adb windows driver", and you'll find plenty of suggestions. Beware of downloading drivers from a flaky site, though. That's a good way to get malware.

I don't know what Win-DOHS is, but if you have a government/corporate issued laptop there are likely security restrictions on use of the USB port.
OK, no worries. Thanks for your help.

Regarding "Win-DOHS" have you ever seen the animated TV series "The Simpsons?" Win-DOHS is my take on Homer Simpson saying "DOH!" all the time, because Windows makes me say "DOH!" all the time. :)
 

dcarvil

Senior Member
Apr 20, 2016
331
112
43
OK, no worries. Thanks for your help.

Regarding "Win-DOHS" have you ever seen the animated TV series "The Simpsons?" Win-DOHS is my take on Homer Simpson saying "DOH!" all the time, because Windows makes me say "DOH!" all the time. :)
That's exactly why I quit using Windows. :laugh: Linux is much less irritating.
 

djetouch

New member
Mar 23, 2019
2
0
0
Hey guys i'm new on Android ! So i need your help ..
(Pixel 3 on Android 10)
I followed the guide, i have magisk installed and i think i'm rooted ! But when I've installed my first module i have to reboot and when i opening magisk again, it was not installed (20.4 stable) ...
I try to reinstall everything again and it's working but when i reboot it seems magisk is not installed !

It's normal ? I mean you need to do this everytime you rebooting your phone ?!

Thanks for the guide btw i hope someone can help me !