Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcb2617a authored by Koushik Dutta's avatar Koushik Dutta Committed by Ricardo Cerqueira
Browse files

unpackbootimg: Fix magic search.

Change-Id: I68470b637556a08e48ff72b7ef8811cba13b04ad
parent 610ccab1
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -81,18 +81,19 @@ int main(int argc, char** argv)

    //printf("Reading header...\n");
    int i;
    for (i = 0; i < 512; i++) {
    for (i = 0; i <= 512; i++) {
        fseek(f, i, SEEK_SET);
        fread(tmp, BOOT_MAGIC_SIZE, 1, f);
        if (memcmp(tmp, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0)
            break;
        fseek(f, i, SEEK_SET);
    }
    total_read = i;
    fread(tmp, BOOT_MAGIC_SIZE, 1, f);
    if (memcmp(tmp, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0) {
    if (i > 512) {
        printf("Android boot magic not found.\n");
        return 1;
    }
    fseek(f, i, SEEK_SET);
    printf("Android magic found at: %d\n", i);

    fread(&header, sizeof(header), 1, f);
    printf("BOARD_KERNEL_CMDLINE %s\n", header.cmdline);