qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [QEMU] Windows 2000 image Startup Problems


From: Struan Bartlett
Subject: Re: [Qemu-devel] [QEMU] Windows 2000 image Startup Problems
Date: Sat, 02 Apr 2005 21:02:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

Did you try the NT-BOOT-MAIN patch? (copy attached) It works for me routinely.

Incidentally, I don't recall where I found this - I can't see it in the dad-answers archive - but it would be good if someone put it there. Who's in charge of maintaining the patch archive?

Struan

Massimo Callegari wrote:

Hi, I'm facing a problem not yet fully documented or experienced in the
mailing lists I navigated 'till now, and, in any case, not really solved so
far, for what I know. Here is the description of the situation.

I installed a Windows 2000 Image with Qemu (0.6.0-3.1 and qemu-0.6.1-3.1
released via rpm package) under different Linux installations (a Suse PRO
9.2 distribution and a Fedora Core 2/3 versions).

The steps performed to obtain this are the following:

* Creation of a qcow image:

        $ qemu-img create -f img Win2000.img 10000M   or  $ qemu-mkcow
create Win2000.qcow 10G

* Copy of the installation CD of Windows 2000 on the local hard disk

        $ dd if=/dev/cdrom of=Win2000.iso

* Installation of Windows 2000 on the Qemu image:

        $ qemu -boot d -cdrom Win2000.iso -hda Win2000.qcow/img

The installation proceeeds without (almost) any problem and ends
successfully, but, when I try to load the newly created image ($ qemu
Win2000.qcow/img) the system boot ends up with an error message ("Booting
from Hard Disk ... Disk Read Error. Press CTRL+ALT+CANC to restart") like if
the mbr of the image were not present or if the partition table didn't
recognize a bootable sector on the "virtual" disk.

Notice that the problem doesn't appear 'till the boot of the system is based
on the cdrom-based install process as far as windows warm boots (in other
words the first time I face the problem is when I cold boot and start my
Windows 2000 image with the Qemu command "$ qemu Win2000.qcow/img". The same
doesn't happen if I rely on the newly made installation and on the related
command "$ qemu -boot d -cdrom Win2000.iso -hda Win2000.qcow/img". In that
case the error message is the one reported above).

I tried to boot the system from cdrom with "qemu -boot d -cdrom Win2000.iso
-hda Win2000.qcow/img" like during installation and in that case the error
message is the same.

I noticed that 'till now the only way to have a good bootable image is via
the creation of the Qemu image file with the qemu-mkcow command (for me it
was the only case in which it worked for the windows 2000 installation and
cold boot) on the Suse 9.2 installation with the qemu-0.6.0-3.1 rpm package
installed. All other tests failed.

Did anyone afford and solve this issue (apart from modifying by commenting
out line 1896 in hw/ide.c) ?

I think a definitive solution could made the Emulator more stable and
usable.

Thanks in advance for your cooperation.

Massimo




_______________________________________________
Qemu-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/qemu-devel
diff -rbu qemu.orig/hw/ide.c qemu/hw/ide.c
--- qemu.orig/hw/ide.c  2004-12-02 23:20:21.000000000 +0300
+++ qemu/hw/ide.c       2004-12-17 14:06:15.000000000 +0300
@@ -332,8 +332,12 @@
     uint8_t *data_ptr;
     uint8_t *data_end;
     uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
+    int ide_set_irq_from_timer;
 } IDEState;
 
+volatile int ide_set_irq_from_timer;
+static IDEState *IDEStates[4];
+
 #define BM_STATUS_DMAING 0x01
 #define BM_STATUS_ERROR  0x02
 #define BM_STATUS_INT    0x04
@@ -512,6 +516,21 @@
     }
 }
 
+void make_ide_set_irq(void)
+{
+       int i;
+       IDEState *s;
+
+       ide_set_irq_from_timer--;
+       for(i = 0; (s=IDEStates[i]) != NULL; i++) {
+               if(s->ide_set_irq_from_timer) {
+                       s->ide_set_irq_from_timer--;
+                       ide_set_irq(s);
+                       break;
+               }
+       }
+}
+
 /* prepare data transfer and tell what to do after */
 static void ide_transfer_start(IDEState *s, uint8_t *buf, int size, 
                                EndTransferFunc *end_transfer_func)
@@ -667,7 +686,11 @@
         ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write);
     }
     ide_set_sector(s, sector_num + n);
+    if(s->ide_set_irq_from_timer) {
+       ide_set_irq_from_timer++;
+    } else {
     ide_set_irq(s);
+    }
 }
 
 static int ide_write_dma_cb(IDEState *s, 
@@ -1511,6 +1534,7 @@
             s->error = 0;
             s->status = SEEK_STAT | READY_STAT;
             s->req_nb_sectors = 1;
+           s->ide_set_irq_from_timer = 1;
             ide_transfer_start(s, s->io_buffer, 512, ide_sector_write);
             break;
         case WIN_MULTREAD:
@@ -1528,6 +1552,7 @@
             n = s->nsector;
             if (n > s->req_nb_sectors)
                 n = s->req_nb_sectors;
+           s->ide_set_irq_from_timer = 1;
             ide_transfer_start(s, s->io_buffer, 512 * n, ide_sector_write);
             break;
         case WIN_READDMA:
@@ -1883,6 +1908,7 @@
 
     for(i = 0; i < 2; i++) {
         s = ide_state + i;
+       IDEStates[drive_serial-1] = s;
         if (i == 0)
             s->bs = hd0;
         else
diff -rbu qemu.orig/vl.c qemu/vl.c
--- qemu.orig/vl.c      2004-12-13 01:20:04.000000000 +0300
+++ qemu/vl.c   2004-12-17 12:41:16.000000000 +0300
@@ -911,7 +911,7 @@
         
         /* timer signal */
         sigfillset(&act.sa_mask);
-        act.sa_flags = 0;
+       act.sa_flags = SA_RESTART;
 #if defined (TARGET_I386) && defined(USE_CODE_COPY)
         act.sa_flags |= SA_ONSTACK;
 #endif
@@ -2403,7 +2403,12 @@
     int n, max_size;
 #endif
     int ret;
+    /* ide.c hack */
+    extern volatile int ide_set_irq_from_timer;
+    extern void make_ide_set_irq(void);
 
+       if(ide_set_irq_from_timer)
+               make_ide_set_irq();
 #ifdef _WIN32
         if (timeout > 0)
             Sleep(timeout);
@@ -2449,8 +2454,6 @@
                             n = read(ioh->fd, buf, ioh->max_size);
                             if (n >= 0) {
                                 ioh->fd_read(ioh->opaque, buf, n);
-                            } else if (errno != EAGAIN) {
-                                ioh->fd_read(ioh->opaque, NULL, -errno);
                             }
                         }
                     }

reply via email to

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