Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2004 02:48:34 +0900 (JST)
From:      Norikatsu Shigemura <nork@FreeBSD.org>
To:        qemu-devel@nongnu.org
Cc:        freebsd-hackers@FreeBSD.org
Subject:   qemu -boot d -cdrom /dev/cd0 on FreeBSD is not good
Message-ID:  <200411151748.iAFHmYQ1019323@sakura.ninth-nine.com>

next in thread | raw e-mail | index | archive | help
	I tried to install Windows XP SP2 on qemu over FreeBSD 6-current
	like following command, but failed.

	# qemu -boot d -cdrom /dev/cd0 windows.img

	Because find_image_format on qemu/block.c is failed.  This
	problem can be confirmed like following program.
- - - - - - - - - - - - - - - - - - - - - - - -
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(void)
{
	char buf[2048];
	int fd = open("/dev/cd0", O_RDONLY);
	if(  read(fd, buf, sizeof(buf)) < 0  )  {	/* no problem */
		perror("[1] read error.");
	}
	if(  read(fd, buf, sizeof(buf) / 2) < 0  )  {	/* problem */
		perror("[2] read error.");
	}
}
- - - - - - - - - - - - - - - - - - - - - - - -

	Adhoc-ly, I changed "buf" size to 2048. and confirmed this
	problem was fixed.
- - - - - - - - - - - - - - - - - - - - - - - -
static BlockDriver *find_image_format(const char *filename)
{
    int fd, ret, score, score_max;
    BlockDriver *drv1, *drv;
    uint8_t buf[1024];					=> buf[2048]
(snip)
    ret = read(fd, buf, sizeof(buf));
    if (ret < 0) {
        close(fd);
        return NULL;
    }
(snip)
- - - - - - - - - - - - - - - - - - - - - - - -
Obtained from:	qemu-0.6.1

	I think magic number 2048 is sector size, but I don't know
	how to get valid read size.  Anyone, do you have any idea?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411151748.iAFHmYQ1019323>