mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 05:37:39 +00:00
Support Samsung 2SI with skip_initramfs in dtb cmdline
Samsung Galaxy A21S and Galaxy M12, probably others, are hdr_v2 boot.img with 2SI judging by the ramdisk contents, but the dtb contains an extra cmdline with skip_initramfs present, even though this shouldn't exist on 2SI and the kernel apparently doesn't even contain a skip_initramfs function I can't find examples of other devices where skip_initramfs is present in the dtb other than these so patch it out like we do the kernel Co-authored-by: topjohnwu <topjohnwu@gmail.com>
This commit is contained in:
parent
6663fd3526
commit
59161efd08
@ -141,8 +141,22 @@ static bool dtb_patch(const char *file) {
|
||||
fdt = static_cast<uint8_t*>(memmem(fdt, end - fdt, DTB_MAGIC, sizeof(fdt32_t)));
|
||||
if (fdt == nullptr)
|
||||
break;
|
||||
int node;
|
||||
// Patch the chosen node for bootargs
|
||||
fdt_for_each_subnode(node, fdt, 0) {
|
||||
if (fdt_get_name(fdt, node, nullptr) != "chosen"sv)
|
||||
continue;
|
||||
int len;
|
||||
if (char *value = (char *) fdt_getprop(fdt, node, "bootargs", &len)) {
|
||||
if (char *skip = strstr(value, "skip_initramfs")) {
|
||||
fprintf(stderr, "Patch [skip_initramfs] -> [want_initramfs]\n");
|
||||
// Don't use strcpy, we do NOT want it null terminated
|
||||
memcpy(skip, "want", 4);
|
||||
patched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (int fstab = find_fstab(fdt); fstab >= 0) {
|
||||
int node;
|
||||
fdt_for_each_subnode(node, fdt, fstab) {
|
||||
if (!keep_verity) {
|
||||
int len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user