diff --git a/verify/avb_main.c b/verify/avb_main.c index 8c553f5..cbb5c4a 100644 --- a/verify/avb_main.c +++ b/verify/avb_main.c @@ -17,17 +17,40 @@ #include "avb_verify.h" #include -void usage(const char* progname) +#define usage(p) usage_line_num(p, __LINE__) +#define PRINT_VERIFY(o, u, as, ar, p, c) \ + avb_printf(" %-6s | %-6s | %-8s | %-8s | %-6s | %s\n", o, u, as, ar, p, c) + +void usage_line_num(const char* progname, const int line_num) { avb_printf("Usage: %s [-b] [-c] [-i] [suffix]\n", progname); avb_printf(" %s [-I] \n", progname); - avb_printf("Examples:\n"); - avb_printf(" 1. Boot Verify\n"); + avb_printf(" %s [-U] \n", progname); + + avb_printf("\nVerify\n"); + PRINT_VERIFY("Option", "Update", "Allow", "Allow", "IDX", "Description"); + PRINT_VERIFY("", "IDX", "Same IDX", "Rollback", "in KV", "Description"); + PRINT_VERIFY("----", "----", "----", "----", "----", "----"); + PRINT_VERIFY("-b", "Y", "Y", "N", "Y", "Boot verify, enabled by default"); + PRINT_VERIFY("-i", "Y", "Y", "Y", "Y", "Boot verify, allow rollback"); + PRINT_VERIFY("-c", "N", "N", "N", "Y", "Upgrade verify, prevent same"); + PRINT_VERIFY("-U", "N", "Y", "N", "N", "Upgrade verify, prevent downgrade"); + + avb_printf("\nInfo print\n"); + avb_printf(" %-4s Show image sign info\n", "-I"); + avb_printf(" %-4s Show help\n", "-h"); + + avb_printf("\nExamples\n"); + avb_printf(" - Boot Verify\n"); avb_printf(" %s [suffix]\n", progname); - avb_printf(" 2. Upgrade Verify\n"); + avb_printf(" - Upgrade Verify - check same\n"); avb_printf(" %s -c [suffix]\n", progname); - avb_printf(" 3. Image Info\n"); + avb_printf(" - Upgrade Verify - check downgrade\n"); + avb_printf(" %s -U [suffix]\n", progname); + avb_printf(" - Image Info\n"); avb_printf(" %s -I \n", progname); + + avb_printf("\nLine num: %d\n", line_num); } int main(int argc, char* argv[])