Skip to content

Commit 2b25066

Browse files
LorDClockaNMiccia94
authored andcommitted
Build: Switch to Magisk as the built in root [2/2]
Pretty much identical to DirtyUnicorns/android_build@2871a7b Modified and updated for TWRP 3.0.3-x by @nathanchance Change-Id: Ic0cc0b6e96723a87298edb5cded9f6ef93c05b9d Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
1 parent 1d2522f commit 2b25066

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tools/releasetools/edify_generator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ def ValidateSignatures(self, command):
173173
def RunPersist(self, command):
174174
self.script.append(('run_program("/tmp/install/bin/persist.sh", "%s");' % command))
175175

176+
def FlashMagisk(self):
177+
self.script.append('package_extract_dir("magisk", "/tmp/magisk");')
178+
self.script.append('run_program("/sbin/busybox", "unzip", "/tmp/magisk/magisk.zip", "META-INF/com/google/android/*", "-d", "/tmp/magisk");')
179+
self.script.append('run_program("/sbin/sh", "/tmp/magisk/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/magisk/magisk.zip");')
180+
176181
def ShowProgress(self, frac, dur):
177182
"""Update the progress bar, advancing it over 'frac' over the next
178183
'dur' seconds. 'dur' may be zero to advance it via SetProgress

tools/releasetools/ota_from_target_files.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,14 @@ def output_sink(fn, data):
800800
script.ShowProgress(0.05, 5)
801801
script.WriteRawImage("/boot", "boot.img")
802802

803+
if block_based:
804+
script.Print(" ")
805+
script.Print("Flashing Magisk...")
806+
script.Print(" ")
807+
common.ZipWriteStr(output_zip, "magisk/magisk.zip",
808+
""+input_zip.read("SYSTEM/addon.d/magisk.zip"))
809+
script.FlashMagisk()
810+
script.Print(" ")
803811
script.ShowProgress(0.2, 10)
804812
device_specific.FullOTA_InstallEnd()
805813

0 commit comments

Comments
 (0)