Refactor dtb in rust

This commit is contained in:
LoveSy
2023-09-19 00:12:49 -07:00
committed by John Wu
parent 8e1a91509c
commit 8d7c7c3dfb
14 changed files with 403 additions and 626 deletions

View File

@ -76,19 +76,8 @@ Supported actions:
See "cpio --help" for supported commands.
dtb <file> <action> [args...]
Do dtb related actions to <file>
Supported actions:
print [-f]
Print all contents of dtb for debugging
Specify [-f] to only print fstab nodes
patch
Search for fstab and remove verity/avb
Modifications are done directly to the file in-place
Configure with env variables: KEEPVERITY
test
Test the fstab's status
Return values:
0:valid 1:error
Do dtb related actions to <file>.
See "dtb --help" for supported actions.
split <file>
Split image.*-dtb into kernel + kernel_dtb
@ -202,9 +191,8 @@ int main(int argc, char *argv[]) {
return hexpatch(byte_view(argv[2]), byte_view(argv[3]), byte_view(argv[4])) ? 0 : 1;
} else if (argc > 2 && action == "cpio") {
return rust::cpio_commands(argc - 2, argv + 2) ? 0 : 1;
} else if (argc > 3 && action == "dtb") {
if (dtb_commands(argc - 2, argv + 2))
usage(argv[0]);
} else if (argc > 2 && action == "dtb") {
return rust::dtb_commands(argc - 2, argv + 2) ? 0 : 1;
} else if (argc > 2 && action == "extract") {
return rust::extract_boot_from_payload(
argv[2],