From 2ff5d9606b575726bd30d89c6d029e30f33a90a3 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 19 May 2019 21:18:18 -0300 Subject: [PATCH] magiskboot: add support for remaining Nook HD pre-image loaders --- native/jni/magiskboot/bootimg.cpp | 11 +++++++---- native/jni/magiskboot/format.h | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/native/jni/magiskboot/bootimg.cpp b/native/jni/magiskboot/bootimg.cpp index 53c58d904..f46f1b32c 100644 --- a/native/jni/magiskboot/bootimg.cpp +++ b/native/jni/magiskboot/bootimg.cpp @@ -109,14 +109,17 @@ int boot_img::parse_image(uint8_t *head) { hdr.set_hdr(new boot_img_hdr_pxa()); memcpy(*hdr, head, sizeof(boot_img_hdr_pxa)); } else { - if (memcmp(hp->cmdline, NOOKHD_MAGIC, 12) == 0 || - memcmp(hp->cmdline, NOOKHD_NEW_MAGIC, 26) == 0) { + if (memcmp(hp->cmdline, NOOKHD_RL_MAGIC, 10) == 0 || + memcmp(hp->cmdline, NOOKHD_GL_MAGIC, 12) == 0 || + memcmp(hp->cmdline, NOOKHD_GR_MAGIC, 14) == 0 || + memcmp(hp->cmdline, NOOKHD_EB_MAGIC, 26) == 0 || + memcmp(hp->cmdline, NOOKHD_ER_MAGIC, 30) == 0) { flags |= NOOKHD_FLAG; - fprintf(stderr, "NOOKHD_GREEN_LOADER\n"); + fprintf(stderr, "NOOKHD_LOADER\n"); head += NOOKHD_PRE_HEADER_SZ; } else if (memcmp(hp->name, ACCLAIM_MAGIC, 10) == 0) { flags |= ACCLAIM_FLAG; - fprintf(stderr, "ACCLAIM_BAUWKSBOOT\n"); + fprintf(stderr, "ACCLAIM_LOADER\n"); head += ACCLAIM_PRE_HEADER_SZ; } hdr.set_hdr(new boot_img_hdr()); diff --git a/native/jni/magiskboot/format.h b/native/jni/magiskboot/format.h index b84c4173d..1d53ddb13 100644 --- a/native/jni/magiskboot/format.h +++ b/native/jni/magiskboot/format.h @@ -45,8 +45,11 @@ typedef enum { #define DHTB_MAGIC "\x44\x48\x54\x42\x01\x00\x00\x00" #define SEANDROID_MAGIC "SEANDROIDENFORCE" #define TEGRABLOB_MAGIC "-SIGNED-BY-SIGNBLOB-" -#define NOOKHD_MAGIC "Green Loader" -#define NOOKHD_NEW_MAGIC "eMMC boot.img+secondloader" +#define NOOKHD_RL_MAGIC "Red Loader" +#define NOOKHD_GL_MAGIC "Green Loader" +#define NOOKHD_GR_MAGIC "Green Recovery" +#define NOOKHD_EB_MAGIC "eMMC boot.img+secondloader" +#define NOOKHD_ER_MAGIC "eMMC recovery.img+secondloader" #define NOOKHD_PRE_HEADER_SZ 1048576 #define ACCLAIM_MAGIC "BauwksBoot" #define ACCLAIM_PRE_HEADER_SZ 262144