aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-07 21:30:08 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-07 21:30:08 +0000
commit41b9be476c2dc17dfb5182a829873644e981f9bc (patch)
treebff15352026b12c899cf29bd452274680b9a09f9 /hw/pc.c
parent52302d72748bd6c574bf2fd7c8be7f19d12db467 (diff)
downloadqemu-41b9be476c2dc17dfb5182a829873644e981f9bc.zip
qemu-41b9be476c2dc17dfb5182a829873644e981f9bc.tar.gz
qemu-41b9be476c2dc17dfb5182a829873644e981f9bc.tar.bz2
preserve partition table when using -linux option
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@716 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 83e614b..d0fcb0f 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -313,6 +313,7 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device,
if (linux_boot) {
uint8_t bootsect[512];
+ uint8_t old_bootsect[512];
if (bs_table[0] == NULL) {
fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n");
@@ -326,6 +327,11 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device,
exit(1);
}
+ if (bdrv_read(bs_table[0], 0, old_bootsect, 1) >= 0) {
+ /* copy the MSDOS partition table */
+ memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40);
+ }
+
bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect));
/* now we can load the kernel */