[KERNEL][3.40][DM2] XPERIA M2 MagiskHide working kernel


Jul 20, 2011
#include <std_disclaimer.h>
* Your warranty is now void.
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this ROM
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.

Finally I managed to build mount namespace enabled(required by MagiskHide) kernel for Sony Xperia M2.

I applied patch to the original kernel source code(available on Sony website), version 3.40(18.6.A.0.182)

So you don't need kernel 3.8+ for using MagiskHide

This kernel tested on D2302 device.

3.40 - 18.6.A.0.182

  • mount namespace(required by MagiskHide)
  • kernel configuration is available in /proc/config.gz
  • boot image format is AOSP, so there is no need to use Boot Bridge for flashing Magisk

  • Ubuntu 14.04
  • gcc 4.7
  • mkqcdtbootimg (for building flashable boot image)
  • Flashtool (for extracting kernel.elf from original .FTF)
  • Android Image Kitchen 3.6 (for extracting ramdisk and cmdline from original kernel image)
  • TWRP 3.1.0-0
  • Magisk 20.3 (20300)
  • Magisk Manager 7.5.1 (267)


  1. Ensure device ROM version is 18.6.A.0.182 or based on that or has same working kernel
  2. Download .img file
  3. Power off device
  4. Press Vol+
  5. Hold Vol+ and connect device to your computer using USB cable
  6. Device will boot in fastboot mode(verify that notification light color is blue)
  7. run "fastboot devices" to ensure device is connected (fastboot print device serial number)
  8. run "fastboot flash boot DM2-V0100-D2302-boot.img"
  9. Ensure no error is occured during flash
  10. run "fastboot reboot" to restarting device
  11. After boot up check kernel version in Setting->About
  12. Magisk can be flashed using TWRP

If MagsikHide not worked :
  • turn off and then on again MagiskHide in MagiskManager->Seetings
  • Hide Magisk Manager using "Magisk Manager->Settings->Hide Magisk Manager"

If you encounter bootloop or other kernel related problem:
  1. Don't worry
  2. Download original ROM 18.6.A.0.182 using XperiFirm or newer version of Flashtool bundled with XperiFirm
  3. Install and Run Flashtool used version)
  4. Click on "Flash Device" button in toolbar
  5. Select "Flashmode" in "Bootmode chooser" window
  6. Select downloaded ROM in left panel
  7. Exclude eveything in right panel except KERNEL
  8. Uncheck all WIPE options
  9. Don't change other settings
  10. Click "Flash" button and follow flash process


XDA:DevDB Information
DM2 - MagiskHide working kernel 3.40, Kernel for the Sony Xperia M2

Kernel Special Features: MagiskHide working patched kernel 18.6.A.0.182

Version Information
Status: Stable
Current Stable Version: 1.0
Stable Release Date: 2020-03-11

Created 2020-03-10
Last Updated 2020-03-12


Last edited: