mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Add support to remove avb verity
This commit is contained in:
parent
811489f157
commit
2487ec94e6
@ -208,8 +208,13 @@ static void cpio_test(struct vector *v) {
|
||||
int check_verity_pattern(const char *s) {
|
||||
int pos = 0;
|
||||
if (s[0] == ',') ++pos;
|
||||
if (strncmp(s + pos, "verify", 6) != 0) return -1;
|
||||
if (strncmp(s + pos, "verify", 6) == 0)
|
||||
pos += 6;
|
||||
else if (strncmp(s + pos, "avb", 3) == 0)
|
||||
pos += 3;
|
||||
else
|
||||
return -1;
|
||||
|
||||
if (s[pos] == '=') {
|
||||
while (s[pos] != '\0' && s[pos] != ' ' && s[pos] != '\n' && s[pos] != ',') ++pos;
|
||||
}
|
||||
|
@ -7,11 +7,24 @@
|
||||
|
||||
extern int check_verity_pattern(const char *s);
|
||||
|
||||
static void print_props(const void *fdt, int node, int depth) {
|
||||
int prop;
|
||||
fdt_for_each_property_offset(prop, fdt, node) {
|
||||
for (int i = 0; i < depth; ++i) printf(" ");
|
||||
printf(" ");
|
||||
int size;
|
||||
const char *name;
|
||||
const char *value = fdt_getprop_by_offset(fdt, prop, &name, &size);
|
||||
printf("[%s]: [%s]\n", name, value);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_subnode(const void *fdt, int parent, int depth) {
|
||||
int node;
|
||||
fdt_for_each_subnode(node, fdt, parent) {
|
||||
for (int i = 0; i < depth; ++i) printf(" ");
|
||||
printf("%d: %s\n", node, fdt_get_name(fdt, node, NULL));
|
||||
printf("#%d: %s\n", node, fdt_get_name(fdt, node, NULL));
|
||||
print_props(fdt, node, depth);
|
||||
print_subnode(fdt, node, depth + 1);
|
||||
}
|
||||
}
|
||||
@ -28,7 +41,7 @@ static int find_fstab(const void *fdt, int parent) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void dtb_print(const char *file) {
|
||||
void dtb_dump(const char *file) {
|
||||
size_t size ;
|
||||
void *dtb, *fdt;
|
||||
fprintf(stderr, "Loading dtbs from [%s]\n", file);
|
||||
@ -38,7 +51,7 @@ void dtb_print(const char *file) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (memcmp(dtb + i, DTB_MAGIC, 4) == 0) {
|
||||
fdt = dtb + i;
|
||||
fprintf(stderr, "\nPrinting dtb.%04d\n\n", dtb_num++);
|
||||
fprintf(stderr, "Dumping dtb.%04d\n\n", dtb_num++);
|
||||
print_subnode(fdt, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ int parse_img(void *orig, size_t size, boot_img *boot);
|
||||
int cpio_commands(const char *command, int argc, char *argv[]);
|
||||
void comp_file(const char *method, const char *from, const char *to);
|
||||
void decomp_file(char *from, const char *to);
|
||||
void dtb_print(const char *file);
|
||||
void dtb_dump(const char *file);
|
||||
void dtb_patch(const char *file);
|
||||
|
||||
// Compressions
|
||||
|
@ -45,7 +45,7 @@ static void usage(char *arg0) {
|
||||
" -extract <entry> <outfile>\n"
|
||||
" Extract <entry> to <outfile>\n"
|
||||
" -test\n"
|
||||
" Return value: 0/stock 1/Magisk 2/other (e.g. phh, SuperSU)\n"
|
||||
" Return value: 0/stock 1/Magisk 2/other (phh, SuperSU, Xposed)\n"
|
||||
" -patch <KEEPVERITY> <KEEPFORCEENCRYPT>\n"
|
||||
" Patch cpio for Magisk. KEEP**** are true/false values\n"
|
||||
" -backup <origcpio> [SHA1]\n"
|
||||
@ -56,11 +56,13 @@ static void usage(char *arg0) {
|
||||
" -stocksha1\n"
|
||||
" Get stock boot SHA1 recorded within <incpio>\n"
|
||||
"\n"
|
||||
" --dtb-print <dtb>\n"
|
||||
" Print all nodes in <dtb>, for debugging\n"
|
||||
"\n"
|
||||
" --dtb-patch <dtb>\n"
|
||||
" Search for fstab in <dtb> and remove verity checks\n"
|
||||
" --dtb-<cmd> <dtb>\n"
|
||||
" Do dtb related cmds to <dtb> (modifications are done directly)\n"
|
||||
" Supported commands:\n"
|
||||
" -dump\n"
|
||||
" Dump all contents from dtb for debugging\n"
|
||||
" -patch\n"
|
||||
" Search for fstab and remove verity/avb\n"
|
||||
"\n"
|
||||
" --compress[=method] <infile> [outfile]\n"
|
||||
" Compress <infile> with [method] (default: gzip), optionally to [outfile]\n"
|
||||
@ -119,8 +121,8 @@ int main(int argc, char *argv[]) {
|
||||
repack(argv[2], argc > 3 ? argv[3] : NEW_BOOT);
|
||||
} else if (argc > 2 && strcmp(argv[1], "--decompress") == 0) {
|
||||
decomp_file(argv[2], argc > 3 ? argv[3] : NULL);
|
||||
} else if (argc > 2 && strcmp(argv[1], "--dtb-print") == 0) {
|
||||
dtb_print(argv[2]);
|
||||
} else if (argc > 2 && strcmp(argv[1], "--dtb-dump") == 0) {
|
||||
dtb_dump(argv[2]);
|
||||
} else if (argc > 2 && strcmp(argv[1], "--dtb-patch") == 0) {
|
||||
dtb_patch(argv[2]);
|
||||
} else if (argc > 2 && strncmp(argv[1], "--compress", 10) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user