qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image


From: Fabien Chouteau
Subject: [Qemu-devel] [PATCH 3/3] PPC PReP: can run without bios image
Date: Wed, 3 Apr 2013 18:40:13 +0200

If we use an ELF kernel there's no need for bios. '-bios -' means no
bios.

Signed-off-by: Fabien Chouteau <address@hidden>
---
 hw/ppc/prep.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 12198ff..8acec46 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -517,13 +517,22 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
     memory_region_set_readonly(bios, true);
     memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);
     vmstate_register_ram_global(bios);
-    if (bios_name == NULL)
-        bios_name = BIOS_FILENAME;
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
-    if (filename) {
-        bios_size = get_image_size(filename);
-    } else {
+
+    if (bios_name != NULL && strcmp(bios_name, "-") == 0) {
+        /* No bios */
         bios_size = -1;
+        filename = NULL;
+    } else {
+        if (bios_name == NULL) {
+            /* Default bios */
+            bios_name = BIOS_FILENAME;
+        }
+        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        if (filename != NULL) {
+            bios_size = get_image_size(filename);
+        } else {
+            bios_size = -1;
+        }
     }
     if (bios_size > 0 && bios_size <= BIOS_SIZE) {
         hwaddr bios_addr;
@@ -531,7 +540,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
         bios_addr = (uint32_t)(-bios_size);
         bios_size = load_image_targphys(filename, bios_addr, bios_size);
     }
-    if (bios_size < 0 || bios_size > BIOS_SIZE) {
+    if (filename != NULL && (bios_size < 0 || bios_size > BIOS_SIZE)) {
         hw_error("qemu: could not load PPC PREP bios '%s'\n", bios_name);
     }
     if (filename) {
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]