diff --git a/hw/xbox_pci.c b/hw/xbox_pci.c index 158e5ba5d3..b817317306 100644 --- a/hw/xbox_pci.c +++ b/hw/xbox_pci.c @@ -20,8 +20,8 @@ #include "qemu/range.h" #include "isa.h" #include "sysbus.h" -#include "sysemu/sysemu.h" #include "loader.h" +#include "qemu/config-file.h" #include "pc.h" #include "pci/pci.h" #include "pci/pci_bus.h" @@ -241,25 +241,32 @@ static int xbox_lpc_initfn(PCIDevice *d) /* southbridge chip contains and controls bootrom image. * can't load it through loader.c because it overlaps with the bios... + * We really should just commandeer the entire top 16Mb. */ - char *filename; - int rc, fd = -1; - if (bootrom_name - && (filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bootrom_name))) { - s->bootrom_size = get_image_size(filename); + QemuOpts *machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (machine_opts) { + const char *bootrom_file = qemu_opt_get(machine_opts, "bootrom"); + if (!bootrom_file) bootrom_file = "mcpx.bin"; - if (s->bootrom_size != 512) { - fprintf(stderr, "MCPX bootrom should be 512 bytes, got %d\n", - s->bootrom_size); - return -1; + char *filename; + int rc, fd = -1; + if (bootrom_file + && (filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bootrom_file))) { + s->bootrom_size = get_image_size(filename); + + if (s->bootrom_size != 512) { + fprintf(stderr, "MCPX bootrom should be 512 bytes, got %d\n", + s->bootrom_size); + return -1; + } + + fd = open(filename, O_RDONLY | O_BINARY); + assert(fd != -1); + rc = read(fd, s->bootrom_data, s->bootrom_size); + assert(rc == s->bootrom_size); + + close(fd); } - - fd = open(filename, O_RDONLY | O_BINARY); - assert(fd != -1); - rc = read(fd, s->bootrom_data, s->bootrom_size); - assert(rc == s->bootrom_size); - - close(fd); } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index cf0ae33e4e..6578782fc3 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -13,7 +13,6 @@ /* vl.c */ extern const char *bios_name; -extern const char *bootrom_name; extern const char *qemu_name; extern uint8_t qemu_uuid[]; diff --git a/qemu-options.hx b/qemu-options.hx index ba4881d783..30fb85d619 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2624,14 +2624,6 @@ STEXI Set the filename for the BIOS. ETEXI -DEF("bootrom", HAS_ARG, QEMU_OPTION_bootrom, \ - "-bootrom file set the filename for the boot rom\n", QEMU_ARCH_ALL) -STEXI -@item -bootrom @var{file} -@findex -bootrom -Set the filename for the boot rom. -ETEXI - DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \ "-enable-kvm enable KVM full virtualization support\n", QEMU_ARCH_ALL) STEXI diff --git a/vl.c b/vl.c index f2430f5b1e..50b672b42e 100644 --- a/vl.c +++ b/vl.c @@ -182,7 +182,6 @@ int main(int argc, char **argv) static const char *data_dir[16]; static int data_dir_idx; const char *bios_name = NULL; -const char *bootrom_name = NULL; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; DisplayType display_type = DT_DEFAULT; static int display_remote; @@ -430,6 +429,10 @@ static QemuOptsList qemu_machine_opts = { .name = "usb", .type = QEMU_OPT_BOOL, .help = "Set on/off to enable/disable usb", + },{ + .name = "bootrom", + .type = QEMU_OPT_STRING, + .help = "Xbox bootrom file", }, { /* End of list */ } }, @@ -3298,9 +3301,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_bios: bios_name = optarg; break; - case QEMU_OPTION_bootrom: - bootrom_name = optarg; - break; case QEMU_OPTION_singlestep: singlestep = 1; break;