mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Fix header when repack from ELF
This commit is contained in:
parent
0d51997e46
commit
ecaafd1b70
@ -183,7 +183,8 @@ static void parse_elf() {
|
|||||||
// Reset boot image header
|
// Reset boot image header
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
|
|
||||||
// Hardcode pagesize
|
// Hardcode header magic and pagesize
|
||||||
|
memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE);
|
||||||
hdr.page_size = 4096;
|
hdr.page_size = 4096;
|
||||||
|
|
||||||
switch(base[EI_CLASS]) {
|
switch(base[EI_CLASS]) {
|
||||||
@ -296,11 +297,12 @@ void parse_img(unsigned char *orig, size_t size) {
|
|||||||
} else if (memcmp(base, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0) {
|
} else if (memcmp(base, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0) {
|
||||||
if (boot_type != CHROMEOS) boot_type = AOSP;
|
if (boot_type != CHROMEOS) boot_type = AOSP;
|
||||||
parse_aosp();
|
parse_aosp();
|
||||||
break;
|
return;
|
||||||
} else if (memcmp(base, ELF_MAGIC, ELF_MAGIC_SIZE) == 0) {
|
} else if (memcmp(base, ELF_MAGIC, ELF_MAGIC_SIZE) == 0) {
|
||||||
boot_type = ELF;
|
boot_type = ELF;
|
||||||
parse_elf();
|
parse_elf();
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
error(1, "No boot image magic found!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user