Skip to content

Commit

Permalink
avb_verify: Add more details for rollback index
Browse files Browse the repository at this point in the history
Runtime

  Usage: avb_verify [-b] [-c] [-i] <partition> <key> [suffix]
         avb_verify [-I] <partition>
         avb_verify [-U] <image> <partition> <key>

  Verify
    Option | Update | Allow    | Allow    | IDX    | Description
           | IDX    | Same IDX | Rollback | in KV  | Description
    ----   | ----   | ----     | ----     | ----   | ----
    -b     | Y      | Y        | N        | Y      | Boot verify, enabled by default
    -i     | Y      | Y        | Y        | Y      | Boot verify, allow rollback
    -c     | N      | N        | N        | Y      | Upgrade verify, prevent same
    -U     | N      | Y        | N        | N      | Upgrade verify, prevent downgrade

  Info print
    -I   Show image sign info
    -h   Show help

  Examples
    -  Boot Verify
       avb_verify <partition> <key> [suffix]
    -  Upgrade Verify - check same
       avb_verify -c <image> <key> [suffix]
    -  Upgrade Verify - check downgrade
       avb_verify -U <image> <partition> <key> [suffix]
    -  Image Info
       avb_verify -I <image>

  Line num: 73

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Dec 28, 2024
1 parent ab83bf0 commit 9b89789
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions verify/avb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,40 @@
#include "avb_verify.h"
#include <unistd.h>

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] <partition> <key> [suffix]\n", progname);
avb_printf(" %s [-I] <partition>\n", progname);
avb_printf("Examples:\n");
avb_printf(" 1. Boot Verify\n");
avb_printf(" %s [-U] <image> <partition> <key>\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 <partition> <key> [suffix]\n", progname);
avb_printf(" 2. Upgrade Verify\n");
avb_printf(" - Upgrade Verify - check same\n");
avb_printf(" %s -c <image> <key> [suffix]\n", progname);
avb_printf(" 3. Image Info\n");
avb_printf(" - Upgrade Verify - check downgrade\n");
avb_printf(" %s -U <image> <partition> <key> [suffix]\n", progname);
avb_printf(" - Image Info\n");
avb_printf(" %s -I <image>\n", progname);

avb_printf("\nLine num: %d\n", line_num);
}

int main(int argc, char* argv[])
Expand Down

0 comments on commit 9b89789

Please sign in to comment.