Exemple #1
0
static void pc_fw_add_pflash_drv(void)
{
    QemuOpts *opts;
    QEMUMachine *machine;
    char *filename;

    if (bios_name == NULL) {
        bios_name = BIOS_FILENAME;
    }
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
    if (!filename) {
        error_report("Can't open BIOS image %s", bios_name);
        exit(1);
    }

    opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");

    g_free(filename);

    if (opts == NULL) {
      return;
    }

    machine = find_default_machine();
    if (machine == NULL) {
      return;
    }

    if (!drive_init(opts, machine->block_default_type)) {
        qemu_opts_del(opts);
    }
}
Exemple #2
0
static void pc_fw_add_pflash_drv(void)
{
    QemuOpts *opts;
    QEMUMachine *machine;
    char *filename;

    if (bios_name == NULL) {
        bios_name = BIOS_FILENAME;
    }
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

    opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");

    g_free(filename);

    if (opts == NULL) {
      return;
    }

    machine = find_default_machine();
    if (machine == NULL) {
      return;
    }

    drive_init(opts, machine->use_scsi);
}
DriveInfo *add_init_drive(const char *optstr)
{
    int fatal_error;
    DriveInfo *dinfo;
    QemuOpts *opts;

    opts = drive_add(NULL, "%s", optstr);
    if (!opts)
        return NULL;

    dinfo = drive_init(opts, current_machine->use_scsi, &fatal_error);
    if (!dinfo) {
        qemu_opts_del(opts);
        return NULL;
    }

    return dinfo;
}