mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-25 04:40:18 +00:00
magiskboot: add unpack -n to help with repack validity tests
- support unpack without decompression to allow easy testing of magiskboot's header, structure and hashing handling by comparing repack checksum versus origbootimg - make -n first to match repack
This commit is contained in:
@@ -21,9 +21,11 @@ FULL_VER(MagiskBoot) R"EOF( - Boot Image Modification Tool
|
||||
Usage: %s <action> [args...]
|
||||
|
||||
Supported actions:
|
||||
unpack [-h] <bootimg>
|
||||
unpack [-n] [-h] <bootimg>
|
||||
Unpack <bootimg> to, if available, kernel, kernel_dtb, ramdisk.cpio,
|
||||
second, dtb, extra, and recovery_dtbo into current directory.
|
||||
If '-n' is provided, it will not attempt to decompress kernel or
|
||||
ramdisk.cpio from their original formats.
|
||||
If '-h' is provided, it will dump header info to 'header',
|
||||
which will be parsed when repacking.
|
||||
Return values:
|
||||
@@ -146,10 +148,26 @@ int main(int argc, char *argv[]) {
|
||||
printf("\n");
|
||||
munmap(buf, size);
|
||||
} else if (argc > 2 && action == "unpack") {
|
||||
if (argv[2] == "-h"sv) {
|
||||
if (argc == 3)
|
||||
usage(argv[0]);
|
||||
return unpack(argv[3], true);
|
||||
if (argv[2] == "-n"sv) {
|
||||
if (argv[3] == "-h"sv) {
|
||||
if (argc == 4)
|
||||
usage(argv[0]);
|
||||
return unpack(argv[4], true, true);
|
||||
} else {
|
||||
if (argc == 3)
|
||||
usage(argv[0]);
|
||||
return unpack(argv[3], true);
|
||||
}
|
||||
} else if (argv[2] == "-h"sv) {
|
||||
if (argv[3] == "-n"sv) {
|
||||
if (argc == 4)
|
||||
usage(argv[0]);
|
||||
return unpack(argv[4], true, true);
|
||||
} else {
|
||||
if (argc == 3)
|
||||
usage(argv[0]);
|
||||
return unpack(argv[3], false, true);
|
||||
}
|
||||
} else {
|
||||
return unpack(argv[2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user