mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Add amonet microloader support
This commit is contained in:
parent
a07d4080b6
commit
2eef542054
@ -266,6 +266,14 @@ dyn_img_hdr *boot_img::create_hdr(uint8_t *addr, format_t type) {
|
||||
flags[ACCLAIM_FLAG] = true;
|
||||
fprintf(stderr, "ACCLAIM_LOADER\n");
|
||||
addr += ACCLAIM_PRE_HEADER_SZ;
|
||||
} else if (str_contains(string_view((const char *) addr, AMONET_MICROLOADER_SZ), AMONET_MICROLOADER_MAGIC) &&
|
||||
string_view((const char *)addr + AMONET_MICROLOADER_SZ, BOOT_MAGIC_SIZE) == BOOT_MAGIC) {
|
||||
flags[AMONET_FLAG] = true;
|
||||
fprintf(stderr, "AMONET_MICROLOADER\n");
|
||||
uint8_t microloader[AMONET_MICROLOADER_SZ];
|
||||
memcpy(microloader, addr, AMONET_MICROLOADER_SZ);
|
||||
memcpy(addr, addr + AMONET_MICROLOADER_SZ, AMONET_MICROLOADER_SZ);
|
||||
memcpy(addr + AMONET_MICROLOADER_SZ, microloader, AMONET_MICROLOADER_SZ);
|
||||
}
|
||||
|
||||
// addr could be adjusted
|
||||
@ -788,4 +796,9 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) {
|
||||
auto b_hdr = reinterpret_cast<blob_hdr *>(out.buf);
|
||||
b_hdr->size = off.total - sizeof(blob_hdr);
|
||||
}
|
||||
|
||||
if (boot.flags[AMONET_FLAG]) {
|
||||
memcpy(out.buf + off.header + AMONET_MICROLOADER_SZ, out.buf + off.header, AMONET_MICROLOADER_SZ);
|
||||
memcpy(out.buf + off.header, boot.hdr_addr + AMONET_MICROLOADER_SZ, AMONET_MICROLOADER_SZ);
|
||||
}
|
||||
}
|
||||
|
@ -556,6 +556,7 @@ enum {
|
||||
BLOB_FLAG,
|
||||
NOOKHD_FLAG,
|
||||
ACCLAIM_FLAG,
|
||||
AMONET_FLAG,
|
||||
AVB_FLAG,
|
||||
ZIMAGE_KERNEL,
|
||||
BOOT_FLAGS_MAX
|
||||
|
@ -57,6 +57,8 @@ typedef enum {
|
||||
#define NOOKHD_PRE_HEADER_SZ 1048576
|
||||
#define ACCLAIM_MAGIC "BauwksBoot"
|
||||
#define ACCLAIM_PRE_HEADER_SZ 262144
|
||||
#define AMONET_MICROLOADER_SZ 1024
|
||||
#define AMONET_MICROLOADER_MAGIC "microloader"
|
||||
#define AVB_FOOTER_MAGIC "AVBf"
|
||||
#define AVB_MAGIC "AVB0"
|
||||
#define ZIMAGE_MAGIC "\x18\x28\x6f\x01"
|
||||
|
Loading…
Reference in New Issue
Block a user