From 53b89b91deb6a676365ca9ce43365837375ef97f Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Tue, 27 Mar 2018 13:46:19 +0800 Subject: [PATCH] DM: add long option to specify guest partition info file Some guests needs guest partition info passed to support A/B boot. DM needs to load guest partition info from file and pass to vsbl. Signed-off-by: Yin Fengwei Acked-by: Anthony Xu --- devicemodel/core/main.c | 19 ++++++++++++++++--- devicemodel/include/sw_load.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index c0957087b..6f3914303 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -128,7 +128,8 @@ usage(int code) fprintf(stderr, "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" - " %*s [--vsbl vsbl_file_name] \n" + " %*s [--vsbl vsbl_file_name] [--part_info part_info_name]\n" + " %*s \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" " -c: # cpus (default 1)\n" @@ -154,8 +155,10 @@ usage(int code) " -r: ramdisk image path\n" " -B: bootargs for kernel\n" " -v: version\n" - " --vsbl: vsbl file path\n", - progname, (int)strlen(progname), "", (int)strlen(progname), ""); + " --vsbl: vsbl file path\n" + " --part_info: guest partition info file path\n", + progname, (int)strlen(progname), "", (int)strlen(progname), "", + (int)strlen(progname), ""); exit(code); } @@ -551,6 +554,7 @@ sig_handler_term(int signo) enum { CMD_OPT_VSBL = 1000, + CMD_OPT_PART_INFO, }; static struct option long_options[] = { @@ -584,6 +588,7 @@ static struct option long_options[] = { /* Following cmd option only has long option */ {"vsbl", required_argument, 0, CMD_OPT_VSBL}, + {"part_info", required_argument, 0, CMD_OPT_PART_INFO}, {0, 0, 0, 0 }, }; @@ -724,6 +729,14 @@ main(int argc, char *argv[]) exit(1); } break; + case CMD_OPT_PART_INFO: + if (acrn_parse_guest_part_info(optarg) != 0) { + errx(EX_USAGE, + "invalid guest partition info param %s", + optarg); + exit(1); + } + break; case 'h': usage(0); default: diff --git a/devicemodel/include/sw_load.h b/devicemodel/include/sw_load.h index f32087e4e..8f471ede2 100644 --- a/devicemodel/include/sw_load.h +++ b/devicemodel/include/sw_load.h @@ -64,7 +64,7 @@ int acrn_parse_ramdisk(char *arg); int acrn_parse_bootargs(char *arg); int acrn_parse_gvtargs(char *arg); int acrn_parse_vsbl(char *arg); -int acrn_parse_partation_blob(char *arg); +int acrn_parse_guest_part_info(char *arg); char *get_bootargs(void); void vsbl_set_bdf(int bnum, int snum, int fnum);