Skip to content

Commit 3247770

Browse files
committed
remove almost every device from the device tree
Wipe all the compatible strings except for the uarts, and also wipe the device_type and name properties for a few devices that still matches kexts after the wipe. This avoids loading most of the drivers, and gets boot to progress further. This gets the kernel to "Still waiting for root device", but with a 30 second delay during boot since it tries to wait for a nonexistant RTC device (pmu,d2422, which is removed from the device tree)
1 parent 67aa7a5 commit 3247770

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modifydevicetree.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import sys
22
from devicetreefromim4p import *
3+
4+
#removeCompatibles = [b"aic,1", b"pmgr1,t8015", b"wdt,t8015\x00wdt,s5l8960x", b"gpio,t8015\x00gpio,s5l8960x", b"sochot,s5l8955x", b"tempsensor,t8015", b"aes,s8000"]
5+
keepCompatibles = [b"uart-1,samsung", b"D22AP\x00iPhone10,3\x00AppleARM"]
6+
removeNames = [b"wdt", b"backlight"]
7+
removeDeviceTypes = [b"wdt", b"backlight"]
8+
39
# pexpert/pexpert/device_tree.h
410
def u32(a, i):
511
return a[i] | a[i+1] << 8 | a[i+2] << 16 | a[i+3] << 24
@@ -43,6 +49,15 @@ def writeproperty(nodebytes, nodeoffset, nodedepth):
4349
print("Removing display-corner-radius")
4450
nodebytes[nodeoffset:nodeoffset + kPropNameLength] = padStringNull("security-domain")
4551
nodebytes[nodeoffset + ptr:nodeoffset + ptr + proplen] = b"\x00" * proplen
52+
if propname == "compatible" and not nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1] in keepCompatibles:
53+
print("removing compatible for", nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1].decode("ascii"))
54+
nodebytes[nodeoffset+ptr:nodeoffset + ptr + proplen - 1] = b"~" * (proplen - 1)
55+
if propname == "name" and nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1] in removeNames:
56+
print("removing name for", nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1].decode("ascii"))
57+
nodebytes[nodeoffset+ptr] = ord("~")
58+
if propname == "device_type" and nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1] in removeDeviceTypes:
59+
print("removing device type for", nodebytes[nodeoffset+ptr:nodeoffset+ptr+proplen-1].decode("ascii"))
60+
nodebytes[nodeoffset+ptr] = ord("~")
4661
ptr += proplen
4762
ptr = (ptr + 0x3) & ~0x3 #round up to nearest 4
4863
return ptr

0 commit comments

Comments
 (0)