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
This commit is contained in:
		
							parent
							
								
									e9c05b42e3
								
							
						
					
					
						commit
						1192dad879
					
				@ -791,7 +791,9 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* Load a BIOS image unless a kernel image has been specified. */
 | 
					    /* Load a BIOS image unless a kernel image has been specified. */
 | 
				
			||||||
    if (!kernel_filename) {
 | 
					    if (!kernel_filename) {
 | 
				
			||||||
        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					        if (bios_name == NULL)
 | 
				
			||||||
 | 
					            bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
        ret = load_image(buf, phys_ram_base + bios_offset);
 | 
					        ret = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
        if (ret < 0 || ret > BIOS_SIZE) {
 | 
					        if (ret < 0 || ret > BIOS_SIZE) {
 | 
				
			||||||
            fprintf(stderr,
 | 
					            fprintf(stderr,
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,9 @@ void mips_pica61_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* load a BIOS image */
 | 
					    /* load a BIOS image */
 | 
				
			||||||
    bios_offset = ram_size + vga_ram_size;
 | 
					    bios_offset = ram_size + vga_ram_size;
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
    if ((bios_size <= 0) || (bios_size > BIOS_SIZE)) {
 | 
					    if ((bios_size <= 0) || (bios_size > BIOS_SIZE)) {
 | 
				
			||||||
        /* fatal */
 | 
					        /* fatal */
 | 
				
			||||||
 | 
				
			|||||||
@ -179,7 +179,9 @@ void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
       preloaded we also initialize the hardware, since the BIOS wasn't
 | 
					       preloaded we also initialize the hardware, since the BIOS wasn't
 | 
				
			||||||
       run. */
 | 
					       run. */
 | 
				
			||||||
    bios_offset = ram_size + vga_ram_size;
 | 
					    bios_offset = ram_size + vga_ram_size;
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
    if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
 | 
					    if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
 | 
				
			||||||
	cpu_register_physical_memory(0x1fc00000,
 | 
						cpu_register_physical_memory(0x1fc00000,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								hw/pc.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hw/pc.c
									
									
									
									
									
								
							@ -706,7 +706,9 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
    vga_ram_addr = qemu_ram_alloc(vga_ram_size);
 | 
					    vga_ram_addr = qemu_ram_alloc(vga_ram_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* BIOS load */
 | 
					    /* BIOS load */
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    bios_size = get_image_size(buf);
 | 
					    bios_size = get_image_size(buf);
 | 
				
			||||||
    if (bios_size <= 0 ||
 | 
					    if (bios_size <= 0 ||
 | 
				
			||||||
        (bios_size % 65536) != 0) {
 | 
					        (bios_size % 65536) != 0) {
 | 
				
			||||||
 | 
				
			|||||||
@ -236,7 +236,9 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
#ifdef DEBUG_BOARD_INIT
 | 
					#ifdef DEBUG_BOARD_INIT
 | 
				
			||||||
        printf("Load BIOS from file\n");
 | 
					        printf("Load BIOS from file\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					        if (bios_name == NULL)
 | 
				
			||||||
 | 
					            bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
        bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					        bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
        if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
					        if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
				
			||||||
            fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
 | 
					            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,
 | 
				
			|||||||
#ifdef DEBUG_BOARD_INIT
 | 
					#ifdef DEBUG_BOARD_INIT
 | 
				
			||||||
        printf("Load BIOS from file\n");
 | 
					        printf("Load BIOS from file\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					        if (bios_name == NULL)
 | 
				
			||||||
 | 
					            bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
        bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					        bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
        if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
					        if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
				
			||||||
            fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
 | 
					            fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
 | 
				
			||||||
 | 
				
			|||||||
@ -349,7 +349,9 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* allocate and load BIOS */
 | 
					    /* allocate and load BIOS */
 | 
				
			||||||
    bios_offset = ram_size + vga_ram_size;
 | 
					    bios_offset = ram_size + vga_ram_size;
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
    if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
					    if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
				
			||||||
        cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
 | 
					        cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
 | 
				
			||||||
 | 
				
			|||||||
@ -564,7 +564,9 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* allocate and load BIOS */
 | 
					    /* allocate and load BIOS */
 | 
				
			||||||
    bios_offset = ram_size + vga_ram_size;
 | 
					    bios_offset = ram_size + vga_ram_size;
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
					    bios_size = load_image(buf, phys_ram_base + bios_offset);
 | 
				
			||||||
    if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
					    if (bios_size < 0 || bios_size > BIOS_SIZE) {
 | 
				
			||||||
        cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
 | 
					        cpu_abort(env, "qemu: could not load PPC PREP bios '%s'\n", buf);
 | 
				
			||||||
 | 
				
			|||||||
@ -83,12 +83,14 @@ void shix_init(int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
    cpu_register_physical_memory(0x0c000000, 0x01000000, 0x01004000);
 | 
					    cpu_register_physical_memory(0x0c000000, 0x01000000, 0x01004000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
 | 
					    /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
 | 
				
			||||||
    printf("%s: load BIOS '%s'\n", __func__, BIOS_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
    ret = load_image(BIOS_FILENAME, phys_ram_base);
 | 
					        bios_name = BIOS_FILENAME;
 | 
				
			||||||
 | 
					    printf("%s: load BIOS '%s'\n", __func__, bios_name);
 | 
				
			||||||
 | 
					    ret = load_image(bios_name, phys_ram_base);
 | 
				
			||||||
    if (ret < 0) {		/* Check bios size */
 | 
					    if (ret < 0) {		/* Check bios size */
 | 
				
			||||||
	fprintf(stderr, "ret=%d\n", ret);
 | 
						fprintf(stderr, "ret=%d\n", ret);
 | 
				
			||||||
	fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
 | 
						fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
 | 
				
			||||||
		BIOS_FILENAME);
 | 
							bios_name);
 | 
				
			||||||
	exit(1);
 | 
						exit(1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -430,7 +430,9 @@ static void sun4m_load_kernel(long vram_size, int RAM_size, int boot_device,
 | 
				
			|||||||
                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK,
 | 
					                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK,
 | 
				
			||||||
                                 prom_offset | IO_MEM_ROM);
 | 
					                                 prom_offset | IO_MEM_ROM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = PROM_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    ret = load_elf(buf, PROM_PADDR - PROM_VADDR, NULL, NULL, NULL);
 | 
					    ret = load_elf(buf, PROM_PADDR - PROM_VADDR, NULL, NULL, NULL);
 | 
				
			||||||
    if (ret < 0) {
 | 
					    if (ret < 0) {
 | 
				
			||||||
	fprintf(stderr, "qemu: could not load prom '%s'\n",
 | 
						fprintf(stderr, "qemu: could not load prom '%s'\n",
 | 
				
			||||||
 | 
				
			|||||||
@ -382,7 +382,9 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
 | 
				
			|||||||
                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK,
 | 
					                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK,
 | 
				
			||||||
                                 prom_offset | IO_MEM_ROM);
 | 
					                                 prom_offset | IO_MEM_ROM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
 | 
					    if (bios_name == NULL)
 | 
				
			||||||
 | 
					        bios_name = PROM_FILENAME;
 | 
				
			||||||
 | 
					    snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
 | 
				
			||||||
    ret = load_elf(buf, PROM_ADDR - PROM_VADDR, NULL, NULL, NULL);
 | 
					    ret = load_elf(buf, PROM_ADDR - PROM_VADDR, NULL, NULL, NULL);
 | 
				
			||||||
    if (ret < 0) {
 | 
					    if (ret < 0) {
 | 
				
			||||||
	fprintf(stderr, "qemu: could not load prom '%s'\n",
 | 
						fprintf(stderr, "qemu: could not load prom '%s'\n",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								vl.c
									
									
									
									
									
								
							@ -143,6 +143,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
 | 
				
			|||||||
#define MAX_IOPORTS 65536
 | 
					#define MAX_IOPORTS 65536
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *bios_dir = CONFIG_QEMU_SHAREDIR;
 | 
					const char *bios_dir = CONFIG_QEMU_SHAREDIR;
 | 
				
			||||||
 | 
					const char *bios_name = NULL;
 | 
				
			||||||
char phys_ram_file[1024];
 | 
					char phys_ram_file[1024];
 | 
				
			||||||
void *ioport_opaque[MAX_IOPORTS];
 | 
					void *ioport_opaque[MAX_IOPORTS];
 | 
				
			||||||
IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
 | 
					IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS];
 | 
				
			||||||
@ -7149,6 +7150,7 @@ enum {
 | 
				
			|||||||
    QEMU_OPTION_d,
 | 
					    QEMU_OPTION_d,
 | 
				
			||||||
    QEMU_OPTION_hdachs,
 | 
					    QEMU_OPTION_hdachs,
 | 
				
			||||||
    QEMU_OPTION_L,
 | 
					    QEMU_OPTION_L,
 | 
				
			||||||
 | 
					    QEMU_OPTION_bios,
 | 
				
			||||||
    QEMU_OPTION_no_code_copy,
 | 
					    QEMU_OPTION_no_code_copy,
 | 
				
			||||||
    QEMU_OPTION_k,
 | 
					    QEMU_OPTION_k,
 | 
				
			||||||
    QEMU_OPTION_localtime,
 | 
					    QEMU_OPTION_localtime,
 | 
				
			||||||
@ -7241,6 +7243,7 @@ const QEMUOption qemu_options[] = {
 | 
				
			|||||||
    { "d", HAS_ARG, QEMU_OPTION_d },
 | 
					    { "d", HAS_ARG, QEMU_OPTION_d },
 | 
				
			||||||
    { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
 | 
					    { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
 | 
				
			||||||
    { "L", HAS_ARG, QEMU_OPTION_L },
 | 
					    { "L", HAS_ARG, QEMU_OPTION_L },
 | 
				
			||||||
 | 
					    { "bios", HAS_ARG, QEMU_OPTION_bios },
 | 
				
			||||||
    { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
 | 
					    { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
 | 
				
			||||||
#ifdef USE_KQEMU
 | 
					#ifdef USE_KQEMU
 | 
				
			||||||
    { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
 | 
					    { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
 | 
				
			||||||
@ -7887,6 +7890,9 @@ int main(int argc, char **argv)
 | 
				
			|||||||
            case QEMU_OPTION_L:
 | 
					            case QEMU_OPTION_L:
 | 
				
			||||||
                bios_dir = optarg;
 | 
					                bios_dir = optarg;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case QEMU_OPTION_bios:
 | 
				
			||||||
 | 
					                bios_name = optarg;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            case QEMU_OPTION_S:
 | 
					            case QEMU_OPTION_S:
 | 
				
			||||||
                autostart = 0;
 | 
					                autostart = 0;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vl.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								vl.h
									
									
									
									
									
								
							@ -129,6 +129,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
 | 
				
			|||||||
void hw_error(const char *fmt, ...);
 | 
					void hw_error(const char *fmt, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern const char *bios_dir;
 | 
					extern const char *bios_dir;
 | 
				
			||||||
 | 
					extern const char *bios_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int vm_running;
 | 
					extern int vm_running;
 | 
				
			||||||
extern const char *qemu_name;
 | 
					extern const char *qemu_name;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user