From: "Jim C. Brown" <jma5@umd.edu>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] using partition images
Date: Mon, 8 May 2006 00:49:26 -0400 [thread overview]
Message-ID: <20060508044926.GA21951@jbrown.mylinuxbox.org> (raw)
In-Reply-To: <20060508035346.GA12697@jbrown.mylinuxbox.org>
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On Sun, May 07, 2006 at 11:53:46PM -0400, Jim C. Brown wrote:
> Known Issues:
>
> booting is not supported - this will require passing a separate bootsector.
I stand corrected. New patch that adds support for booting partition images.
Apply this on top of the first one.
Also attached is the required bootsector.h (this contains the actual code of
the bootsector).
Bootsector code for the MBR was taken from http://www.cpqlinux.com/mbr.html.
Also attached is a tarball of the sources I used to create bootsector.h
--
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
[-- Attachment #2: block.patch --]
[-- Type: text/plain, Size: 891 bytes --]
--- ../qemu.cvs/block-part-raw.c Sun May 7 23:54:03 2006
+++ block-part-raw.c Mon May 8 00:40:32 2006
@@ -23,6 +23,7 @@
*/
#include "vl.h"
#include "block_int.h"
+#include "bootsector.h"
#ifdef __sun__
#include <sys/dkio.h>
@@ -40,7 +41,7 @@
return 0;
}
-static int part_raw_open(BlockDriverState *bs, const char *filename)
+static int part_raw_open(BlockDriverState *bs, const char *nfilename)
{
BDRVPartRawState *s = bs->opaque;
int fd;
@@ -53,6 +54,7 @@
int rv;
#endif
int head, cylinder, sector;
+ const char * filename = &(nfilename[5]);
fd = open(filename, O_RDWR | O_BINARY | O_LARGEFILE);
if (fd < 0) {
@@ -102,6 +104,7 @@
/* set up fake MBR */
memset(s->mbr_data, 0, 63*512);
+ memcpy(s->mbr_data, mbr_boot_sector, 512);
/* first partition is bootable */
s->mbr_data[446] = 0x80;
/* start head */
[-- Attachment #3: bootsector.h --]
[-- Type: text/plain, Size: 2781 bytes --]
const char mbr_boot_sector[512] = {
0xfa,
0x33,
0xc0,
0x8e,
0xd0,
0xbc,
0x0,
0x7c,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0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0};
[-- Attachment #4: bootsector.tgz --]
[-- Type: application/x-tar-gz, Size: 3534 bytes --]
next prev parent reply other threads:[~2006-05-08 4:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-08 3:53 [Qemu-devel] using partition images Jim C. Brown
2006-05-08 4:49 ` Jim C. Brown [this message]
2006-05-08 10:20 ` Fabrice Bellard
2006-05-08 12:26 ` Jim C. Brown
2006-05-08 12:32 ` Johannes Schindelin
2006-05-08 13:11 ` Paul Brook
2006-05-08 14:19 ` Jim C. Brown
2006-05-08 14:28 ` Paul Brook
2006-05-08 14:59 ` Jim C. Brown
2006-05-08 15:09 ` Paul Brook
2006-05-08 14:49 ` Jim C. Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060508044926.GA21951@jbrown.mylinuxbox.org \
--to=jma5@umd.edu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).