Tools needed: boot.img extractor. I recommend the one created by osm0sis from this thread:
https://forum.xda-developers.com/showthread.php?t=2073775
The first method was developed by osm0sis and removes magisk and all modules.
1. Unpack magisk_patched.img
2. Unzip overlay.dremove1.zip and place overlay.d folder in ramdisk folder.
3. Repack IMG
4. fastboot boot image-new.img created by repacking 8mg
This method is an offshoot of osm0sis version but boots core-only mode. Afterwards, remove the .disable-magisk file from the /cache folder for modules to work. Dot files are hidden files so if your root explorer can't see hidden files, run the "Remove disable_magisk" bat file in ADB.
1. Same as above but use the overlay.dcoreonly1.zip
For both methods you must be rooted for it to work. These are not cure all's for all bootloops.
Remove .disable_magisk bat file
https://www.androidfilehost.com/?fid=4349826312261684994
****************************************
Here is a fastboot bootable image to boot you into Magisk core-only mode, in case you bootloop due to flashing a bad module, in fastboot:
You will boot with root but modules disabled. After you remove the offending module you will need to go to /cache folder and delete the .disable_magisk file before your modules will work.
Once in fastboot:
fastboot boot image-newpixel3axl.img
You will boot with root but modules disabled. After you remove the offending module you will need to go to /cache folder and delete the .disable_magisk file before your modules will work.
fastboot boot image-newpixel3axlRemove.img
This one should remove magisk and all modules, then reboot and magisk should reinstall itself (ask to install necessary binaries). This is what osm0sis uses to recover from failed flashes. See this post:
https://forum.xda-developers.com/pi...odules-disabler-booting-magisk-t3976625/page2
Images are in this common folder. Pick the appropriate image for your phone.
6-4-20
https://www.androidfilehost.com/?w=files&flid=313291
Ohboy this is helpful. Just out of curiosity, how does one create a magisk patched boot image with core-only mode enabled? I would like to be able to make my own every time a new security patch is out.
Sent from my Google Pixel 3a XL using XDA Labs
Skittles9823 said:
Ohboy this is helpful. Just out of curiosity, how does one create a magisk patched boot image with core-only mode enabled? I would like to be able to make my own every time a new security patch is out.
Sent from my Google Pixel 3a XL using XDA Labs
Click to expand...
Click to collapse
I had planned on keeping these updated but here are the instructions.
You have to build your own copy of magisk from GitHub.
Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:
Approx line 667
If (access(DISABLEFILE, F_ok) ==0)
Change == to !=
Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.
Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.
Tulsadiver said:
I had planned on keeping these updated but here are the instructions.
You have to build your own copy of magisk from GitHub.
Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:
Approx line 667
If (access(DISABLEFILE, F_ok) ==0)
Change == to !=
Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.
Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.
Click to expand...
Click to collapse
Nice. Seems easy enough, if you ever disappear and stop updating images for some reason I'll give it a go ?
Sent from my Google Pixel 3a XL using XDA Labs
Hello
I have regular 3a with Android 10 installed, no twrp. I was in bootloop due to some module and was looking for solution to disable modules with only fastboot.
Before I found this thread, I went and reflash to stock.
Now I know.
Thanks for sharing this.
Tulsadiver said:
I had planned on keeping these updated but here are the instructions.
You have to build your own copy of magisk from GitHub.
Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:
Approx line 667
If (access(DISABLEFILE, F_ok) ==0)
Change == to !=
Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.
Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.
Click to expand...
Click to collapse
I tried to do this for a Pixel 4 XL but the resulting boot image errors with "error boot prepare"
gudenau said:
I tried to do this for a Pixel 4 XL but the resulting boot image errors with "error boot prepare"
Click to expand...
Click to collapse
I have these already made for the pixel 4 xl on the pixel 4 xl forum.
Should just make an AK3 zip that pushes the init from this boot.img into any boot partition, so will work universally.
osm0sis said:
Should just make an AK3 zip that pushes the init from this boot.img into any boot partition, so will work universally.
Click to expand...
Click to collapse
Ooft.
Wait, can you flash that through adb though?
Sent from my Google Pixel 3a XL using XDA Labs
Skittles9823 said:
Ooft.
Wait, can you flash that through adb though?
Click to expand...
Click to collapse
Hmm.. true, non-working recovery is a definite problem. I'm in that boat right now on my OnePlus 7T, which is how I came across this thread.
Okay, better idea. Instead of mucking around with recompiling magiskinit for the above, just do it via boot script in overlay.d
osm0sis said:
Hmm.. true, non-working recovery is a definite problem. I'm in that boat right now on my OnePlus 7T, which is how I came across this thread.
Okay, better idea. Instead of mucking around with recompiling magiskinit for the above, just do it via boot script in overlay.d
Click to expand...
Click to collapse
Tbh, a custom boot.img is the only way to recover in some situations. Like if you can't boot into an adb environment or if you've never granted adb she'll root access.
Sent from my Google Pixel 3a XL using XDA Labs
Skittles9823 said:
Tbh, a custom boot.img is the only way to recover in some situations. Like if you can't boot into an adb environment or if you've never granted adb she'll root access.
Click to expand...
Click to collapse
Exactly, so a custom boot.img using overlay.d is the easiest way to accomplish that currently.
osm0sis said:
Exactly, so a custom boot.img using overlay.d is the easiest way to accomplish that currently.
Click to expand...
Click to collapse
How would one do that exactly without being able to use adb shell?
Sent from my Google Pixel 3a XL using XDA Labs
Skittles9823 said:
How would one do that exactly without being able to use adb shell?
Click to expand...
Click to collapse
overlay.d is built into the boot.img, so you take your latest magisk_patched.img, patch it with the overlay.d scripts to have the desired effect, then repack and flash via fastboot.
Same as the OP likely did, but no need to build Magisk to get a modified magiskinit, since you can do it all via boot script, like I said.
If anyone wants to experiment with this idea, here's the basic setup I used for my boot.img to fully reset the /data/adb directory for the soft brick issue (related to a magisk.db failure) I was seeing in the last canary.
Unpack the current magisk_patched.img for your device using my Android Image Kitchen (AIK) project, then create:
ramdisk/overlay.d/init.resetmagisk.rc:
Code:
on post-fs-data
exec u:r:magisk:s0 root root -- /sbin/init.resetmagisk.sh
ramdisk/overlay.d/sbin/init.resetmagisk.sh:
Code:
#!/system/bin/sh
rm -rf /data/adb/* && reboot
So, pretty simple stuff, and I'm sure it could be applied to some sort of Core Only workaround until @topjohnwu decides what he wants to do with all those Core Only boot.img Pull Requests.
osm0sis said:
overlay.d is built into the boot.img, so you take your latest magisk_patched.img, patch it with the overlay.d scripts to have the desired effect, then repack and flash via fastboot.
Same as the OP likely did, but no need to build Magisk to get a modified magiskinit, since you can do it all via boot script, like I said.
Click to expand...
Click to collapse
Cool. What I did was modify the magisk native/jini/core/bootstages.cpp
Edit: yes sir, your method works great to remove magisk and all modules. The method I had gives you the option to just remove the offending module, though sometimes you have to remove everything anyway. Thank you for your awsome input. If it is okay with you, I'd like to offer both methods in my posts on the pixel forums.
Tulsadiver said:
Cool. What I did was modify the magisk native/jini/core/bootstages.cpp
Edit: yes sir, your method works great to remove magisk and all modules. The method I had gives you the option to just remove the offending module, though sometimes you have to remove everything anyway. Thank you for your awsome input. If it is okay with you, I'd like to offer both methods in my posts on the pixel forums.
Click to expand...
Click to collapse
Sure! You could modify my method to remove all modules by running `magisk --remove-modules` instead of my `rm -rf` command (or just changing the `rm -rf` target), or even try to force Core Only mode by changing the setting directly in magisk.db then rebooting. It's a root shell so pretty much sky's the limit.
osm0sis said:
Sure! You could modify my method to remove all modules by running `magisk --remove-modules` instead of my `rm -rf` command (or just changing the `rm -rf` target), or even try to force Core Only mode by changing the setting directly in magisk.db then rebooting. It's a root shell so pretty much sky's the limit.
Click to expand...
Click to collapse
I have tried multiple methods from this thread but with no success.. Could you maybe help me by altering this boot.img to disable/remove all Magisk modules? Or maybe make it boot core only? It's for my OP 7T. Thanks!
https://mega.nz/#F!rxYDyQia!ziPLPvRsu3kxNBGt694OEQ
paplo said:
I have tried multiple methods from this thread but with no success.. Could you maybe help me by altering this boot.img to disable/remove all Magisk modules? Or maybe make it boot core only? It's for my OP 7T. Thanks!
https://mega.nz/#F!rxYDyQia!ziPLPvRsu3kxNBGt694OEQ
Click to expand...
Click to collapse
If `adb shell magisk --remove-modules` didn't fix the issue for you then you might be in the same boat I was and need to nuke all of Magisk's files in /data/adb.
Getting off topic for a Pixel thread, but here's the OnePlus 7T (hotdogb) image I made following my own instructions.
It's with an older Canary of Magisk so once you get it booting you should update to the latest Canary immediately.
osm0sis said:
If `adb shell magisk --remove-modules` didn't fix the issue for you then you might be in the same boat I was and need to nuke all of Magisk's files in /data/adb.
Getting off topic for a Pixel thread, but here's the OnePlus 7T (hotdogb) image I made following my own instructions.
It's with an older Canary of Magisk so once you get it booting you should update to the latest Canary immediately.
Click to expand...
Click to collapse
Yeah off topic I know.. Just spotted you had been in the same pickle with the same phone as me. I worked like a charm! Thanks!
I am trying to root my tecno f1 pro with magisk manager soon i was flashing the magisk_patched.img renamed boot.img i got an error
code:
C:\Program Files\platform-tools>fastboot flash boot boot.img
fastboot: error: boot partition is smaller than boot image
How can I fix this?
Re-partition Android of your phone so the boot.img fits.
jwoegerbauer said:
Re-partition Android of your phone so the boot.img fits.
Click to expand...
Click to collapse
How do I do that? My boot partition is 233kb and my Magisk patched image is 32mb.
Beelzebub6 said:
How do I do that? My boot partition is 233kb and my Magisk patched image is 32mb.
Click to expand...
Click to collapse
You have a wrong file patched. Normally the patched file can with 10MB or more.
Since you wrote the patched file have ONLY 233KB so never you can flash that!
DragonPitbull said:
You have a wrong file patched. Normally the patched file can with 10MB or more.
Since you wrote the patched file have ONLY 233KB so never you can flash that!
Click to expand...
Click to collapse
lol, my phone has updated since then, your right.
But then I downloaded my new stock rom which is android 11 and tried to continue with that but it still says the boot partition is too small. How would I re-partition so then my patched file can fit?
And also the original boot file straight outta boot.img.lz4 is 32.0mb same as patched but inside the .lz4 file it says that it is 16 bytes, should I worry about that?
Beelzebub6 said:
lol, my phone has updated since then, your right.
But then I downloaded my new stock rom which is android 11 and tried to continue with that but it still says the boot partition is too small. How would I re-partition so then my patched file can fit?
And also the original boot file straight outta boot.img.lz4 is 32.0mb same as patched but inside the .lz4 file it says that it is 16 bytes, should I worry about that?
Click to expand...
Click to collapse
I think thats just compression saying that but if u need try backup the boot partition via another method
Hey folks,
I have rooted (magisk) OnePlus 8 phone with Android 11, w/o TWRP recovery. I'm trying to replace kernel with one of blue_spark, here's what I'm doing
1. Download zip file from https://github.com/engstk/op8/releases/tag/r112
2. Extract and unpack Image.gz
3. Unpack Magisk patched boot.img to /tmp (magiskboot unpack boot.img)
4. Replace kernel with unpacked Image (cp Image /tmp/kernel)
5. Repack boot.img (magiskboot repack boot.img boot-new.img)
6. Boot with boot-new.img (fastboot boot boot-new.img)
And here is when I'm getting into "QUALCOMM CrashDump Mode"
The same result if I build kernel from sources. Repacking boot.img with original kernel works, so problem is unlikely in magiskboot.
I'm trying to figure out the problem, but without kernel logs it's troublesome. Any ideas?
Thanks.
Hm... It looks like, I also have to update DTB. After that device boots successfully. Seems a bit strange to me. What's the difference in supported devices between blu_spark and stock kernel?
Ok, turned out AVB was enabled in the original device tree:
fsmgr_flags = "wait,slotselect,avb";
Switching it off fixes boot process.
It was modified from latest stock kernel of WearOS 2.
Features:
[OC] Overclocked to 1.8Ghz
[Magisk] Magisk v23.0 pre-installed
How To Use :
Reboot to fastboot
You are supposed to try it first in order to make sure it is suitable to your system by using
Code:
fastboot boot boot.img
If your test is passed, you could input the command below to flash it
Code:
fastboot flash boot boot.img
Enjoy
Download Link: MEGA
Cannot get it to work on my W200, stuck on LG logo and heating up considerably
Xspeed said:
Cannot get it to work on my W200, stuck on LG logo and heating up considerably
Click to expand...
Click to collapse
Sorry for having forgotten that the fstab in the ramdisk was modified in order to support the system partition which had been formatted to ext4 by myself.
You could use magiskboot to edit the boot.img by yourself. Just replace the kernel and kernel_dtb by the one unpacked from the stock boot.img and then repack the image file.
Prebuilt magiskboot can be checked here: https://github.com/TeamWin/external_magisk-prebuilt/tree/android-11/prebuilt
If available, I will reupload the correct version in several month.
Hello,
I'm just diving into Android stuff, and I'm going through Magisk stuff to understand more about it.
When I use magiskboot unpack boot.img of pixel 6a, it only gives me a kernel file. Is it normal for a stock boot.img to not to contain ramdisk.cpio?
I was under the assumption that it essentially tells the device what files to load and whatnot. If it doesn't contain the ramdisk.cpio, how does the device work when I just fastboot flash boot boot.img? Is there ramdisk.cpio already on the device?
Thanks!
drunk_santa said:
Hello,
I'm just diving into Android stuff, and I'm going through Magisk stuff to understand more about it.
When I use magiskboot unpack boot.img of pixel 6a, it only gives me a kernel file. Is it normal for a stock boot.img to not to contain ramdisk.cpio?
I was under the assumption that it essentially tells the device what files to load and whatnot. If it doesn't contain the ramdisk.cpio, how does the device work when I just fastboot flash boot boot.img? Is there ramdisk.cpio already on the device?
Thanks!
Click to expand...
Click to collapse
drunk_santa said:
Hello,
I'm just diving into Android stuff, and I'm going through Magisk stuff to understand more about it.
When I use magiskboot unpack boot.img of pixel 6a, it only gives me a kernel file. Is it normal for a stock boot.img to not to contain ramdisk.cpio?
I was under the assumption that it essentially tells the device what files to load and whatnot. If it doesn't contain the ramdisk.cpio, how does the device work when I just fastboot flash boot boot.img? Is there ramdisk.cpio already on the device?
Thanks!
Click to expand...
Click to collapse
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com