Revert DTB patches to in-place binary patches

Since we no longer need to add new properties in the device tree, and
all the patches we do removes strings, we can just directly patch
the flat device tree in-place, ignoring basically all the higher level
DTB structure and format to accomplish 100% compatibility.
This commit is contained in:
topjohnwu
2020-05-05 01:03:09 -07:00
parent dbf8c41209
commit 02dc1172be
5 changed files with 335 additions and 312 deletions

View File

@@ -55,7 +55,7 @@ void magisk_cpio::patch() {
if (!keepverity) {
if (fstab) {
fprintf(stderr, "Found fstab file [%s]\n", cur->first.data());
patch_verity(cur->second->data, cur->second->filesize, true);
cur->second->filesize = patch_verity(cur->second->data, cur->second->filesize);
} else if (cur->first == "verity_key") {
rm(cur);
continue;
@@ -63,7 +63,7 @@ void magisk_cpio::patch() {
}
if (!keepforceencrypt) {
if (fstab) {
patch_encryption(cur->second->data, cur->second->filesize);
cur->second->filesize = patch_encryption(cur->second->data, cur->second->filesize);
}
}
}