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 <fengwei.yin@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yin Fengwei 2018-03-27 13:46:19 +08:00 committed by Jack Ren
parent 1e13533ec0
commit 53b89b91de
2 changed files with 17 additions and 4 deletions

View File

@ -128,7 +128,8 @@ usage(int code)
fprintf(stderr, fprintf(stderr,
"Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n" "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n"
" %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] \n" " %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] \n"
" %*s [--vsbl vsbl_file_name] <vm>\n" " %*s [--vsbl vsbl_file_name] [--part_info part_info_name]\n"
" %*s <vm>\n"
" -a: local apic is in xAPIC mode (deprecated)\n" " -a: local apic is in xAPIC mode (deprecated)\n"
" -A: create ACPI tables\n" " -A: create ACPI tables\n"
" -c: # cpus (default 1)\n" " -c: # cpus (default 1)\n"
@ -154,8 +155,10 @@ usage(int code)
" -r: ramdisk image path\n" " -r: ramdisk image path\n"
" -B: bootargs for kernel\n" " -B: bootargs for kernel\n"
" -v: version\n" " -v: version\n"
" --vsbl: vsbl file path\n", " --vsbl: vsbl file path\n"
progname, (int)strlen(progname), "", (int)strlen(progname), ""); " --part_info: guest partition info file path\n",
progname, (int)strlen(progname), "", (int)strlen(progname), "",
(int)strlen(progname), "");
exit(code); exit(code);
} }
@ -551,6 +554,7 @@ sig_handler_term(int signo)
enum { enum {
CMD_OPT_VSBL = 1000, CMD_OPT_VSBL = 1000,
CMD_OPT_PART_INFO,
}; };
static struct option long_options[] = { static struct option long_options[] = {
@ -584,6 +588,7 @@ static struct option long_options[] = {
/* Following cmd option only has long option */ /* Following cmd option only has long option */
{"vsbl", required_argument, 0, CMD_OPT_VSBL}, {"vsbl", required_argument, 0, CMD_OPT_VSBL},
{"part_info", required_argument, 0, CMD_OPT_PART_INFO},
{0, 0, 0, 0 }, {0, 0, 0, 0 },
}; };
@ -724,6 +729,14 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
break; 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': case 'h':
usage(0); usage(0);
default: default:

View File

@ -64,7 +64,7 @@ int acrn_parse_ramdisk(char *arg);
int acrn_parse_bootargs(char *arg); int acrn_parse_bootargs(char *arg);
int acrn_parse_gvtargs(char *arg); int acrn_parse_gvtargs(char *arg);
int acrn_parse_vsbl(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); char *get_bootargs(void);
void vsbl_set_bdf(int bnum, int snum, int fnum); void vsbl_set_bdf(int bnum, int snum, int fnum);