Magisk is a suite of open source tools for customizing Android, supporting devices higher than Android 4.2. It covers fundamental parts of Android customization: root, boot scripts, SELinux patches, AVB2.0 / dm-verity / forceencrypt removals etc.
It was created by and is maintained by John Wo. For the latest release always check the GitHub Releases of Magisk
The aim of this repository is simply to integrate Magisk into the build process of AOSP.
- Extract
addon.d.sh
from the archive. This is needed to have a source file the AOSP build process can use. This is the Magisk addon survival script and will later be copied tosystem/addon.d/99-magisk.sh
. - Everything else needs to be performed at the end of the build process (Work in progress)
- Extract
magiskboot
for the host architecture into theintermediates
folder and set the permissions to755
. This is the file needed for modifying the boot image. - Extract
magiskinit
,magisk32
andmagisk64
for the target architecture into theintermediates
folder. These are the ones that are actually put into the boot image. - Extract
boot_patch.sh
andutil_functions.sh
into theintermediates
folder and set the permissions to755
. These are the script files that will modify the boot image. - The shebang (#!) from
boot_patch.sh
needs to be remove otherwise the script won't run. - Also the script needs the correct output device so
export OUTFD="1"
is being set. - Now the script can be executed with
boot_patch.sh boot.img
. - The file
new-boot.img
is being created and then copied back asboot.img
into the out directory.
Add the following to the manifest-tag in your roomservice.xml
<project name="ADeadTrousers/android_vendor_magisk" path="vendor/magisk" remote="github" revision="master" />
Add the following to your device.mk
PRODUCT_PACKAGES += \
99-magisk
- Currently I can't find any way to schedule the build AFTER the building of boot.img. So you've to run your build twice in order get magisk integrated for sure.
- The modified boot.img doesn't get automatically integrated into the final zip. Maybe the packing process uses the information from the "intermediates" folder.
- John Wo for creating Magisk.
- Geofferey Eakins whom I got this idea from.