Exemple #1
0
int main(int argc, char *argv[])
{
    char **args[3];
    int i;
    int n;

    args[0] = &argv[1];
    n = 1;
    for (i = 1; i < argc; i++) {
	if (!strcmp(argv[i], "--")) {
	    argv[i] = NULL;
	    args[n++] = &argv[i + 1];
	}
	if (n >= 3)
	    break;
    }
    while (n < 3) {
	args[n] = args[n - 1];
	n++;
    }

    boot_args(cpu_has_feature(X86_FEATURE_LM) ? args[0] :
	      cpu_has_feature(X86_FEATURE_PAE) ? args[1] : args[2]);
    return -1;
}
Exemple #2
0
int main(int argc, char *argv[])
{
    char **args[2];
    int arg = 0;

    if (argc)
	arg++;
    args[0] = &argv[arg];
    args[1] = NULL;
    while (arg < argc) {
	if (!strcmp(argv[arg], "--")) {
	    argv[arg] = NULL;
	    args[1] = &argv[arg + 1];
	    break;
	}
	arg++;
    }
    if (args[1] != NULL) {
	boot_args(plop_INT13h_check()? args[0] : args[1]);
    } else {
	fprintf(stderr,
		"Usage:   ifplop.c32 [<plop_detected>] -- [<plop_not_detected>]\n"
		"Example: ifplop.c32 menu.c32 another.cfg -- plpbt hiddenusb usb1=2\n");
    }

    return 0;
}
Exemple #3
0
int main(int argc, char *argv[])
{
    char **args[3];
    int i=0;
    int n=0;
    bool hardware_matches = true;
    bool multicore = false;
    bool dryrun = false;
    bool debug = false;

    s_cpu cpu;
    console_ansi_raw();
    detect_cpu(&cpu);

    /* If no argument got passed, let's show the usage */
    if (argc == 1) {
	    usage();
	    return -1;
    }

    for (i = 1; i < argc; i++) {
	if (!strcmp(argv[i], "--")) {
	    argv[i] = NULL;
	    args[n++] = &argv[i + 1];
	} else if (!strcmp(argv[i], "64")) {
	    if (debug)
		printf(" 64bit     : %s on this system\n",
		       show_bool(cpu.flags.lm));
	    hardware_matches = cpu.flags.lm && hardware_matches;
	} else if (!strcmp(argv[i], "pae")) {
	    if (debug)
		printf(" pae       : %s on this system\n",
		       show_bool(cpu.flags.pae));
	    hardware_matches = cpu.flags.pae && hardware_matches;
	} else if (!strcmp(argv[i], "hvm")) {
	    if (debug)
		printf(" hvm       : %s on this system\n",
		       show_bool((cpu.flags.vmx || cpu.flags.svm)));
	    hardware_matches = (cpu.flags.vmx || cpu.flags.svm)
		&& hardware_matches;
	} else if (!strcmp(argv[i], "multicore")) {
	    if (debug)
		printf(" multicore : %d cores on this system\n", cpu.num_cores);
	    if (cpu.num_cores > 1)
		multicore = true;
	    hardware_matches = multicore && hardware_matches;
	} else if (!strcmp(argv[i], "smp")) {
	    if (debug)
		printf(" smp       : %s on this system\n", show_bool(cpu.flags.smp));
	    hardware_matches = cpu.flags.smp && hardware_matches;
	} else if (!strcmp(argv[i], "dry-run")) {
	    dryrun = true;
	} else if (!strcmp(argv[i], "debug")) {
	    debug = true;
	}
	if (n >= 2)
	    break;
    }
    while (n < 2) {
	args[n] = args[n - 1];
	n++;
    }
    if (debug) {
	printf("\nBooting labels are : '%s' or '%s'\n", *args[0], *args[1]);
	printf("Hardware requirements%smatch this system, let's booting '%s'\n",
	       hardware_matches ? " " : " doesn't ",
	       hardware_matches ? *args[0] : *args[1]);
	printf("Sleeping 5sec before booting\n");
	if (!dryrun)
	    sleep(5);
    }

    if (!dryrun)
	boot_args(hardware_matches ? args[0] : args[1]);
    else
	printf("Dry-run mode, let's exiting\n");

    return -1;
}