using block devices as harddisks

Ph. Marek marek at bmlv.gv.at
Wed Jun 26 18:09:46 EST 2002


Hello everybody,

I'm currently working to get bochs to support block devices (eg. /dev/hda) as 
harddisks.
I downloaded the current release
	http://prdownloads.sourceforge.net/bochs/bochs-1.4.tar.gz
and found that size detection doesn't work.

Here's a patch to get the detection working.

But I got another problem: the bios won't boot if there are more than 15 
heads! Is there another bios which support 255 heads? the parameter 
"newharddrivesupport" doesn't work (of course - that's a bochs parameter,
but the bios is another point)
I'd need to have something along the lines spt=63, heads=255, cyls=1023


Can somebody help me please?


Regards,

Phil




diff -urN bochs-1.4.orig/iodev/harddrv.cc bochs-1.4/iodev/harddrv.cc
--- bochs-1.4.orig/iodev/harddrv.cc     Mon Mar 25 02:47:14 2002
+++ bochs-1.4/iodev/harddrv.cc  Wed Jun 26 09:42:51 2002
@@ -2779,6 +2779,20 @@
     if (ret) {
          BX_PANIC(("fstat() returns error!"));
     }
+    if (S_ISBLK(stat_buf.st_mode))
+    {
+/* it's a block device. st_size will be 0, so set it to the correct size. */
+      if (ioctl(fd_table[i],BLKGETSIZE,&(stat_buf.st_size))==-1)
+        BX_PANIC(("size of block device %s can't be read",pathname));
+      if (stat_buf.st_size > (0x7ffffff/512))
+      {
+       BX_ERROR(("size of disk image is too big, rounded down"));
+        stat_buf.st_size=0x7ffffe00; /* maximum size without overflow */
+      }
+      else
+        stat_buf.st_size*=512; /* returned value is sectors */
+      /* what about an overflow here? should possibly use fstat64 */
+    }
     if ((stat_buf.st_size % 512) != 0) {
       BX_PANIC(("size of disk image must be multiple of 512 bytes"));
     }
diff -urN bochs-1.4.orig/bochs.h bochs-1.4/bochs.h
--- bochs-1.4.orig/bochs.h      Tue Mar 26 14:59:36 2002
+++ bochs-1.4/bochs.h   Wed Jun 26 09:34:59 2002
@@ -58,6 +58,7 @@
 #else
 #  ifndef WIN32
 #    include <sys/time.h>
+#    include <sys/mount.h>
 #  endif
 #  include <sys/types.h>
 #  include <sys/stat.h>




More information about the openssh-unix-dev mailing list