mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-29 01:40:18 +00:00
payload: Consider an IMG4 blob as the end of payloads
When loading m1n1.bin, SEPFW follows m1n1 and thus will show up at the payload offset if there are no payloads. Fixes: #158 Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
88874936c6
commit
fbc15bd77c
1 changed files with 5 additions and 3 deletions
|
@ -20,6 +20,7 @@ static const u8 xz_magic[] = {0xfd, '7', 'z', 'X', 'Z', 0x00};
|
|||
static const u8 fdt_magic[] = {0xd0, 0x0d, 0xfe, 0xed};
|
||||
static const u8 kernel_magic[] = {'A', 'R', 'M', 0x64}; // at 0x38
|
||||
static const u8 cpio_magic[] = {'0', '7', '0', '7', '0'}; // '1' or '2' next
|
||||
static const u8 img4_magic[] = {0x16, 0x04, 'I', 'M', 'G', '4'}; // IA5String 'IMG4'
|
||||
static const u8 empty[] = {0, 0, 0, 0};
|
||||
|
||||
static char expect_compatible[256];
|
||||
|
@ -192,7 +193,8 @@ static void *load_one_payload(void *start, size_t size)
|
|||
return load_kernel(p, size);
|
||||
} else if (check_var(&p)) {
|
||||
return p;
|
||||
} else if (!memcmp(p, empty, sizeof empty)) {
|
||||
} else if (!memcmp(p, empty, sizeof empty) ||
|
||||
!memcmp(p + 0x05, img4_magic, sizeof img4_magic)) { // SEPFW after m1n1
|
||||
printf("No more payloads at %p\n", p);
|
||||
return NULL;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue