mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Small changes in DTB code
This commit is contained in:
parent
abbd2e6b72
commit
21099eabfa
@ -116,6 +116,7 @@ static void dtb_print(const char *file, bool fstab) {
|
|||||||
print_node(fdt);
|
print_node(fdt);
|
||||||
}
|
}
|
||||||
++dtb_num;
|
++dtb_num;
|
||||||
|
i += fdt_totalsize(fdt) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
@ -140,6 +141,8 @@ static void dtb_patch(const char *in, const char *out) {
|
|||||||
memcpy(fdt, dtb + i, len);
|
memcpy(fdt, dtb + i, len);
|
||||||
if (redirect)
|
if (redirect)
|
||||||
fdt_open_into(fdt, fdt, len + 256);
|
fdt_open_into(fdt, fdt, len + 256);
|
||||||
|
fdt_list.push_back(fdt);
|
||||||
|
i += len - 1;
|
||||||
|
|
||||||
int fstab = find_fstab(fdt);
|
int fstab = find_fstab(fdt);
|
||||||
if (fstab < 0)
|
if (fstab < 0)
|
||||||
@ -165,17 +168,17 @@ static void dtb_patch(const char *in, const char *out) {
|
|||||||
fdt_setprop_string(fdt, block, "mnt_point", "/system_root");
|
fdt_setprop_string(fdt, block, "mnt_point", "/system_root");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fdt_list.push_back(fdt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
munmap(dtb, dtb_sz);
|
munmap(dtb, dtb_sz);
|
||||||
if (modified) {
|
if (modified) {
|
||||||
if (!out)
|
if (!out)
|
||||||
out = in;
|
out = in;
|
||||||
int fd = xopen(out, O_WRONLY | O_CREAT | O_CLOEXEC);
|
int fd = xopen(out, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
|
||||||
for (auto fdt : fdt_list) {
|
for (auto fdt : fdt_list) {
|
||||||
fdt_pack(fdt);
|
fdt_pack(fdt);
|
||||||
xwrite(fd, fdt, fdt_totalsize(fdt));
|
xwrite(fd, fdt, fdt_totalsize(fdt));
|
||||||
|
free(fdt);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user