Commit 1192dad8798e4e4b72b14ff3a93c11cbb26eae5b

Authored by j_mayer
1 parent e9c05b42

New '-bios' option, used to select an alternate BIOS image from bios_dir.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3331 c046a42c-6fe2-441c-8c8c-71466251a162
hw/mips_malta.c
... ... @@ -791,7 +791,9 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
791 791  
792 792 /* Load a BIOS image unless a kernel image has been specified. */
793 793 if (!kernel_filename) {
794   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  794 + if (bios_name == NULL)
  795 + bios_name = BIOS_FILENAME;
  796 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
795 797 ret = load_image(buf, phys_ram_base + bios_offset);
796 798 if (ret < 0 || ret > BIOS_SIZE) {
797 799 fprintf(stderr,
... ...
hw/mips_pica61.c
... ... @@ -94,7 +94,9 @@ void mips_pica61_init (int ram_size, int vga_ram_size, int boot_device,
94 94  
95 95 /* load a BIOS image */
96 96 bios_offset = ram_size + vga_ram_size;
97   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  97 + if (bios_name == NULL)
  98 + bios_name = BIOS_FILENAME;
  99 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
98 100 bios_size = load_image(buf, phys_ram_base + bios_offset);
99 101 if ((bios_size <= 0) || (bios_size > BIOS_SIZE)) {
100 102 /* fatal */
... ...
hw/mips_r4k.c
... ... @@ -179,7 +179,9 @@ void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
179 179 preloaded we also initialize the hardware, since the BIOS wasn't
180 180 run. */
181 181 bios_offset = ram_size + vga_ram_size;
182   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  182 + if (bios_name == NULL)
  183 + bios_name = BIOS_FILENAME;
  184 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
183 185 bios_size = load_image(buf, phys_ram_base + bios_offset);
184 186 if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
185 187 cpu_register_physical_memory(0x1fc00000,
... ...
... ... @@ -706,7 +706,9 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
706 706 vga_ram_addr = qemu_ram_alloc(vga_ram_size);
707 707  
708 708 /* BIOS load */
709   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  709 + if (bios_name == NULL)
  710 + bios_name = BIOS_FILENAME;
  711 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
710 712 bios_size = get_image_size(buf);
711 713 if (bios_size <= 0 ||
712 714 (bios_size % 65536) != 0) {
... ...
hw/ppc405_boards.c
... ... @@ -236,7 +236,9 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
236 236 #ifdef DEBUG_BOARD_INIT
237 237 printf("Load BIOS from file\n");
238 238 #endif
239   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  239 + if (bios_name == NULL)
  240 + bios_name = BIOS_FILENAME;
  241 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
240 242 bios_size = load_image(buf, phys_ram_base + bios_offset);
241 243 if (bios_size < 0 || bios_size > BIOS_SIZE) {
242 244 fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
... ... @@ -549,7 +551,9 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
549 551 #ifdef DEBUG_BOARD_INIT
550 552 printf("Load BIOS from file\n");
551 553 #endif
552   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  554 + if (bios_name == NULL)
  555 + bios_name = BIOS_FILENAME;
  556 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
553 557 bios_size = load_image(buf, phys_ram_base + bios_offset);
554 558 if (bios_size < 0 || bios_size > BIOS_SIZE) {
555 559 fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
... ...
hw/ppc_chrp.c
... ... @@ -349,7 +349,9 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device,
349 349  
350 350 /* allocate and load BIOS */
351 351 bios_offset = ram_size + vga_ram_size;
352   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  352 + if (bios_name == NULL)
  353 + bios_name = BIOS_FILENAME;
  354 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
353 355 bios_size = load_image(buf, phys_ram_base + bios_offset);
354 356 if (bios_size < 0 || bios_size > BIOS_SIZE) {
355 357 cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
... ...
hw/ppc_prep.c
... ... @@ -564,7 +564,9 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
564 564  
565 565 /* allocate and load BIOS */
566 566 bios_offset = ram_size + vga_ram_size;
567   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
  567 + if (bios_name == NULL)
  568 + bios_name = BIOS_FILENAME;
  569 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
568 570 bios_size = load_image(buf, phys_ram_base + bios_offset);
569 571 if (bios_size < 0 || bios_size > BIOS_SIZE) {
570 572 cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
... ...
hw/shix.c
... ... @@ -83,12 +83,14 @@ void shix_init(int ram_size, int vga_ram_size, int boot_device,
83 83 cpu_register_physical_memory(0x0c000000, 0x01000000, 0x01004000);
84 84  
85 85 /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
86   - printf("%s: load BIOS '%s'\n", __func__, BIOS_FILENAME);
87   - ret = load_image(BIOS_FILENAME, phys_ram_base);
  86 + if (bios_name == NULL)
  87 + bios_name = BIOS_FILENAME;
  88 + printf("%s: load BIOS '%s'\n", __func__, bios_name);
  89 + ret = load_image(bios_name, phys_ram_base);
88 90 if (ret < 0) { /* Check bios size */
89 91 fprintf(stderr, "ret=%d\n", ret);
90 92 fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
91   - BIOS_FILENAME);
  93 + bios_name);
92 94 exit(1);
93 95 }
94 96  
... ...
hw/sun4m.c
... ... @@ -430,7 +430,9 @@ static void sun4m_load_kernel(long vram_size, int RAM_size, int boot_device,
430 430 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK,
431 431 prom_offset | IO_MEM_ROM);
432 432  
433   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
  433 + if (bios_name == NULL)
  434 + bios_name = PROM_FILENAME;
  435 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
434 436 ret = load_elf(buf, PROM_PADDR - PROM_VADDR, NULL, NULL, NULL);
435 437 if (ret < 0) {
436 438 fprintf(stderr, "qemu: could not load prom '%s'\n",
... ...
hw/sun4u.c
... ... @@ -382,7 +382,9 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
382 382 (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK,
383 383 prom_offset | IO_MEM_ROM);
384 384  
385   - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
  385 + if (bios_name == NULL)
  386 + bios_name = PROM_FILENAME;
  387 + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
386 388 ret = load_elf(buf, PROM_ADDR - PROM_VADDR, NULL, NULL, NULL);
387 389 if (ret < 0) {
388 390 fprintf(stderr, "qemu: could not load prom '%s'\n",
... ...
... ... @@ -143,6 +143,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
143 143 #define MAX_IOPORTS 65536
144 144  
145 145 const char *bios_dir = CONFIG_QEMU_SHAREDIR;
  146 +const char *bios_name = NULL;
146 147 char phys_ram_file[1024];
147 148 void *ioport_opaque[MAX_IOPORTS];
148 149 IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
... ... @@ -7149,6 +7150,7 @@ enum {
7149 7150 QEMU_OPTION_d,
7150 7151 QEMU_OPTION_hdachs,
7151 7152 QEMU_OPTION_L,
  7153 + QEMU_OPTION_bios,
7152 7154 QEMU_OPTION_no_code_copy,
7153 7155 QEMU_OPTION_k,
7154 7156 QEMU_OPTION_localtime,
... ... @@ -7241,6 +7243,7 @@ const QEMUOption qemu_options[] = {
7241 7243 { "d", HAS_ARG, QEMU_OPTION_d },
7242 7244 { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
7243 7245 { "L", HAS_ARG, QEMU_OPTION_L },
  7246 + { "bios", HAS_ARG, QEMU_OPTION_bios },
7244 7247 { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
7245 7248 #ifdef USE_KQEMU
7246 7249 { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
... ... @@ -7887,6 +7890,9 @@ int main(int argc, char **argv)
7887 7890 case QEMU_OPTION_L:
7888 7891 bios_dir = optarg;
7889 7892 break;
  7893 + case QEMU_OPTION_bios:
  7894 + bios_name = optarg;
  7895 + break;
7890 7896 case QEMU_OPTION_S:
7891 7897 autostart = 0;
7892 7898 break;
... ...
... ... @@ -129,6 +129,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
129 129 void hw_error(const char *fmt, ...);
130 130  
131 131 extern const char *bios_dir;
  132 +extern const char *bios_name;
132 133  
133 134 extern int vm_running;
134 135 extern const char *qemu_name;
... ...